summaryrefslogtreecommitdiff
path: root/addons/stock/models/stock_move.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/stock/models/stock_move.py')
-rw-r--r--addons/stock/models/stock_move.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py
index 03f8254e685..a01e7f3967d 100644
--- a/addons/stock/models/stock_move.py
+++ b/addons/stock/models/stock_move.py
@@ -552,7 +552,9 @@ class StockMove(models.Model):
# Handle the write on the initial demand by updating the reserved quantity and logging
# messages according to the state of the stock.move records.
receipt_moves_to_reassign = self.env['stock.move']
+ move_to_recompute_state = self.env['stock.move']
if 'product_uom_qty' in vals:
+ move_to_unreserve = self.env['stock.move']
for move in self.filtered(lambda m: m.state not in ('done', 'draft') and m.picking_id):
if float_compare(vals['product_uom_qty'], move.product_uom_qty, precision_rounding=move.product_uom.rounding):
self.env['stock.move.line']._log_message(move.picking_id, move, 'stock.track_move_template', vals)
@@ -565,9 +567,12 @@ class StockMove(models.Model):
# When editing the initial demand, directly run again action assign on receipt moves.
receipt_moves_to_reassign |= move_to_unreserve.filtered(lambda m: m.location_id.usage == 'supplier')
receipt_moves_to_reassign |= (self - move_to_unreserve).filtered(lambda m: m.location_id.usage == 'supplier' and m.state in ('partially_available', 'assigned'))
+ move_to_recompute_state |= self - move_to_unreserve - receipt_moves_to_reassign
if 'date_deadline' in vals:
self._set_date_deadline(vals.get('date_deadline'))
res = super(StockMove, self).write(vals)
+ if move_to_recompute_state:
+ move_to_recompute_state._recompute_state()
if receipt_moves_to_reassign:
receipt_moves_to_reassign._action_assign()
return res