From 5265a9eeb2ec7cdf86a378226d8430a6e5bd0192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lionel=20Sausin=20=28Num=C3=A9rigraphe=29?= Date: Fri, 5 Dec 2014 17:25:35 +0100 Subject: [PATCH] [REF] changes suggested by @guewen Set a keyword argument on the context to better respect the convention. Allow the context to contain iterable types supported by the ORM. Cherry-picked from v7 at 9ab7f78a7f869b4aec06190ffd2c1a4ab2795e14 Conflicts: stock_available/product.py stock_available_immediately/product.py --- __unported__/stock_available_mrp/product.py | 4 +++- __unported__/stock_available_sale/product.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/__unported__/stock_available_mrp/product.py b/__unported__/stock_available_mrp/product.py index 4d5cd2f6f..f36b86a5c 100644 --- a/__unported__/stock_available_mrp/product.py +++ b/__unported__/stock_available_mrp/product.py @@ -73,10 +73,12 @@ class product_product(orm.Model): return res def _compute_potential_qty_from_bom(self, cr, uid, bom_id, to_uom, - context): + context=None): """Compute the potential qty from BoMs with components available""" bom_obj = self.pool['mrp.bom'] uom_obj = self.pool['product.uom'] + if context is None: + context = {} if 'uom' in context: context_wo_uom = context.copy() del context_wo_uom['uom'] diff --git a/__unported__/stock_available_sale/product.py b/__unported__/stock_available_sale/product.py index 512c41eac..ada61ed22 100644 --- a/__unported__/stock_available_sale/product.py +++ b/__unported__/stock_available_sale/product.py @@ -134,7 +134,7 @@ class ProductProduct(orm.Model): # location if context.get('location', False): # Either a single or multiple locations can be in the context - if not isinstance(context['location'], list): + if isinstance(context['location'], (int, long)): location_ids = [context['location']] else: location_ids = context['location']