[FIX] mrp: missing move reference

A manufacturing order creates its raw move in an onchange when saving the form
view. As the MO has no name at this stage, the raw moves reference stay 'New'
even when marked as done
This commit change the moves reference once the MO is confirmed
This commit is contained in:
William Henrotin
2019-02-28 14:32:06 +00:00
parent f3f9dd8cd7
commit a5342daf9d
+2 -1
View File
@@ -605,7 +605,8 @@ class MrpProduction(models.Model):
for move_raw in production.move_raw_ids:
move_raw.write({
'group_id': production.procurement_group_id.id,
'unit_factor': move_raw.product_uom_qty / production.product_qty
'unit_factor': move_raw.product_uom_qty / production.product_qty,
'reference': self.name, # set reference when MO name is different than 'New'
})
production._generate_finished_moves()
production.move_raw_ids._adjust_procure_method()