From 6e652c94b5ac11120657235bb5d07750d1b3fcd8 Mon Sep 17 00:00:00 2001 From: Brice bib Bartoletti Date: Fri, 22 Dec 2023 17:01:54 +0100 Subject: [PATCH] [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) --- addons/account/models/account_report.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_report.py b/addons/account/models/account_report.py index df7b904c8f4..71ec9618f97 100644 --- a/addons/account/models/account_report.py +++ b/addons/account/models/account_report.py @@ -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')