[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`.
This commit is contained in:
Nicolas Martinelli
2018-04-12 13:55:10 +02:00
committed by Nicolas Martinelli
parent dc5dfa0430
commit 9353fa1ede
+1 -1
View File
@@ -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}