Skip to content

Commit

Permalink
wip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyasProgrammer committed Aug 15, 2023
1 parent 8d8cdbd commit d443237
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _get_single_commission_amount(self, commission, subtotal, product, quantity)
]
)
item_ids = list(set(item_ids).intersection(ci_with_group_ids.ids))
if item_ids:
if not item_ids:
return 0.0
commission_item = self.env["commission.item"].browse(item_ids[0])
if commission.amount_base_type == "net_amount":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,23 @@ def test_commission_domain(self):
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids._compute_amount()

# discount net_amount
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 = 20
so.recompute_lines_agents()
so.action_confirm()
so.order_line.agent_ids._compute_amount()
invoice.line_ids.agent_ids.commission_id = self.demo_commission_rules_restrict
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()

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

0 comments on commit d443237

Please sign in to comment.