summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2017-11-02 13:22:46 +0100
committerSimon Lejeune <sle@openerp.com>2017-11-02 14:02:18 +0100
commit50a6f50df1b46ffb160e9244b4c3a3d2efdf5b36 (patch)
tree0a0617d8d11ae334de3240704aa89e953ce75a17
parente134dde867844b4eea6cfba9447968cb311a1d85 (diff)
[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
-rw-r--r--addons/mrp/models/stock_move.py2
1 files changed, 1 insertions, 1 deletions
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()})