From 115ae7f894d3bc319b590e136be95fbc18f537b0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 12 Jun 2019 13:47:33 +0000 Subject: [PATCH] [FIX] mrp: next WO lot - Set the products tracked by lot - Set 1 route with steps that allow to begin next one after a minimum amount processed. - Plan and begin the manufacturing process. - Process partially step 1, but fully step 2 - Finish step 1 The error 'You can not change the finished work order.' is raised. This is because we try to set the default final lot on a WO which is done. This is only used to suggest the right lot number, so we can safely skip the step if the WO is done or canceled. opw-2002044 closes odoo/odoo#34072 Signed-off-by: Nicolas Martinelli (nim) --- addons/mrp/models/mrp_workorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index b18881500f8..6323a42aeb3 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -402,7 +402,7 @@ class MrpWorkorder(models.Model): self.qty_producing = float_round(self.production_id.product_qty - self.qty_produced, precision_rounding=rounding) self._generate_lot_ids() - if self.next_work_order_id and self.production_id.product_id.tracking != 'none': + if self.next_work_order_id and self.next_work_order_id.state not in ['done', 'cancel'] and self.production_id.product_id.tracking != 'none': self.next_work_order_id._assign_default_final_lot_id() if float_compare(self.qty_produced, self.production_id.product_qty, precision_rounding=rounding) >= 0: