diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index c2ba19ed75a..4638b9da74d 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -94,7 +94,7 @@ class AccountAccount(models.Model): note = fields.Text('Internal Notes', tracking=True) company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company) - tag_ids = fields.Many2many('account.account.tag', 'account_account_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting") + tag_ids = fields.Many2many('account.account.tag', 'account_account_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting", ondelete='restrict') group_id = fields.Many2one('account.group', compute='_compute_account_group', store=True, readonly=True, help="Account prefixes can determine account groups.") root_id = fields.Many2one('account.root', compute='_compute_account_root', store=True, precompute=True) diff --git a/addons/account/models/account_tax.py b/addons/account/models/account_tax.py index 32b7ce4d665..487ff06810a 100644 --- a/addons/account/models/account_tax.py +++ b/addons/account/models/account_tax.py @@ -1356,7 +1356,7 @@ class AccountTaxRepartitionLine(models.Model): domain="[('deprecated', '=', False), ('company_id', '=', company_id), ('account_type', 'not in', ('asset_receivable', 'liability_payable'))]", check_company=True, help="Account on which to post the tax amount") - tag_ids = fields.Many2many(string="Tax Grids", comodel_name='account.account.tag', domain=[('applicability', '=', 'taxes')], copy=True) + tag_ids = fields.Many2many(string="Tax Grids", comodel_name='account.account.tag', domain=[('applicability', '=', 'taxes')], copy=True, ondelete='restrict') tax_id = fields.Many2one(comodel_name='account.tax', ondelete='cascade', check_company=True) company_id = fields.Many2one(string="Company", comodel_name='res.company', related="tax_id.company_id", store=True, help="The company this distribution line belongs to.") sequence = fields.Integer(string="Sequence", default=1,