[FIX] mail_tracking_mailgun: Message error on bounce

This commit is contained in:
Pedro M. Baeza 2018-02-01 16:35:36 +01:00 committed by nicolas
parent ed69644616
commit 07e9a8ac54
3 changed files with 4 additions and 5 deletions

View File

@ -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, "

View File

@ -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

View File

@ -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')