Skip to content

Commit

Permalink
[16.0][IMP] sale_global_discount: Remake amount global discount
Browse files Browse the repository at this point in the history
  • Loading branch information
Rferri44-S73 authored and ferran-S73 committed Jun 20, 2024
1 parent 8e464a8 commit 257971e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sale_global_discount/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _convert_to_tax_base_line_dict(
)
discounts = base_line.order_id.global_discount_ids.mapped("discount")
discounted_price_unit = price_unit
if base_line.product_id.apply_global_discount:
if not base_line.product_id.bypass_global_discount:
discounted_price_unit = base_line.order_id.get_discounted_global(
price_unit, discounts.copy()
)
Expand Down
8 changes: 5 additions & 3 deletions sale_global_discount/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ def _compute_amounts(self):
discounts = order.global_discount_ids.mapped("discount")
amount_discounted_untaxed = amount_discounted_tax = 0
for line in order.order_line:
discounted_subtotal = self.get_discounted_global(
line.price_subtotal, discounts.copy()
)
discounted_subtotal = line.price_subtotal
if not line.product_id.bypass_global_discount:
discounted_subtotal = self.get_discounted_global(
line.price_subtotal, discounts.copy()
)
amount_discounted_untaxed += discounted_subtotal
discounted_tax = line.tax_id.compute_all(
discounted_subtotal,
Expand Down

0 comments on commit 257971e

Please sign in to comment.