From 50a6f50df1b46ffb160e9244b4c3a3d2efdf5b36 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 2 Nov 2017 13:22:46 +0100 Subject: [PATCH] [FIX] mrp: production chained to a done or cancelled move Do not try to run `action_assign` on the next move if it is done or cancelled. The issue is that `action_assign` will first unlink the existing pack operations before creating new ones, and the system forbids to unlink these ones. To reproduce this issue: 1. Create a product, routes manufacturing and MTO 2. Create SO with that product 3. Go to DO and force assign then cancel the delivery 4. Go to Manufacturing order created and produce opw 778897 --- 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 dba5d5cd0d3..b53685eb9fc 100644 --- a/addons/mrp/models/stock_move.py +++ b/addons/mrp/models/stock_move.py @@ -293,7 +293,7 @@ class StockMove(models.Model): self.env['stock.quant'].quants_move(quants, move, move.location_dest_id, lot_id = movelot.lot_id.id) moves_to_unreserve |= move # Next move in production order - if move.move_dest_id: + if move.move_dest_id and move.move_dest_id.state not in ('done', 'cancel'): move.move_dest_id.action_assign() moves_to_unreserve.quants_unreserve() moves_todo.write({'state': 'done', 'date': fields.Datetime.now()})