Skip to content
Snippets Groups Projects
Commit 0dd19580 authored by Debauche Stéphane's avatar Debauche Stéphane
Browse files

[FIX] mrp: propagate_date and planned orders with a routing

 `propagate_date` enables the automatic rescheduling which could lead to hard to
 understand behavior if a manufacturing order is planned, i.e. if the work orders do
 have their leaves booked in the workcenter calendar. We thus disable the
 automatic rescheduling in this scenario.

task-2154781
parent efa1d7f3
No related branches found
No related tags found
No related merge requests found
......@@ -704,6 +704,11 @@ class MrpProduction(models.Model):
orders_to_plan = self.filtered(lambda order: order.routing_id and order.state == 'confirmed')
for order in orders_to_plan:
order.move_raw_ids.filtered(lambda m: m.state == 'draft')._action_confirm()
# `propagate_date` enables the automatic rescheduling which could lead to hard to
# understand behavior if a manufacturing order is planned, i.e. if the work orders do
# have their leaves booked in the workcenter calendar. We thus disable the
# automatic rescheduling in this scenario.
order.move_raw_ids.write({'propagate_date': False})
quantity = order.product_uom_id._compute_quantity(order.product_qty, order.bom_id.product_uom_id) / order.bom_id.product_qty
boms, lines = order.bom_id.explode(order.product_id, quantity, picking_type=order.bom_id.picking_type_id)
order._generate_workorders(boms)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment