From 22a769aca0e0a5b6b073587f0e0ffbea3d3f05c9 Mon Sep 17 00:00:00 2001 From: william-andre Date: Tue, 21 Nov 2023 15:04:11 +0000 Subject: [PATCH] [FIX] account: relax tax scope constraint for tax groups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create a tax of type `group` and with a `tax_scope` set * Add a child tax without `tax_scope` set This will raise an error because the `tax_scope` is not exactly the same since it doesn't have a value. We should be able to share sub taxes without a scope, exactly like for `type_tax_use`. This is also what the message suggests. closes odoo/odoo#143089 X-original-commit: 6101b2bbeaf996d4c3472ad36d740243bb0a5aa8 Signed-off-by: Josse Colpaert Signed-off-by: William André (wan) --- addons/account/models/account_tax.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index 17f61f4ef18..41815fe5c4c 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -455,7 +455,11 @@ class AccountTax(models.Model): for tax in self: if not tax._check_m2m_recursion('children_tax_ids'): raise ValidationError(_("Recursion found for tax %r.", tax.name)) - if any(child.type_tax_use not in ('none', tax.type_tax_use) or child.tax_scope != tax.tax_scope for child in tax.children_tax_ids): + if any( + child.type_tax_use not in ('none', tax.type_tax_use) + or child.tax_scope not in (tax.tax_scope, False) + for child in tax.children_tax_ids + ): raise ValidationError(_('The application scope of taxes in a group must be either the same as the group or left empty.')) @api.constrains('company_id')