[FIX] stock: stock.quant's contraint

Quants should not be create for consumable and services. Adapt the
constraint.
This commit is contained in:
Fabien Pinckaers
2017-07-18 15:45:44 +02:00
committed by Simon Lejeune
parent 56f06f8b01
commit a665cab858
+2 -2
View File
@@ -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')