[FIX]product: when you search the product the limit into the name_search() goes None

bzr revid: mma@tinyerp.com-20121102084004-af7m8wlov3w627ei
This commit is contained in:
Somesh Khare(OpenERP) 2012-11-02 14:10:04 +05:30 committed by Mayur Maheshwari (OpenERP)
parent ddb59425d0
commit e519b2b9dc
1 changed files with 2 additions and 2 deletions

View File

@ -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('(\[(.*?)\])')