[FIX] repair: warning if negative quantity

Before this commit, you can start a repair order with negative value
into its operations (who will cause a dead end when user will try to end
it). So, now a check is done when user tries to start it.

closes odoo/odoo#37045

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
svs-odoo
2019-09-18 08:06:05 +00:00
parent dd45b5123d
commit 75fa619f7c
+2
View File
@@ -199,6 +199,8 @@ class Repair(models.Model):
def action_validate(self):
self.ensure_one()
if self.filtered(lambda repair: any(op.product_uom_qty < 0 for op in repair.operations)):
raise UserError(_("You can not enter negative quantities."))
if self.product_id.type == 'consu':
return self.action_repair_confirm()
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')