From 9041add81d4addbed1f8cbeb9f0cb815dbc457f6 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 22 Feb 2012 10:53:42 +0100 Subject: [PATCH] [FIX] mail: Use a default value if the signature and the subject are empty bzr revid: stw@openerp.com-20120222095342-nifzjg0ilgd3ln0p --- addons/mail/mail_message.py | 2 +- addons/mail/wizard/mail_compose_message.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 1693397f6fa..c103926bdac 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -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 diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 27ec13b2147..779976c4904 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -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)