Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Jul 10, 2023
1 parent 568cba0 commit e059c43
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
10 changes: 8 additions & 2 deletions sale_commission_product_criteria_domain/demo/demo_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@
<!-- Commission Groups -->
<record id="demo_cig_spain" model="commission.items.group">
<field name="name">Spain</field>
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field
name="commission_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_commission_rules_restrict')])]"
/>
</record>

<record id="demo_cig_italy" model="commission.items.group">
<field name="name">Italy</field>
<field name="commission_id" ref="demo_commission_rules_restrict" />
<field
name="commission_ids"
eval="[(6, 0, [ref('sale_commission_product_criteria_domain.demo_commission_rules_restrict')])]"
/>
</record>

<!-- Commission Items -->
Expand Down
4 changes: 2 additions & 2 deletions sale_commission_product_criteria_domain/models/commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CommissionItem(models.Model):
related="commission_id.commission_type", readonly=True
)
group_id = fields.Many2one(
"commission.items.group", domain="[('commission_id', '=', commission_id)]"
"commission.items.group", domain="[('commission_ids', 'in', commission_id)]"
)


Expand All @@ -36,7 +36,7 @@ class CommissionItemsGroup(models.Model):
]

name = fields.Char(required=True)
commission_id = fields.Many2one(
commission_ids = fields.Many2many(
"sale.commission",
domain=[("commission_type", "=", "product_restricted")],
required=True,
Expand Down
9 changes: 6 additions & 3 deletions sale_commission_product_criteria_domain/views/views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
<field name="sale_commission_type" invisible="1" />
<field
name="group_id"
options="{'no_create': True}"
attrs="{'invisible': [('sale_commission_type', '!=', 'product_restricted')],
'required': [('sale_commission_type', '=', 'product_restricted')]
}"
Expand All @@ -122,7 +121,11 @@
<group>
<group>
<field name="name" />
<field name="commission_id" options="{'no_create': True}" />
<field
name="commission_ids"
options="{'no_create': True}"
widget="many2many_tags"
/>
</group>
</group>
<field name="item_ids" />
Expand All @@ -137,7 +140,7 @@
<field name="arch" type="xml">
<tree string="Commission Type Items Groups">
<field name="name" />
<field name="commission_id" />
<field name="commission_ids" widget="many2many_tags" />
</tree>
</field>
</record>
Expand Down

0 comments on commit e059c43

Please sign in to comment.