[Merge] Merged Anup's branch for the fix of ir_attachment should behave properly...
authorJay Vora (OpenERP) <jvo@tinyerp.com>
Mon, 2 May 2011 11:57:10 +0000 (17:27 +0530)
committerJay Vora (OpenERP) <jvo@tinyerp.com>
Mon, 2 May 2011 11:57:10 +0000 (17:27 +0530)
bzr revid: jvo@tinyerp.com-20110502115710-u6z8ql6bqk0hfj1i

1  2 
bin/addons/base/ir/ir_attachment.py

@@@ -129,9 -129,14 +129,14 @@@ 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',False)
 -                    if field and len(res_name ) > field.size:
++                    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'