Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 14, 2023
1 parent 9572aad commit 0f73f31
Showing 1 changed file with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ def test_commission_domain(self):
demo_cig_italy = self.env.ref(
"sale_commission_product_criteria_domain.demo_cig_italy"
)
demo_agent_rules_restricted = self.env.ref(
"sale_commission_product_criteria_domain.demo_agent_rules_restricted"
)
demo_commission_rules_restrict = self.env.ref(
"sale_commission_product_criteria_domain.demo_commission_rules_restrict"
)
self.env.ref("product.product_delivery_01")
self.env.ref("sale_commission_product_criteria.demo_commission_rules")
demo_commission = self.env.ref("sale_commission.demo_commission")
conf_chair_config_id = self.env.ref(
"product.product_product_11_product_template"
)

# group must have commission of CI
demo_crr_item_1.group_id.commission_ids = False
demo_crr_item_1.write({"sequence": 2})
Expand Down Expand Up @@ -101,9 +114,6 @@ def test_commission_domain(self):
azure._onchange_agent_ids()
azure._compute_allowed_commission_group_ids_domain()
self.assertFalse(azure.allowed_commission_group_ids_domain)
demo_agent_rules_restricted = self.env.ref(
"sale_commission_product_criteria_domain.demo_agent_rules_restricted"
)
demo_agent_rules_restricted._compute_allowed_commission_group_ids_domain()
self.assertTrue(demo_agent_rules_restricted.allowed_commission_group_ids_domain)

Expand All @@ -126,10 +136,23 @@ def test_commission_domain(self):
invoice.recompute_lines_agents()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()
res = so.order_line.agent_ids._get_single_commission_amount(
demo_commission, 1, self.product_4, 1
)
self.assertFalse(res)

so.partner_id.commission_item_agent_ids = [(6, 0, demo_cig_italy.ids)]
so.order_line.agent_ids.agent_id = demo_agent_rules_restricted
# self.product_template_4.categ_id = self.env.ref('product.product_category_5')
res = so.order_line.agent_ids._get_single_commission_amount(
demo_commission_rules_restrict,
1,
conf_chair_config_id.product_variant_id,
1,
)
self.assertFalse(res)

self.partner.agent_ids.commission_id = self.env.ref(
"sale_commission_product_criteria.demo_commission_rules"
).id
# self.partner.agent_ids.commission_id = demo_commission_rules.id
# computes was modified to consider new commission type: product_restricted
so = self._create_sale_order(self.product_6, self.partner)
so.recompute_lines_agents()
Expand Down

0 comments on commit 0f73f31

Please sign in to comment.