From c299aaed1db58cdb4893f147b59103c0c20779f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Baranx=20=28bar=29?= Date: Tue, 8 Jun 2021 11:51:09 +0000 Subject: [PATCH] [FIX] account: remove tags records without unlinking them In `_remove_tax_used_only_by_self`, as tags will be properly removed in `_delete_tags_from_taxes`, we should only remove them from the `self.tag_ids` set without unlinking them (unlink them at this step, might lead to issues if these tags are still linked to `account.move.line` for example). As stated in https://github.com/odoo/odoo/blob/7444857b631e4c26ac1f13e6c29dfaa6b4c66359/odoo/models.py#L3549-L3555 we use the command `3` instead of `2` to achieve this. upg-61375 closes odoo/odoo#71969 X-original-commit: 6a85debb540bf9281b10f8a95be1ff0b4491eabc Signed-off-by: oco-odoo --- addons/account/models/account_tax_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_tax_report.py b/addons/account/models/account_tax_report.py index 99e7775e936..98e8fb29f81 100644 --- a/addons/account/models/account_tax_report.py +++ b/addons/account/models/account_tax_report.py @@ -254,7 +254,7 @@ class AccountTaxReportLine(models.Model): """ all_tags = self.mapped('tag_ids') tags_to_unlink = all_tags.filtered(lambda x: not (x.tax_report_line_ids - self)) - self.write({'tag_ids': [(2, tag.id, 0) for tag in tags_to_unlink]}) + self.write({'tag_ids': [(3, tag.id, 0) for tag in tags_to_unlink]}) self._delete_tags_from_taxes(tags_to_unlink.ids) @api.model