Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Jul 20, 2023
1 parent f71245a commit 1802084
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sale_commission_product_criteria_domain/models/commission.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class CommissionItem(models.Model):
)
group_id = fields.Many2one(
"commission.items.group",
domain="[('commission_ids', 'in', commission_id)]",
ondelete="restrict",
)

Expand All @@ -46,13 +45,21 @@ class CommissionItemsGroup(models.Model):
name = fields.Char(required=True)
commission_ids = fields.Many2many(
"sale.commission",
compute="_compute_commission_ids",
domain=[("commission_type", "=", "product_restricted")],
required=True,
readonly=True,
store=True,
)
item_ids = fields.One2many(
"commission.item", "group_id", string="Items", readonly=True
)

@api.depends("item_ids")
def _compute_commission_ids(self):
for rec in self:
rec.commission_ids = [(6, 0, rec.item_ids.mapped("commission_id").ids)]


class CommissionItemAgent(models.Model):
_name = "commission.item.agent"
Expand Down
1 change: 1 addition & 0 deletions sale_commission_product_criteria_domain/views/views.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>


<record id="view_partner_form_agent_inherit" model="ir.ui.view">
<field name="name">res.partner.form.agent.inherit</field>
<field name="model">res.partner</field>
Expand Down

0 comments on commit 1802084

Please sign in to comment.