[FIX] mail: Use a default value if the signature and the subject are empty

bzr revid: stw@openerp.com-20120222095342-nifzjg0ilgd3ln0p
This commit is contained in:
Stephane Wirtel 2012-02-22 10:53:42 +01:00
parent 9b0c341975
commit 9041add81d
2 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ class mail_message(osv.osv):
msg_txt += truncate_text(message.body_text)
else:
msg_txt = (message.user_id.name or '/') + _(' on ') + format_date_tz(message.date, tz) + ':\n\t'
msg_txt += message.subject
msg_txt += (message.subject or '')
result[message.id] = msg_txt
return result

View File

@ -147,13 +147,13 @@ class mail_compose_message(osv.osv_memory):
# as it is easier to quote than the HTML version.
# XXX TODO: make it possible to switch to HTML on the fly
current_user = self.pool.get('res.users').browse(cr, uid, uid, context)
body = message_data.body_text or current_user.signature
body = message_data.body_text or current_user.signature or ''
if context.get('mail.compose.message.mode') == 'reply':
sent_date = _('On %(date)s, ') % {'date': message_data.date} if message_data.date else ''
sender = _('%(sender_name)s wrote:') % {'sender_name': tools.ustr(message_data.email_from or _('You'))}
quoted_body = '> %s' % tools.ustr(body.replace('\n', "\n> ") or '')
body = '\n'.join(["\n", (sent_date + sender), quoted_body])
body += "\n" + current_user.signature
body += "\n" + (current_user.signature or '')
re_prefix = _("Re:")
if not (subject.startswith('Re:') or subject.startswith(re_prefix)):
subject = "%s %s" % (re_prefix, subject)