diff --git a/account_asset_management/models/account_move.py b/account_asset_management/models/account_move.py index 43940779637e..6452c55dc658 100644 --- a/account_asset_management/models/account_move.py +++ b/account_asset_management/models/account_move.py @@ -43,8 +43,12 @@ def _compute_asset_count(self): 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(