-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] coupon_criteria_multi_product: pre-commit stuff
- Loading branch information
1 parent
5d162b1
commit 215eeb5
Showing
10 changed files
with
86 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import coupon_criteria | ||
from . import coupon_program | ||
from . import rule_criteria | ||
from . import loyalty_rule | ||
from . import loyalty_program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2021 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import models | ||
|
||
|
||
class LoyaltyProgram(models.Model): | ||
_inherit = "loyalty.program" | ||
|
||
def _get_valid_products(self, products): | ||
""" | ||
Returns a dict containing the products that match per rule of the program | ||
""" | ||
rule_products = super()._get_valid_products(products) | ||
for rule in self.rule_ids: | ||
if rule.rule_criteria_ids and rule.rule_criteria_ids[0].repeat_product: | ||
rule_products[rule] = products | ||
if not all([x in products for x in rule.rule_criteria_ids.product_ids]): | ||
rule_products[rule] = self.env["product.product"] | ||
return rule_products |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink | ||
access_criteria_salesman,salesman,model_coupon_criteria,sales_team.group_sale_salesman,1,0,0,0 | ||
access_criteria_manager,criteria manager,model_coupon_criteria,sales_team.group_sale_manager,1,1,1,1 | ||
access_criteria_salesman,salesman,model_rule_criteria,sales_team.group_sale_salesman,1,0,0,0 | ||
access_criteria_manager,criteria manager,model_rule_criteria,sales_team.group_sale_manager,1,1,1,1 |
32 changes: 32 additions & 0 deletions
32
loyalty_criteria_multi_product/views/loyalty_rule_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="loyalty_rule_view_form" model="ir.ui.view"> | ||
<field name="model">loyalty.rule</field> | ||
<field name="inherit_id" ref="loyalty.loyalty_rule_view_form" /> | ||
<field name="arch" type="xml"> | ||
<field name="product_domain" position="before"> | ||
<field name="rule_criteria" widget="radio" /> | ||
<field | ||
name="rule_criteria_ids" | ||
attrs="{'invisible': [('rule_criteria', '!=', 'multi_product')]}" | ||
> | ||
<tree editable="bottom"> | ||
<field name="rule_min_quantity" string="Qty" /> | ||
<field name="product_ids" widget="many2many_tags" /> | ||
<field name="repeat_product" /> | ||
</tree> | ||
</field> | ||
</field> | ||
<field name="product_domain" position="attributes"> | ||
<attribute | ||
name="attrs" | ||
>{'invisible': [('rule_criteria', '!=', 'domain')]}</attribute> | ||
</field> | ||
<field name="product_ids" position="attributes"> | ||
<attribute | ||
name="attrs" | ||
>{'invisible': [('rule_criteria', '!=', 'domain')]}</attribute> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
27 changes: 0 additions & 27 deletions
27
loyalty_criteria_multi_product/views/sale_coupon_program_views.xml
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
setup/loyalty_criteria_multi_product/odoo/addons/loyalty_criteria_multi_product
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../loyalty_criteria_multi_product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |