From a7c7e331315b849e7c024e255977ff5a9fdca2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 4 Feb 2014 17:59:49 +0100 Subject: [PATCH] [FIX] mass_mailing: fixed variables used outside of their scope bzr revid: tde@openerp.com-20140204165949-9xax1pul22ktsf41 --- addons/mass_mailing/mail_thread.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mass_mailing/mail_thread.py b/addons/mass_mailing/mail_thread.py index 0570596ba12..a4ff15a1a3f 100644 --- a/addons/mass_mailing/mail_thread.py +++ b/addons/mass_mailing/mail_thread.py @@ -48,6 +48,7 @@ class MailThread(osv.Model): if bounce_alias in email_to: bounce_match = tools.bounce_re.search(email_to) if bounce_match: + bounced_model, bounced_thread_id = None, False bounced_mail_id = bounce_match.group(1) stat_ids = self.pool['mail.mail.statistics'].set_bounced(cr, uid, mail_mail_ids=[bounced_mail_id], context=context) for stat in self.pool['mail.mail.statistics'].browse(cr, uid, stat_ids, context=context): @@ -55,7 +56,7 @@ class MailThread(osv.Model): bounced_thread_id = stat.res_id _logger.info('Routing mail from %s to %s with Message-Id %s: bounced mail from mail %s, model: %s, thread_id: %s', email_from, email_to, message_id, bounced_mail_id, bounced_model, bounced_thread_id) - if bounced_model and bounced_model in self.pool and hasattr(self.pool[bounced_model], 'message_receive_bounce'): + if bounced_model and bounced_model in self.pool and hasattr(self.pool[bounced_model], 'message_receive_bounce') and bounced_thread_id: self.pool[bounced_model].message_receive_bounce(cr, uid, [bounced_thread_id], mail_id=bounced_mail_id, context=context) return False