[FIX] mrp: fix bad workorder-move link

Workorder _action_confirm works in batch and is designed to
link workorders and moves per production.

Original code breaks the 'per production' constraint by linking
moves from all productions to workorders of the last one when
called on workorders from multiple productions.

closes odoo/odoo#86698

Task: 2797201
X-original-commit: b25f1e005987641a208de30162808005ad6e705a
Signed-off-by: Arnold Moyaux <arm@odoo.com>
This commit is contained in:
JF Aubert
2022-03-21 10:15:13 +01:00
parent 79a8e4fe8f
commit e85e8568b1
+1 -1
View File
@@ -462,7 +462,7 @@ class MrpWorkorder(models.Model):
bom = self.env['mrp.bom']
moves = production.move_raw_ids | production.move_finished_ids
for workorder in self:
for workorder in workorders:
bom = workorder.operation_id.bom_id or workorder.production_id.bom_id
previous_workorder = workorders_by_bom[bom][-1:]
previous_workorder.next_work_order_id = workorder.id