From b1face1cb092f41f7a82531e177ff64f1b0d5d0b Mon Sep 17 00:00:00 2001 From: "Anup (OpenERP)" Date: Fri, 29 Apr 2011 17:54:01 +0530 Subject: [PATCH] [FIX] base : res_name misbehavior fixed when size limit of the value extended the field's size.(Courtsey JBA(OpenERP),(Support Case:5480)) lp bug: https://launchpad.net/bugs/772230 fixed bzr revid: ach@tinyerp.com-20110429122401-enfr7d349g1lgk82 --- bin/addons/base/ir/ir_attachment.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/addons/base/ir/ir_attachment.py b/bin/addons/base/ir/ir_attachment.py index 7fd9143b0fa..1d75cc39d0f 100644 --- a/bin/addons/base/ir/ir_attachment.py +++ b/bin/addons/base/ir/ir_attachment.py @@ -121,7 +121,7 @@ class ir_attachment(osv.osv): return self.pool.get('ir.actions.act_window').for_xml_id( cr, uid, 'base', 'action_attachment', context=context) - def _name_get_resname(self, cr, uid, ids, object,method, context): + def _name_get_resname(self, cr, uid, ids, object, method, context): data = {} for attachment in self.browse(cr, uid, ids, context=context): model_object = attachment.res_model @@ -129,7 +129,12 @@ class ir_attachment(osv.osv): if model_object and res_id: model_pool = self.pool.get(model_object) res = model_pool.name_get(cr,uid,[res_id],context) - data[attachment.id] = (res and res[0][1]) or False + res_name = res and res[0][1] or False + if res_name: + field = self._columns.get('res_name') + if len(res_name )>field.size: + res_name = res_name[:field.size-3] + '...' + data[attachment.id] = res_name else: data[attachment.id] = False return data