From 24d6d15efb4ab1f34b3c6bb0e83a223874526d73 Mon Sep 17 00:00:00 2001 From: Stanislas Gueniffey Date: Wed, 28 Feb 2024 17:15:47 +0100 Subject: [PATCH] [FIX] account: coherent force_price_include=False Before this commit, using context key `force_price_include=False` had different interpretations in different methods In `compute_all` its semantic was forcing the "price_include" of taxes to be False In `_compute_amount` it was ignored (as only value "True" was overriding anything) To add to this incoherence, compute_all does use `force_price_include=False` when calling `_compute_amount`. This commits brings semantical coherence to the `account_tax` methods by keeping both interpretations of the context key the same: an override of price_include, whether its value True or False. This fixes a ticket in which the client uses that override to inverse the computation of `price_unit` from a tax-excluded counterpart. owp-3770871 closes odoo/odoo#155813 X-original-commit: 9b852b29e94bf0522f1b041caf12fa648ceb13c6 Signed-off-by: Laurent Smet (las) --- addons/account/models/account_tax.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index ad7d9ad324d..77b397c1efb 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -809,7 +809,7 @@ class AccountTax(models.Model): if tax.include_base_amount: base = recompute_base(base, incl_tax_amounts) store_included_tax_total = True - if tax.price_include or self._context.get('force_price_include'): + if self._context.get('force_price_include', tax.price_include): if tax.amount_type == 'percent': incl_tax_amounts['percent_taxes'].append((i, tax.amount * sum_repartition_factor)) elif tax.amount_type == 'division':