diff --git a/addons/mrp/models/stock_quant.py b/addons/mrp/models/stock_quant.py index 5f71f002db2..7a967e63e3d 100644 --- a/addons/mrp/models/stock_quant.py +++ b/addons/mrp/models/stock_quant.py @@ -6,12 +6,10 @@ class StockQuant(models.Model): _inherit = 'stock.quant' def action_apply_inventory(self): - bom_kits = self.env['mrp.bom']._bom_find(self.product_id, bom_type='phantom') - for record in self: - if record.product_id in bom_kits: - raise RedirectWarning( - _('You should update the components quantity instead of directly updating the quantity of the kit product.'), - self.env.ref('stock.action_view_inventory_tree').id, - _("Return to Inventory"), - ) + if self.sudo().product_id.filtered("is_kits"): + raise RedirectWarning( + _('You should update the components quantity instead of directly updating the quantity of the kit product.'), + self.env.ref('stock.action_view_inventory_tree').id, + _("Return to Inventory"), + ) return super().action_apply_inventory()