From 4cfcc36d0e241b2b608453b290ec575444724c60 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Fri, 13 Dec 2019 13:33:41 +0000 Subject: [PATCH] [MOV] mrp: check finished lot in mrp module Consuming product tracked by lot (or serial number ) to produce product also tracked must ensure the link between the two lots (consumed and produced) is always set. This test is not done in community version while there is one in the enterprise conterpart (mrp_workorder module). This commit move this test to the mrp module to have it everywhere Task : 2121714 --- addons/mrp/models/mrp_workorder.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 6bf6319d8d4..e410190663e 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -457,6 +457,8 @@ class MrpWorkorder(models.Model): self._check_company() if float_compare(self.qty_producing, 0, precision_rounding=self.product_uom_id.rounding) <= 0: raise UserError(_('Please set the quantity you are currently producing. It should be different from zero.')) + if self.production_id.product_id.tracking != 'none' and not self.finished_lot_id and self.move_raw_ids: + raise UserError(_('You should provide a lot for the final product')) if 'check_ids' not in self: for line in self.raw_workorder_line_ids | self.finished_workorder_line_ids: line._check_line_sn_uniqueness()