diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index acc3d8e6523..fec3f0e6bc3 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -862,7 +862,7 @@ class ProductTemplate(models.Model): if 'uom_id' in vals: new_uom = self.env['uom.uom'].browse(vals['uom_id']) updated = self.filtered(lambda template: template.uom_id != new_uom) - done_moves = self.env['stock.move'].search([('product_id', 'in', updated.with_context(active_test=False).mapped('product_variant_ids').ids)], limit=1) + done_moves = self.env['stock.move'].sudo().search([('product_id', 'in', updated.with_context(active_test=False).mapped('product_variant_ids').ids)], limit=1) if done_moves: raise UserError(_("You cannot change the unit of measure as there are already stock moves for this product. If you want to change the unit of measure, you should rather archive this product and create a new one.")) if 'type' in vals and vals['type'] != 'product' and sum(self.mapped('nbr_reordering_rules')) != 0: