From 07e9a8ac54a9bf5262d86ac9b973e370590e6c1d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 1 Feb 2018 16:35:36 +0100 Subject: [PATCH] [FIX] mail_tracking_mailgun: Message error on bounce --- mail_tracking_mailgun/__manifest__.py | 2 +- mail_tracking_mailgun/models/res_partner.py | 3 +-- mail_tracking_mailgun/tests/test_mailgun.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mail_tracking_mailgun/__manifest__.py b/mail_tracking_mailgun/__manifest__.py index f271654..0ebb5b2 100644 --- a/mail_tracking_mailgun/__manifest__.py +++ b/mail_tracking_mailgun/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Mail tracking for Mailgun", "summary": "Mail tracking and Mailgun webhooks integration", - "version": "10.0.1.1.1", + "version": "10.0.1.1.2", "category": "Social Network", "website": "https://odoo-community.org/", "author": "Tecnativa, " diff --git a/mail_tracking_mailgun/models/res_partner.py b/mail_tracking_mailgun/models/res_partner.py index 9644e91..77f284e 100644 --- a/mail_tracking_mailgun/models/res_partner.py +++ b/mail_tracking_mailgun/models/res_partner.py @@ -30,8 +30,7 @@ class ResPartner(models.Model): body = _('Email has been bounced: %s\n' 'Reason: %s\n' 'Event: %s') % (partner.email, reason, - event and event.get('Message-Id', - _('unknown'))) + event and event.id or _('unknown')) partner.message_post(body=body) @api.multi diff --git a/mail_tracking_mailgun/tests/test_mailgun.py b/mail_tracking_mailgun/tests/test_mailgun.py index 4180a8d..d15888c 100644 --- a/mail_tracking_mailgun/tests/test_mailgun.py +++ b/mail_tracking_mailgun/tests/test_mailgun.py @@ -389,10 +389,10 @@ class TestMailgun(TransactionCase): def test_email_bounced_set(self): message_number = len(self.partner.message_ids) + 1 - self.partner._email_bounced_set('test_error', self.event) + self.partner._email_bounced_set('test_error', False) self.assertEqual(len(self.partner.message_ids), message_number) self.partner.email = "" - self.partner._email_bounced_set('test_error', self.event) + self.partner._email_bounced_set('test_error', False) self.assertEqual(len(self.partner.message_ids), message_number) @mock.patch(_packagepath + '.models.mail_tracking_email.requests')