From 257971eb45bf9a7457ca1585e9d41f2f72df33f4 Mon Sep 17 00:00:00 2001 From: rafaferri Date: Wed, 21 Jun 2023 17:32:17 +0200 Subject: [PATCH] [16.0][IMP] sale_global_discount: Remake amount global discount --- sale_global_discount/models/account_tax.py | 2 +- sale_global_discount/models/sale_order.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sale_global_discount/models/account_tax.py b/sale_global_discount/models/account_tax.py index 102dcb87145..ebd80fbd3d7 100644 --- a/sale_global_discount/models/account_tax.py +++ b/sale_global_discount/models/account_tax.py @@ -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() ) diff --git a/sale_global_discount/models/sale_order.py b/sale_global_discount/models/sale_order.py index 7abed14bdc7..513c52e1d5f 100644 --- a/sale_global_discount/models/sale_order.py +++ b/sale_global_discount/models/sale_order.py @@ -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,