From 49c3f643696ad0e0634755d10064d229a01bec2c Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 17 Nov 2017 11:10:28 +0100 Subject: [PATCH] [FIX] mrp: workorder: use the reserved move lines Rev [1] was intended to be applied when changing the lot of the produced product on the manufacturing order, somewhere along the line the code was also called when setting the lot_id on the work order. When used in this context, it broke the reconciliation between the reserved move lines and the temporary move lines because a lot_produced_id was wrongly set. We fix the issue by only applying the code on prod move. This is done by checking if the move is a production one through the stock move, because there we are able to differenciate the raw material and production move, not on the move line where production_id is always set. [1] 471115b06ad4a8774a147267e4cfa845f3d1218b Fixes #20964 --- addons/mrp/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/stock_move.py b/addons/mrp/models/stock_move.py index 670ba288165..d97bfdb9310 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -33,7 +33,7 @@ class StockMoveLine(models.Model): @api.multi def write(self, vals): for move_line in self: - if move_line.production_id and 'lot_id' in vals: + if move_line.move_id.production_id and 'lot_id' in vals: move_line.production_id.move_raw_ids.mapped('move_line_ids')\ .filtered(lambda r: r.done_wo and not r.done_move and r.lot_produced_id == move_line.lot_id)\ .write({'lot_produced_id': vals['lot_id']})