diff options
| author | William Henrotin <whe@odoo.com> | 2020-03-26 08:54:35 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2020-03-30 07:42:38 +0000 |
| commit | 5569768ec2473cd2aa378d5f9d55c20c10fd2507 (patch) | |
| tree | f475618df88475caaa25e7ddefea3ce89c0581e4 /addons | |
| parent | bdd1dfd376c44f757660ccb8b7eb6531a513738a (diff) | |
[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>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/mrp/models/mrp_bom.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index 7c973e642d1..b10a5757651 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -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: |
