[FIX] mrp: create a bom with positive quantity

Creation of production order from a bom with 0 quantity to produce will
fail. As there is already a constraint on the quantity to produce on MO,
this commit adds the same constraint on BoM.

closes odoo/odoo#48485

X-original-commit: 1330500885ae096372ab32fba4ffc9db252dd2d4
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
William Henrotin
2020-03-30 07:42:38 +00:00
parent bdd1dfd376
commit 5569768ec2
+4
View File
@@ -74,6 +74,10 @@ class MrpBom(models.Model):
required=True
)
_sql_constraints = [
('qty_positive', 'check (product_qty > 0)', 'The quantity to produce must be positive!'),
]
@api.onchange('product_id')
def onchange_product_id(self):
if self.product_id: