From f102a8bc23a182b4bf2fd483c0fde4614ba2c48f Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 16 Oct 2015 10:23:41 +0200 Subject: [PATCH] [FIX] stock: in assign method, to force_assign moves should avoid duplicates courtesy of Wolfgang Taferner closes #8522 --- addons/stock/stock.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index dcc391ccc81..4324306c388 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -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.