[FIX] stock: stock.quant's contraint
Quants should not be create for consumable and services. Adapt the constraint.
This commit is contained in:
committed by
Simon Lejeune
parent
56f06f8b01
commit
a665cab858
@@ -50,8 +50,8 @@ class StockQuant(models.Model):
|
||||
@api.multi
|
||||
@api.constrains('product_id')
|
||||
def check_product_id(self):
|
||||
if any(elem.product_id.type == 'consu' for elem in self):
|
||||
raise ValidationError(_('Quants cannot be created for consumables.'))
|
||||
if any(elem.product_id.type != 'product' for elem in self):
|
||||
raise ValidationError(_('Quants cannot be created for consumables or services.'))
|
||||
|
||||
@api.multi
|
||||
@api.constrains('quantity')
|
||||
|
||||
Reference in New Issue
Block a user