Reputation: 179
I inherited model stock.picking. And i want to create Validation on adding value to quantity receive(qty_done fields) and compare it to quantity order(product_qty fields) and both fields are from stock.picking model. Any help? thanks
from odoo import fields, models, api
from odoo.exceptions import ValidationError
class StockPickingInherited(models.Model):
_inherit = 'stock.picking'
@api.constrains('product_qty', 'qty_done')
def _check_qty(self):
if self.product_qty < self.qty_done:
raise ValidationError ('Error')
is this correct? but nothing happens. Thanks
Upvotes: 1
Views: 279
Reputation: 320
Did you tried same class name which is given in the stock.picking model
class?
class StockPicking(models.Model):
Upvotes: 1