Merge PR #1911 into 17.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-07-03 14:27:23 +00:00

View File

@@ -44,8 +44,12 @@ class AccountMove(models.Model):
def unlink(self):
# for move in self:
deprs = self.env["account.asset.line"].search(
[("move_id", "in", self.ids), ("type", "in", ["depreciate", "remove"])]
deprs = (
self.env["account.asset.line"]
.sudo()
.search(
[("move_id", "in", self.ids), ("type", "in", ["depreciate", "remove"])]
)
)
if deprs and not self.env.context.get("unlink_from_asset"):
raise UserError(