[FIX] web: applying display name temporary imp of read to search_read also
bzr revid: dle@openerp.com-20140407082445-yjy17jnrw45d8mxg
This commit is contained in:
parent
f7ea5d00e1
commit
ebb826a510
|
@ -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']))
|
||||
|
|
Loading…
Reference in New Issue