From cb609bd4258fd3e7b4f4caff4828ed947833f995 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 3 Feb 2016 02:25:09 +0100 Subject: [PATCH 1/3] [FIX] tools.misc: log errors when parsing fails --- openerp/tools/misc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index 90b89eeb99a..3d47e6f2e71 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -1094,11 +1094,15 @@ def stripped_sys_argv(*strip_args): class Pickle(object): @classmethod - def load(cls, stream): + def load(cls, stream, errors=False): unpickler = cPickle.Unpickler(stream) # pickle builtins: str/unicode, int/long, float, bool, tuple, list, dict, None unpickler.find_global = None - return unpickler.load() + try: + return unpickler.load() + except Exception: + _logger.warning('Failed unpickling data, returning default: %r', errors, exc_info=True) + return errors @classmethod def loads(cls, text): From d01ecb6e7989cd239b81f932fe8b32487e6297be Mon Sep 17 00:00:00 2001 From: bima Date: Wed, 3 Feb 2016 14:12:22 +0700 Subject: [PATCH 2/3] [FIX] stock: wrong variable used in _handle_renaming Could incorrectly rename the stock.location.path objects, and in case the route has push_ids but no pull_ids would crash the method entirely. closes #10747 --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f60e2ce6684..0562f2fe289 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -3620,7 +3620,7 @@ class stock_warehouse(osv.osv): for pull in route.pull_ids: pull_obj.write(cr, uid, pull.id, {'name': pull.name.replace(warehouse.name, name, 1)}, context=context) for push in route.push_ids: - push_obj.write(cr, uid, push.id, {'name': pull.name.replace(warehouse.name, name, 1)}, context=context) + push_obj.write(cr, uid, push.id, {'name': push.name.replace(warehouse.name, name, 1)}, context=context) #change the mto pull rule name if warehouse.mto_pull_id.id: pull_obj.write(cr, uid, warehouse.mto_pull_id.id, {'name': warehouse.mto_pull_id.name.replace(warehouse.name, name, 1)}, context=context) From aca28c82b4441db8830fb215a1250b54985bf886 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 2 Feb 2016 14:49:19 +0100 Subject: [PATCH 3/3] [FIX] website_sale: do not compute price of every pricelist This controller was very slow as not providing a pricelist computed the price of all products of all pricelists. Instead only fetch the prices for the useful products. --- addons/website_sale/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 81a4743eb3f..c9ceabb568e 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -972,7 +972,7 @@ class website_sale(http.Controller): pricelist_id = request.session.get('sale_order_code_pricelist_id') or partner.property_product_pricelist.id else: pricelist_id = partner.property_product_pricelist.id - prices = pool['product.pricelist'].price_rule_get_multi(cr, uid, [], [(product, add_qty, partner) for product in products], context=context) + prices = pool['product.pricelist'].price_rule_get_multi(cr, uid, [pricelist_id], [(product, add_qty, partner) for product in products], context=context) return {product_id: prices[product_id][pricelist_id][0] for product_id in product_ids} # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: