[FIX]: mail_gateway: Removed unnecessary truncation of communication history message

lp bug: https://launchpad.net/bugs/628719 fixed

bzr revid: rpa@tinyerp.com-20100909114021-y7w72lhlr1sl13kl
This commit is contained in:
rpa (Open ERP) 2010-09-09 17:10:21 +05:30
parent 46c7d94735
commit 81cd29fff9
1 changed files with 13 additions and 2 deletions

View File

@ -176,6 +176,14 @@ class mailgate_message(osv.osv):
'''
Mailgateway Message
'''
def truncate_data(self, cr, uid, data, context=None):
data_list = data and data.split('\n') or []
if len(data_list) > 3:
res = '\n\t'.join(data_list[:3]) + '...'
else:
res = '\n\t'.join(data_list)
return res
def _get_display_text(self, cr, uid, ids, name, arg, context=None):
if context is None:
context = {}
@ -186,11 +194,14 @@ class mailgate_message(osv.osv):
if message.history:
msg_txt += (message.email_from or '/') + _(' wrote on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.description:
msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...'
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
else:
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
if message.name == _('Opportunity'):
msg_txt += _("Converted to Opportunity")
elif message.name == _('Note'):
msg_txt = (message.user_id.name or '/') + _(' added note on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt += self.truncate_data(cr, uid, message.description, context=context)
else:
msg_txt += _("Changed Status to: ") + message.name
result[message.id] = msg_txt