[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 <oco-odoo@users.noreply.github.com>
This commit is contained in:
Rémy Baranx (bar)
2021-06-10 11:27:25 +00:00
parent 5beeff02be
commit c299aaed1d
+1 -1
View File
@@ -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