Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 7, 2023
1 parent 443f2f0 commit 54c62fe
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ def test_commission_domain(self):
demo_crr_item_1 = self.env.ref(
"sale_commission_product_criteria_domain.demo_crr_item_1"
)

demo_cig_spain = self.env.ref(
"sale_commission_product_criteria_domain.demo_cig_spain"
)
# group must have commission of CI
demo_crr_item_1.group_id.commission_ids = False
demo_crr_item_1.write({"sequence": 2})
self.assertTrue(demo_crr_item_1.group_id.commission_ids)

# count related agents
demo_cig_spain._compute_agents_count()
self.assertEqual(demo_cig_spain.agents_count, 2)

# if commission is not type of restricted then CI must have no group
demo_crr_item_1.commission_id = self.env.ref(
"sale_commission_product_criteria.demo_commission_rules"
Expand All @@ -80,9 +86,6 @@ def test_commission_domain(self):
self.assertFalse(cia_azure.agent_group_ids)

# false, when commission is not product_restricted
demo_cig_spain = self.env.ref(
"sale_commission_product_criteria_domain.demo_cig_spain"
)
res_partner_tiny_sale_agent.write(
{
"allowed_commission_group_ids": [(6, 0, demo_cig_spain.ids)],
Expand All @@ -105,10 +108,6 @@ def test_commission_domain(self):
action = demo_cig_spain.action_open_related_agents()
self.assertEqual(type(action), dict)

# count related agents
demo_cig_spain._compute_agents_count()
self.assertEqual(demo_cig_spain.agents_count, 2)

# you cant delete it having related CIs
with self.assertRaises(exception=odoo.exceptions.ValidationError):
demo_cig_spain.unlink()
Expand Down

0 comments on commit 54c62fe

Please sign in to comment.