openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #06337
[Merge] lp:~openerp-dev/openobject-server/trunk-bug-772230-nch into lp:openobject-server
Naresh(OpenERP) has proposed merging lp:~openerp-dev/openobject-server/trunk-bug-772230-nch into lp:openobject-server.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #772230 in OpenERP Server: "ir.attachment res_name : function _name_get_resname exceeds size limit"
https://bugs.launchpad.net/openobject-server/+bug/772230
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-772230-nch/+merge/59896
--
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-bug-772230-nch/+merge/59896
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-server/trunk-bug-772230-nch.
=== modified file 'openerp/addons/base/ir/ir_attachment.py'
--- openerp/addons/base/ir/ir_attachment.py 2011-02-21 10:32:35 +0000
+++ openerp/addons/base/ir/ir_attachment.py 2011-05-04 10:32:30 +0000
@@ -121,7 +121,7 @@
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,9 +129,14 @@
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',False)
+ if field and len(res_name ) > field.size:
+ res_name = res_name[:field.size-3] + '...'
+ data[attachment.id] = res_name
else:
- data[attachment.id] = False
+ data[attachment.id] = False
return data
_name = 'ir.attachment'
Follow ups