Skip to content

Commit

Permalink
[IMP] stock: improve detailed transfer performance
Browse files Browse the repository at this point in the history
Transfers were slowed because of the continuous
computation of pickings remaining quantities.

This revision delay the computation at the end of the transfer,
so the computation is performed only once, and it
therefore leads to a huge performance improvment.

opw-634416
  • Loading branch information
Thomas Groutars authored and beledouxdenis committed May 20, 2015
1 parent 453b373 commit 7b306fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions addons/stock/wizard/stock_transfer_details.py
Expand Up @@ -91,16 +91,15 @@ def do_detailed_transfer(self):
'owner_id': prod.owner_id.id,
}
if prod.packop_id:
prod.packop_id.write(pack_datas)
prod.packop_id.with_context(no_recompute=True).write(pack_datas)
processed_ids.append(prod.packop_id.id)
else:
pack_datas['picking_id'] = self.picking_id.id
packop_id = self.env['stock.pack.operation'].create(pack_datas)
processed_ids.append(packop_id.id)
# Delete the others
packops = self.env['stock.pack.operation'].search(['&', ('picking_id', '=', self.picking_id.id), '!', ('id', 'in', processed_ids)])
for packop in packops:
packop.unlink()
packops.unlink()

# Execute the transfer of the picking
self.picking_id.do_transfer()
Expand Down

0 comments on commit 7b306fc

Please sign in to comment.