From d20eda9942e1471f4741688dfacdea14a6312163 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/__openerp__.py | 2 +- mail_tracking_mailgun/models/res_partner.py | 3 +-- mail_tracking_mailgun/tests/test_mailgun.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mail_tracking_mailgun/__openerp__.py b/mail_tracking_mailgun/__openerp__.py index 12f3e5d3..4e5df5aa 100644 --- a/mail_tracking_mailgun/__openerp__.py +++ b/mail_tracking_mailgun/__openerp__.py @@ -7,7 +7,7 @@ { "name": "Mail tracking for Mailgun", "summary": "Mail tracking and Mailgun webhooks integration", - "version": "9.0.1.2.0", + "version": "9.0.1.2.1", "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 1d138e9a..e08c74dc 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 4201c9fe..c47c049c 100644 --- a/mail_tracking_mailgun/tests/test_mailgun.py +++ b/mail_tracking_mailgun/tests/test_mailgun.py @@ -384,7 +384,7 @@ class TestMailgun(TransactionCase): self.partner._email_bounced_set('test_error', self.event) 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') self.assertEqual(len(self.partner.message_ids), message_number) @mock.patch(_packagepath + '.models.mail_tracking_email.requests')