Skip to content

Commit

Permalink
[FIX] account_invoice_fiscal_position_update: fix tax incl. to tax excl.
Browse files Browse the repository at this point in the history
Fixes OCA#1896

This change causes the subtotal amount to remain the same when a fiscal position
change triggers a tax update from tax included in price to tax excluded from
price.

Tests are added for conversion between tax excluded to tax included as well, but
in this case the behaviour is not 'fixed'. The standard behaviour of Odoo in
case of tax excl. to tax incl. is to adjust the subtotal amount. The same
behaviour is present in the function that this module provides. It might not
be what users expect, but it seems that Odoo does not support to preserve the
subtotal amount in this case.
  • Loading branch information
StefanRijnhart committed Feb 17, 2025
1 parent 0c47ca8 commit 359b32a
Show file tree
Hide file tree
Showing 2 changed files with 350 additions and 44 deletions.
6 changes: 6 additions & 0 deletions account_invoice_fiscal_position_update/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ def _onchange_fiscal_position_id_account_invoice_fiscal_position_invoice(self):
if not line.product_id:
lines_without_product |= line
else:
price_unit = line.product_id._get_tax_included_unit_price_from_price(
line.price_unit,
line.tax_ids,
fiscal_position=line.move_id.fiscal_position_id,
)
line._compute_tax_ids()
line.price_unit = price_unit
line._compute_account_id()
if lines_without_product:
res["warning"] = {"title": _("Warning")}
Expand Down
Loading

0 comments on commit 359b32a

Please sign in to comment.