diff --git a/base_name_search_improved/__openerp__.py b/base_name_search_improved/__openerp__.py index 165d93e11..7573de5bc 100644 --- a/base_name_search_improved/__openerp__.py +++ b/base_name_search_improved/__openerp__.py @@ -4,7 +4,7 @@ { 'name': 'Improved Name Search', 'summary': 'Friendlier search when typing in relation fields', - 'version': '8.0.1.0.1', + 'version': '8.0.1.0.2', 'category': 'Uncategorized', 'website': 'https://odoo-community.org/', 'author': 'Daniel Reis, Odoo Community Association (OCA)', diff --git a/base_name_search_improved/models/ir_model.py b/base_name_search_improved/models/ir_model.py index 0e7ecccb2..f37a59224 100644 --- a/base_name_search_improved/models/ir_model.py +++ b/base_name_search_improved/models/ir_model.py @@ -23,9 +23,11 @@ def _get_rec_names(self): def _extend_name_results(self, domain, results, limit): 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])] - 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()) return results