diff --git a/addons/loyalty/models/product_product.py b/addons/loyalty/models/product_product.py index 772291d1029..9193f258283 100644 --- a/addons/loyalty/models/product_product.py +++ b/addons/loyalty/models/product_product.py @@ -10,7 +10,7 @@ class ProductProduct(models.Model): def write(self, vals): if not vals.get('active', True) and any(product.active for product in self): # Prevent archiving products used for giving rewards - rewards = self.env['loyalty.reward'].search([('discount_line_product_id', 'in', self.ids)]) + rewards = self.env['loyalty.reward'].sudo().search([('discount_line_product_id', 'in', self.ids)], limit=1) if rewards: raise ValidationError(_("This product may not be archived. It is being used for an active promotion program.")) return super().write(vals)