[FIX] account: relax tax scope constraint for tax groups
* 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 <jco@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user