From 7b17e234e690b1d8a9914f9a6c52e048605c09e2 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 20 Feb 2014 15:20:01 +0100 Subject: [PATCH] [REF] stock: some code optimization in do_prepare_partial (avoid computing 'move_list' for each 'x') bzr revid: qdp-launchpad@openerp.com-20140220142001-i81f7x2pgmhwqeda --- addons/stock/stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index b9053f1459f..be4bbadcdff 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -972,7 +972,8 @@ class stock_picking(osv.osv): test_pack = pack while loop: quants = pack_obj.get_content(cr, uid, [test_pack.id], context=context) - if all([(x.reservation_id and x.reservation_id.id in [x.id for x in picking.move_lines] or False) for x in quant_obj.browse(cr, uid, quants, context=context)]): + move_list = [m.id for m in picking.move_lines] + if all([(x.reservation_id and x.reservation_id.id in move_list or False) for x in quant_obj.browse(cr, uid, quants, context=context)]): good_pack = test_pack.id if test_pack.parent_id: test_pack = test_pack.parent_id