[FIX] account: don't only check the country of base tax when validating the country in multivat context
When creating from python or toying around with the onchange in the UI, it is possible that the user tries adding values in tax_tags_ids or tax_line_id that are not consistent with the tax_country of the move. The constraint didn't check that, and it should, as those cases are not legit at all and lead to incorrect amounts in the tax report. closes odoo/odoo#75407 X-original-commit: a63bd4a033dbb8874c07ce0b30984d04a24e7215 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -1837,7 +1837,9 @@ class AccountMove(models.Model):
|
||||
"""
|
||||
self._compute_tax_country_id() # We need to ensure this field has been computed, as we use it in our check
|
||||
for record in self:
|
||||
if record.line_ids.tax_ids and record.line_ids.tax_ids.country_id != record.tax_country_id:
|
||||
amls = record.line_ids
|
||||
impacted_countries = amls.tax_ids.country_id | amls.tax_line_id.country_id | amls.tax_tag_ids.country_id
|
||||
if impacted_countries and impacted_countries != record.tax_country_id:
|
||||
raise ValidationError(_("This entry contains some tax from an unallowed country. Please check its fiscal position and your tax configuration."))
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user