diff --git a/sale_commission_product_criteria_domain/models/sale_commission_line_mixin.py b/sale_commission_product_criteria_domain/models/sale_commission_line_mixin.py index ab248f59b..d44075e8f 100644 --- a/sale_commission_product_criteria_domain/models/sale_commission_line_mixin.py +++ b/sale_commission_product_criteria_domain/models/sale_commission_line_mixin.py @@ -18,7 +18,7 @@ def _get_commission_items(self, commission, product): # Module specific mod: if self.object_id._name == "sale.order.line": partner = self.object_id.order_id.partner_id - elif self.object_id._name == "account.invoice.line": + elif self.object_id._name == "account.move.line": partner = self.object_id.partner_id else: partner = False diff --git a/sale_commission_product_criteria_domain/tests/test_sale_commission_product_criteria_domain.py b/sale_commission_product_criteria_domain/tests/test_sale_commission_product_criteria_domain.py index e7cb2636d..aa5dd73ad 100644 --- a/sale_commission_product_criteria_domain/tests/test_sale_commission_product_criteria_domain.py +++ b/sale_commission_product_criteria_domain/tests/test_sale_commission_product_criteria_domain.py @@ -93,6 +93,7 @@ def test_commission_domain_demo_cases(self): so.order_line.agent_ids._compute_amount() invoice.line_ids.agent_ids._compute_amount() self.assertEqual(so.order_line.agent_ids.fixed_amount, 20) + self.assertEqual(invoice.line_ids.agent_ids.amount, 20) # Azure Spain Customizable Desk (CONFIG) - Product Template so = self._create_sale_order( @@ -105,6 +106,7 @@ def test_commission_domain_demo_cases(self): so.order_line.agent_ids._compute_amount() invoice.line_ids.agent_ids._compute_amount() self.assertEqual(so.order_line.agent_ids.percent_amount, 5) + self.assertEqual(invoice.line_ids.agent_ids.amount, 50) # Azure Spain Variant: Customizable Desk (CONFIG) (Steel, White) - Variant so = self._create_sale_order(self.product_4, self.azure) @@ -115,6 +117,7 @@ def test_commission_domain_demo_cases(self): so.order_line.agent_ids._compute_amount() invoice.line_ids.agent_ids._compute_amount() self.assertEqual(so.order_line.agent_ids.percent_amount, 15) + self.assertEqual(invoice.line_ids.agent_ids.amount, 150) # Deco Italy - All products so = self._create_sale_order(self.product_product_25, self.deco) @@ -125,6 +128,7 @@ def test_commission_domain_demo_cases(self): so.order_line.agent_ids._compute_amount() invoice.line_ids.agent_ids._compute_amount() self.assertEqual(so.order_line.agent_ids.fixed_amount, 10) + self.assertEqual(invoice.line_ids.agent_ids.amount, 10) def test_commission_domain(self): # group must have commission of CI