[FIX] account_report: prevent tax tag renaming

The aim of this commit is to prevent the tax tag to be renamed when the
engine and the formula are changed at the same time.

Context:
For the french report, we had to introduce new expressions and change
the existing ones.
The nex expression would have the same formula than the previous one and
the old one would change their engine and formula.

Before this commit:
The tags are renamed to match the new formula.
This would be useless as the new engine won't use those tax

After this commit:
The tags aren't renamed.

closes odoo/odoo#147392

Task-id: 3607253
X-original-commit: 659f20add8b7c9c1a342a021bfc3c80316816c22
Related: odoo/enterprise#53341
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
Brice bib Bartoletti
2023-12-22 21:37:44 +00:00
parent 4667fdd695
commit 6e652c94b5
+2 -1
View File
@@ -596,7 +596,8 @@ class AccountReportExpression(models.Model):
self._create_tax_tags(tag_name, country)
return super().write(vals)
if 'formula' not in vals:
# In case the engine is changed we don't propagate any change to the tags themselves
if 'formula' not in vals or (vals.get('engine') and vals['engine'] != 'tax_tags'):
return super().write(vals)
tax_tags_expressions = self.filtered(lambda x: x.engine == 'tax_tags')