From 9353fa1edea5a140587cea873b1ab9ae1ed5228d Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 11 Apr 2018 14:59:06 +0200 Subject: [PATCH] [FIX] stock: trigger warning Do not trigger warning if `qty_done` is not yet set, since it is automatically set to 1.0 in `onchange_serial_number`. --- addons/stock/models/stock_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index bb93b1c224b..f914f8aa00f 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -141,7 +141,7 @@ class StockMoveLine(models.Model): help him. This onchange will warn him if he set `qty_done` to a non-supported value. """ res = {} - if self.product_id.tracking == 'serial': + if self.qty_done and self.product_id.tracking == 'serial': if float_compare(self.qty_done, 1.0, precision_rounding=self.move_id.product_id.uom_id.rounding) != 0: message = _('You can only process 1.0 %s for products with unique serial number.') % self.product_id.uom_id.name res['warning'] = {'title': _('Warning'), 'message': message}