From 7b306fc17a9e8f3d33df809cbd39af38ab694552 Mon Sep 17 00:00:00 2001 From: Thomas Groutars Date: Mon, 18 May 2015 15:57:38 +0200 Subject: [PATCH] [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 --- addons/stock/wizard/stock_transfer_details.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_transfer_details.py b/addons/stock/wizard/stock_transfer_details.py index 17f302f6317..437509aacf3 100644 --- a/addons/stock/wizard/stock_transfer_details.py +++ b/addons/stock/wizard/stock_transfer_details.py @@ -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()