[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) <len@odoo.com>
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user