Odoo18-Base/addons/mrp/models/stock_quant.py
2025-01-06 10:57:38 +07:00

12 lines
388 B
Python

from odoo import models, api, _
from odoo.exceptions import UserError
class StockQuant(models.Model):
_inherit = 'stock.quant'
@api.constrains('product_id')
def _check_kits(self):
if self.sudo().product_id.filtered("is_kits"):
raise UserError(_('You should update the components quantity instead of directly updating the quantity of the kit product.'))