[FIX] mass_mailing: various fixes
authorThibault Delavallée <tde@openerp.com>
Wed, 18 Jun 2014 07:56:49 +0000 (09:56 +0200)
committerThibault Delavallée <tde@openerp.com>
Wed, 18 Jun 2014 09:10:31 +0000 (11:10 +0200)
addons/mail/wizard/mail_compose_message.py
addons/mass_mailing/models/mail_mail.py
addons/mass_mailing/views/mass_mailing.xml

index cb068d5..e14a8f3 100644 (file)
@@ -267,10 +267,7 @@ class mail_compose_message(osv.TransientModel):
             # mass mailing: rendering override wizard static values
             if mass_mail_mode and wizard.model:
                 # always keep a copy, reset record name (avoid browsing records)
-                mail_values.update(notification=True, record_name=False)
-                if hasattr(self.pool[wizard.model], 'message_new'):
-                    mail_values['model'] = wizard.model
-                    mail_values['res_id'] = res_id
+                mail_values.update(notification=True, model=wizard.model, res_id=res_id, record_name=False)
                 # auto deletion of mail_mail
                 if 'mail_auto_delete' in context:
                     mail_values['auto_delete'] = context.get('mail_auto_delete')
index a67f88a..0e44399 100644 (file)
@@ -84,7 +84,8 @@ class MailMail(osv.Model):
     def send_get_email_dict(self, cr, uid, mail, partner=None, context=None):
         res = super(MailMail, self).send_get_email_dict(cr, uid, mail, partner, context=context)
         if mail.mailing_id and res.get('body') and res.get('email_to'):
-            email_to = tools.email_split(res.get('email_to')[0])
+            emails = tools.email_split(res.get('email_to')[0])
+            email_to = emails and emails[0] or False
             unsubscribe_url = self._get_unsubscribe_url(cr, uid, mail, email_to, context=context)
             if unsubscribe_url:
                 res['body'] = tools.append_content_to_html(res['body'], unsubscribe_url, plaintext=False, container_tag='p')
index c7b6eb6..8771a10 100644 (file)
                     <field name="mail_mail_id"/>
                     <field name="message_id"/>
                     <field name="sent"/>
+                    <field name="exception"/>
                     <field name="opened"/>
                     <field name="replied"/>
                     <field name="bounced"/>