[FIX] mail: Use a default value if the signature and the subject are empty
authorStephane Wirtel <stw@openerp.com>
Wed, 22 Feb 2012 09:53:42 +0000 (10:53 +0100)
committerStephane Wirtel <stw@openerp.com>
Wed, 22 Feb 2012 09:53:42 +0000 (10:53 +0100)
bzr revid: stw@openerp.com-20120222095342-nifzjg0ilgd3ln0p

addons/mail/mail_message.py
addons/mail/wizard/mail_compose_message.py

index 1693397..c103926 100644 (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
 
index 27ec13b..779976c 100644 (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)