[FIX] name_search() where _rec_name is a reference field and links are broken

bzr revid: cto@openerp.com-20131211103842-i1n9t8mg9kuw77v3
This commit is contained in:
Cecile Tonglet 2013-12-11 11:38:42 +01:00
parent 9a4c62861f
commit a48c8119ca
1 changed files with 2 additions and 1 deletions

View File

@ -204,7 +204,8 @@ class reference(_column):
model_name, res_id = value.split(',')
model = obj.pool.get(model_name)
if model and res_id:
return model.name_get(cr, uid, [int(res_id)], context=context)[0][1]
names = model.name_get(cr, uid, [int(res_id)], context=context)
return names[0][1] if names else False
return tools.ustr(value)
# takes a string (encoded in utf8) and returns a string (encoded in utf8)