diff --git a/account_ux/models/account_move.py b/account_ux/models/account_move.py index ebdd140eb..ef0017504 100644 --- a/account_ux/models/account_move.py +++ b/account_ux/models/account_move.py @@ -1,7 +1,7 @@ # flake8: noqa import json import base64 -from odoo import models, api, fields, _ +from odoo import models, api, fields, _, Command from odoo.exceptions import UserError @@ -70,6 +70,10 @@ def _onchange_partner_commercial(self): def copy(self, default=None): res = super().copy(default=default) + for line_to_clean in res.mapped("line_ids").filtered(lambda x: False in x.mapped("tax_ids.active")): + line_to_clean.tax_ids = [ + Command.unlink(x.id) for x in line_to_clean.tax_ids.filtered(lambda x: not x.active) + ] res._onchange_partner_commercial() return res