[FIX] stock: in assign method, to force_assign moves should avoid duplicates courtesy of Wolfgang Taferner closes #8522
This commit is contained in:
parent
b00f0185a2
commit
f102a8bc23
|
@ -2256,7 +2256,7 @@ class stock_move(osv.osv):
|
||||||
"""
|
"""
|
||||||
context = context or {}
|
context = context or {}
|
||||||
quant_obj = self.pool.get("stock.quant")
|
quant_obj = self.pool.get("stock.quant")
|
||||||
to_assign_moves = []
|
to_assign_moves = set()
|
||||||
main_domain = {}
|
main_domain = {}
|
||||||
todo_moves = []
|
todo_moves = []
|
||||||
operations = set()
|
operations = set()
|
||||||
|
@ -2264,12 +2264,12 @@ class stock_move(osv.osv):
|
||||||
if move.state not in ('confirmed', 'waiting', 'assigned'):
|
if move.state not in ('confirmed', 'waiting', 'assigned'):
|
||||||
continue
|
continue
|
||||||
if move.location_id.usage in ('supplier', 'inventory', 'production'):
|
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
|
#in case the move is returned, we want to try to find quants before forcing the assignment
|
||||||
if not move.origin_returned_move_id:
|
if not move.origin_returned_move_id:
|
||||||
continue
|
continue
|
||||||
if move.product_id.type == 'consu':
|
if move.product_id.type == 'consu':
|
||||||
to_assign_moves.append(move.id)
|
to_assign_moves.add(move.id)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
todo_moves.append(move)
|
todo_moves.append(move)
|
||||||
|
@ -2315,7 +2315,7 @@ class stock_move(osv.osv):
|
||||||
|
|
||||||
#force assignation of consumable products and incoming from supplier/inventory/production
|
#force assignation of consumable products and incoming from supplier/inventory/production
|
||||||
if to_assign_moves:
|
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):
|
def action_cancel(self, cr, uid, ids, context=None):
|
||||||
""" Cancels the moves and if all moves are cancelled it cancels the picking.
|
""" Cancels the moves and if all moves are cancelled it cancels the picking.
|
||||||
|
|
Loading…
Reference in New Issue