[FIX] stock: procurement set as done of sets bom.
In the case of sets, several stock moves can have the same procurement. Therefore, appending procurements in the list `procurement_ids` without checking if the procurement isn't already in the list could lead to having several times the same procurement in that list, and could therefore lead to the check of the same procurement over and over, leading to performances issues and the fact you cannot call `write` on a list having several times the same id. See models.py 3875 Using a set instead of a list solve this issue opw-634393
This commit is contained in:
parent
d377f5690e
commit
90cb409be9
|
@ -2340,7 +2340,7 @@ class stock_move(models.Model):
|
|||
if todo:
|
||||
ids = self.action_confirm(cr, uid, todo, context=context)
|
||||
pickings = set()
|
||||
procurement_ids = []
|
||||
procurement_ids = set()
|
||||
#Search operations that are linked to the moves
|
||||
operations = set()
|
||||
move_qty = {}
|
||||
|
@ -2404,7 +2404,7 @@ class stock_move(models.Model):
|
|||
move_dest_ids.add(move.move_dest_id.id)
|
||||
|
||||
if move.procurement_id:
|
||||
procurement_ids.append(move.procurement_id.id)
|
||||
procurement_ids.add(move.procurement_id.id)
|
||||
|
||||
#unreserve the quants and make them available for other operations/moves
|
||||
quant_obj.quants_unreserve(cr, uid, move, context=context)
|
||||
|
@ -2412,7 +2412,7 @@ class stock_move(models.Model):
|
|||
self._check_package_from_moves(cr, uid, ids, context=context)
|
||||
#set the move as done
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
|
||||
self.pool.get('procurement.order').check(cr, uid, procurement_ids, context=context)
|
||||
self.pool.get('procurement.order').check(cr, uid, list(procurement_ids), context=context)
|
||||
#assign destination moves
|
||||
if move_dest_ids:
|
||||
self.action_assign(cr, uid, list(move_dest_ids), context=context)
|
||||
|
|
Loading…
Reference in New Issue