Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 18, 2023
1 parent 7d54eee commit d3c8192
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 150)
self.assertEqual(invoice.line_ids.agent_ids.amount, 150)

#
tst_partner = so.partner_id.copy({})
Expand All @@ -215,6 +217,8 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 20)
self.assertEqual(invoice.line_ids.agent_ids.amount, 20)

# computes was modified to consider new commission type: product_restricted
self.product_5.commission_free = True
Expand All @@ -225,6 +229,8 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 0)
self.assertEqual(invoice.line_ids.agent_ids.amount, 0)

# computes was modified to consider new commission type: product_restricted
self.azure.agent_ids.commission_id = self.demo_commission_rules
Expand All @@ -235,6 +241,8 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 0)
self.assertEqual(invoice.line_ids.agent_ids.amount, 0)

# computes was modified to consider new commission type: product_restricted
so = self._create_sale_order(self.product_1, self.azure)
Expand All @@ -244,6 +252,8 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 15)
self.assertEqual(invoice.line_ids.agent_ids.amount, 15)

# discount net_amount percentage
self.demo_agent_rules_restricted_spain.commission_id = (
Expand All @@ -262,6 +272,8 @@ def test_commission_domain(self):
invoice.line_ids.agent_ids.commission_id.amount_base_type = "net_amount"
invoice.line_ids.agent_ids.commission_id.item_ids.commission_type = "percentage"
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 0)
self.assertEqual(invoice.line_ids.agent_ids.amount, 0)

# no commission items
self.demo_commission_rules_restrict.item_ids.unlink()
Expand All @@ -270,6 +282,8 @@ def test_commission_domain(self):
so.action_confirm()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
self.assertEqual(so.order_line.agent_ids.amount, 0)
self.assertEqual(invoice.line_ids.agent_ids.amount, 0)

def _create_sale_order(self, product, partner):
return self.sale_order_model.create(
Expand Down

0 comments on commit d3c8192

Please sign in to comment.