Odoo18-Base/addons/mrp/models/stock_quant.py
2025-03-10 11:12:23 +07:00

16 lines
562 B
Python

from odoo import models, _
from odoo.exceptions import RedirectWarning
class StockQuant(models.Model):
_inherit = 'stock.quant'
def action_apply_inventory(self):
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()