[MERGE] fix limit=None name_search on products

bzr revid: fp@tinyerp.com-20121113080350-j3n5bc9rw4ocabs1
This commit is contained in:
Fabien Pinckaers 2012-11-13 09:03:50 +01:00
commit e4b64624e4
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 and (limit-len(ids)) or False) , context=context))
ids = list(ids)
if not ids:
ptrn = re.compile('(\[(.*?)\])')