Skip to content

Commit 757b99c

Browse files
committed
[FIX] account_fiscal_position: adjust map_tax behavior for empty fiscal positions
In Odoo 19, all standard VAT taxes have fiscal_position_ids pointing to the domestic FP, which makes the base map_tax() remove all taxes for empty FPs (the condition `not self.tax_ids and taxes.fiscal_position_ids`). We avoid that by returning taxes as-is. Delegating to domestic_FP.map_tax() is unsafe: if any tax in the domestic FP has original_tax_ids configured (e.g. IVA 0% replacing IVA 21%), those replacements would be incorrectly applied to all perception/withholding-only fiscal positions. closes #1371 Signed-off-by: Katherine Zaoral - kz (#l10n) <kz@adhoc.com.ar>
1 parent 14aee9f commit 757b99c

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

l10n_ar_tax/models/account_fiscal_position.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,21 @@ def _get_fpos_validation_functions(self, partner):
110110
return functions
111111

112112
def map_tax(self, taxes):
113-
"""For argentinean fiscal positions without tax mapping we add domestic taxes because taxes are always required
114-
on argentinean invoices so there is no use case for not having them.
115-
The other alternative would be to add the new fiscal positions on every VAT tax but that would be a lot of work
116-
for the user.
113+
"""Map taxes for Argentine fiscal positions that only configure perceptions/withholdings (l10n_ar_tax_ids)
114+
without any explicit VAT tax mapping (tax_ids).
115+
116+
In v19 all standard Argentine VAT taxes have fiscal_position_ids pointing to the domestic FP (e.g. "Compras / Ventas al exterior").
117+
Because of this, taxes.fiscal_position_ids is always truthy for any IVA tax, which causes the
118+
base map_tax() to remove all taxes when the fiscal position has no tax_ids.
119+
120+
For perception/withholding-only fiscal positions we return taxes unchanged instead of delegating to
121+
domestic_FP.map_tax(). Delegating is unsafe because any tax replacement configured on the domestic FP
122+
(e.g. IVA 0% replacing IVA 21%) would be incorrectly applied to every perc/with-only FP, regardless
123+
of which one is actually active on the document.
124+
125+
FPs that do have explicit tax_ids (e.g. foreign or exempt positions with VAT mapping) are
126+
not affected and always fall through to super().
117127
"""
118128
if not self.tax_ids and self.l10n_ar_tax_ids and self != self.company_id.domestic_fiscal_position_id:
119-
return self.company_id.domestic_fiscal_position_id.map_tax(taxes)
129+
return taxes
120130
return super().map_tax(taxes)

0 commit comments

Comments
 (0)