Skip to content

Commit

Permalink
wip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 14, 2023
1 parent 695130e commit d933823
Showing 1 changed file with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def setUpClass(cls):
"product.product_product_4_product_template"
)
cls.product_template_4.write({"invoice_policy": "order"})
cls.pt_11 = cls.env.ref("product.product_product_11_product_template")
cls.journal = cls.env["account.journal"].search(
[("type", "=", "purchase")], limit=1
)
Expand Down Expand Up @@ -167,6 +168,43 @@ def test_commission_domain(self):
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()

# discount 1
self.demo_agent_rules_restricted.commission_id = (
self.demo_commission_rules_restrict
)
self.azure.commission_item_agent_ids.group_ids = [
(6, 0, self.demo_cig_spain.ids)
]
so = self._create_sale_order(self.pt_11.product_variant_id, self.azure)
so.order_line.discount = 11
so.recompute_lines_agents()
so.action_confirm()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()

# discount 2
self.demo_agent_rules_restricted.commission_id = (
self.demo_commission_rules_restrict
)
self.azure.commission_item_agent_ids.group_ids = [
(6, 0, self.demo_cig_italy.ids)
]
so = self._create_sale_order(self.pt_11.product_variant_id, self.azure)
so.order_line.discount = 11
so.recompute_lines_agents()
so.action_confirm()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()

# discount 3 net_amount
self.azure.agent_ids.commission_id.amount_base_type = "net_amount"
so = self._create_sale_order(self.pt_11.product_variant_id, self.azure)
so.order_line.discount = 11
so.recompute_lines_agents()
so.action_confirm()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()

# computes was modified to consider new commission type: product_restricted
self.product_5.commission_free = True
so = self._create_sale_order(self.product_5, self.azure)
Expand All @@ -188,7 +226,6 @@ def test_commission_domain(self):
invoice.line_ids.agent_ids._compute_amount()

# computes was modified to consider new commission type: product_restricted
self.azure.agent_ids.commission_id = self.demo_commission_rules
so = self._create_sale_order(self.product_1, self.azure)
so.recompute_lines_agents()
so.action_confirm()
Expand Down

0 comments on commit d933823

Please sign in to comment.