[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) <las@odoo.com>
This commit is contained in:
Stanislas Gueniffey
2024-02-29 14:07:48 +00:00
parent 62081e5ec9
commit 24d6d15efb
+1 -1
View File
@@ -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':