From 85132f68d2882b8c4cb506a7ba2ce4d43a241b63 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 5 Apr 2017 09:46:20 +0200 Subject: [PATCH] [FIX] mrp: warning for lot The constraint should only check for move lots with a lot number already filled in. Indeed, in case we use work orders, we can potentially create move lots without S/N, and fill in the S/N later. opw-727679 --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 5cb92a5025c..2017b5d9490 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -33,7 +33,7 @@ class StockMoveLots(models.Model): def _check_lot_id(self): if self.move_id.product_id.tracking == 'serial': lots = set([]) - for move_lot in self.move_id.move_lot_ids.filtered(lambda r: not r.lot_produced_id): + for move_lot in self.move_id.move_lot_ids.filtered(lambda r: not r.lot_produced_id and r.lot_id): if move_lot.lot_id in lots: raise exceptions.UserError(_('You cannot use the same serial number in two different lines.')) if float_compare(move_lot.quantity_done, 1.0, precision_rounding=move_lot.product_id.uom_id.rounding) == 1: