From a5c614db575ca855caa4ed80b5d55d2744568087 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 5 May 2018 08:56:30 +0200 Subject: [PATCH] [IMP] account: name_search / name_get symetry on account.account That way, pressing down on a many2one already filled will not propose to create a new account: "20000 Sales Account" should name_search it. --- addons/account/models/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 60ea1163111..8923e6891df 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -168,7 +168,7 @@ class AccountAccount(models.Model): args = args or [] domain = [] if name: - domain = ['|', ('code', '=ilike', name + '%'), ('name', operator, name)] + domain = ['|', ('code', '=ilike', name.split(' ')[0] + '%'), ('name', operator, name)] if operator in expression.NEGATIVE_TERM_OPERATORS: domain = ['&', '!'] + domain[1:] accounts = self.search(domain + args, limit=limit)