From ebb826a510382ac60299d5d39752267f8c54da01 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 7 Apr 2014 10:24:45 +0200 Subject: [PATCH] [FIX] web: applying display name temporary imp of read to search_read also bzr revid: dle@openerp.com-20140407082445-yjy17jnrw45d8mxg --- addons/web/controllers/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index b771f1f378e..84fd1ae93be 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1206,11 +1206,14 @@ class DataSet(http.Controller): def _call_kw(self, model, method, args, kwargs): # Temporary implements future display_name special field for model#read() - if method == 'read' and kwargs.get('context', {}).get('future_display_name'): + if method in ('read', 'search_read') and kwargs.get('context', {}).get('future_display_name'): if 'display_name' in args[1]: - names = dict(request.session.model(model).name_get(args[0], **kwargs)) + if method == 'read': + names = dict(request.session.model(model).name_get(args[0], **kwargs)) + else: + names = dict(request.session.model(model).name_search(args=args[0], **kwargs)) args[1].remove('display_name') - records = request.session.model(model).read(*args, **kwargs) + records = getattr(request.session.model(model), method)(*args, **kwargs) for record in records: record['display_name'] = \ names.get(record['id']) or "%s#%d" % (model, (record['id']))