Browse Source
[FIX] deal with limit=0/None correctly
pull/980/head
Holger Brunn
7 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
2 changed files with
5 additions and
3 deletions
-
base_name_search_improved/__openerp__.py
-
base_name_search_improved/models/ir_model.py
|
@ -4,7 +4,7 @@ |
|
|
{ |
|
|
{ |
|
|
'name': 'Improved Name Search', |
|
|
'name': 'Improved Name Search', |
|
|
'summary': 'Friendlier search when typing in relation fields', |
|
|
'summary': 'Friendlier search when typing in relation fields', |
|
|
'version': '8.0.1.0.1', |
|
|
|
|
|
|
|
|
'version': '8.0.1.0.2', |
|
|
'category': 'Uncategorized', |
|
|
'category': 'Uncategorized', |
|
|
'website': 'https://odoo-community.org/', |
|
|
'website': 'https://odoo-community.org/', |
|
|
'author': 'Daniel Reis, Odoo Community Association (OCA)', |
|
|
'author': 'Daniel Reis, Odoo Community Association (OCA)', |
|
|
|
@ -23,9 +23,11 @@ def _get_rec_names(self): |
|
|
|
|
|
|
|
|
def _extend_name_results(self, domain, results, limit): |
|
|
def _extend_name_results(self, domain, results, limit): |
|
|
result_count = len(results) |
|
|
result_count = len(results) |
|
|
if result_count < limit: |
|
|
|
|
|
|
|
|
if not limit or result_count < limit: |
|
|
domain += [('id', 'not in', [x[0] for x in results])] |
|
|
domain += [('id', 'not in', [x[0] for x in results])] |
|
|
recs = self.search(domain, limit=limit - result_count) |
|
|
|
|
|
|
|
|
recs = self.search( |
|
|
|
|
|
domain, limit=limit - result_count if limit else limit |
|
|
|
|
|
) |
|
|
results.extend(recs.name_get()) |
|
|
results.extend(recs.name_get()) |
|
|
return results |
|
|
return results |
|
|
|
|
|
|
|
|