[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
This commit is contained in:
Nicolas Martinelli
2017-04-05 09:47:54 +02:00
parent c6b4154fa6
commit 85132f68d2
+1 -1
View File
@@ -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: