From 75460e697a20505aa22b3a273d3056e0bdc75633 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Wed, 14 Aug 2019 13:56:31 +0000 Subject: [PATCH] [FIX] mrp: block partial post inventory of MO with workorders and tracking Enable work orders, routings, and track components by lot numbers or serial. Create an MO for a certain X quantity of finished products and plan work orders. Only complete a partial amount Y of the overall X amount. Specify the lots for the consumed tracked materials equal to the Y amount. Then, return to the MO and click "Post Inventory". An error is raised because the lot is missing. This is because when processing workorders temporary lines are created without lot/serial for tracked component products. This is a limitation that require a task to be removed; in the meantime we remove the button, in true bugfix fashion. opw 2049806 closes odoo/odoo#35731 Signed-off-by: Nans Lefebvre (len) --- addons/mrp/models/mrp_production.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 693cfca5b16..608742a4103 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -277,6 +277,7 @@ class MrpProduction(models.Model): order.post_visible = order.is_locked and any((x.quantity_done > 0 and x.state not in ['done', 'cancel']) for x in order.move_raw_ids | order.move_finished_ids) else: order.post_visible = order.is_locked and any((x.quantity_done > 0 and x.state not in ['done', 'cancel']) for x in order.move_finished_ids) + order.post_visible &= all(wo.state in ['done', 'cancel'] for wo in order.workorder_ids) or all(m.product_id.tracking == 'none' for m in order.move_raw_ids) @api.multi @api.depends('move_raw_ids.quantity_done', 'move_raw_ids.product_uom_qty')