From e519b2b9dc956c1a076714eca038a50e58d15549 Mon Sep 17 00:00:00 2001 From: "Somesh Khare(OpenERP)" <> Date: Fri, 2 Nov 2012 14:10:04 +0530 Subject: [PATCH] [FIX]product: when you search the product the limit into the name_search() goes None bzr revid: mma@tinyerp.com-20121102084004-af7m8wlov3w627ei --- addons/product/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 6c6c5f2650c..99c36611e9c 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -657,9 +657,9 @@ class product_product(osv.osv): # Performing a quick memory merge of ids in Python will give much better performance ids = set() ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context)) - if len(ids) < limit: + if not limit or len(ids) < limit: # we may underrun the limit because of dupes in the results, that's fine - ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids)), context=context)) + ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids) if limit else limit) , context=context)) ids = list(ids) if not ids: ptrn = re.compile('(\[(.*?)\])')