From b64ca3695c4d2d822bc41ad91eaf1f41c85a8134 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/__manifest__.py | 2 +- sale_global_discount/models/sale_order.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sale_global_discount/__manifest__.py b/sale_global_discount/__manifest__.py index eef8551a07c5..267c4bb122dc 100644 --- a/sale_global_discount/__manifest__.py +++ b/sale_global_discount/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Sale Global Discount", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "category": "Sales Management", "author": "Tecnativa," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/sale-workflow", diff --git a/sale_global_discount/models/sale_order.py b/sale_global_discount/models/sale_order.py index 7521448c0b1d..c56f6d81c0bf 100644 --- a/sale_global_discount/models/sale_order.py +++ b/sale_global_discount/models/sale_order.py @@ -97,9 +97,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 line.product_id.apply_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,