[FIX] stock: in assign method, to force_assign moves should avoid duplicates courtesy of Wolfgang Taferner closes #8522

This commit is contained in:
Josse Colpaert 2015-10-16 10:23:41 +02:00
parent b00f0185a2
commit f102a8bc23
1 changed files with 4 additions and 4 deletions

View File

@ -2256,7 +2256,7 @@ class stock_move(osv.osv):
"""
context = context or {}
quant_obj = self.pool.get("stock.quant")
to_assign_moves = []
to_assign_moves = set()
main_domain = {}
todo_moves = []
operations = set()
@ -2264,12 +2264,12 @@ class stock_move(osv.osv):
if move.state not in ('confirmed', 'waiting', 'assigned'):
continue
if move.location_id.usage in ('supplier', 'inventory', 'production'):
to_assign_moves.append(move.id)
to_assign_moves.add(move.id)
#in case the move is returned, we want to try to find quants before forcing the assignment
if not move.origin_returned_move_id:
continue
if move.product_id.type == 'consu':
to_assign_moves.append(move.id)
to_assign_moves.add(move.id)
continue
else:
todo_moves.append(move)
@ -2315,7 +2315,7 @@ class stock_move(osv.osv):
#force assignation of consumable products and incoming from supplier/inventory/production
if to_assign_moves:
self.force_assign(cr, uid, to_assign_moves, context=context)
self.force_assign(cr, uid, list(to_assign_moves), context=context)
def action_cancel(self, cr, uid, ids, context=None):
""" Cancels the moves and if all moves are cancelled it cancels the picking.