[IMP] stock: improve detailed transfer performance

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
This commit is contained in:
Thomas Groutars 2015-05-18 15:57:38 +02:00 committed by Denis Ledoux
parent 453b373a68
commit 7b306fc17a
1 changed files with 2 additions and 3 deletions

View File

@ -91,7 +91,7 @@ class stock_transfer_details(models.TransientModel):
'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
@ -99,8 +99,7 @@ class stock_transfer_details(models.TransientModel):
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()