From a48c8119ca44ad8e90756f2d86627ab0edf8bf67 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Wed, 11 Dec 2013 11:38:42 +0100 Subject: [PATCH] [FIX] name_search() where _rec_name is a reference field and links are broken bzr revid: cto@openerp.com-20131211103842-i1n9t8mg9kuw77v3 --- openerp/osv/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index da09fe0e27e..9921e3f762d 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -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)