Browse Source

Merge pull request #272 from Tecnativa/9.0-fix-mail_tracking_mailgun-set_bounced

[FIX] mail_tracking_mailgun: Message error on bounce
pull/238/merge
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
b5c209d243
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      mail_tracking_mailgun/__openerp__.py
  2. 3
      mail_tracking_mailgun/models/res_partner.py
  3. 4
      mail_tracking_mailgun/tests/test_mailgun.py

2
mail_tracking_mailgun/__openerp__.py

@ -7,7 +7,7 @@
{ {
"name": "Mail tracking for Mailgun", "name": "Mail tracking for Mailgun",
"summary": "Mail tracking and Mailgun webhooks integration", "summary": "Mail tracking and Mailgun webhooks integration",
"version": "9.0.1.2.0",
"version": "9.0.1.2.1",
"category": "Social Network", "category": "Social Network",
"website": "https://odoo-community.org/", "website": "https://odoo-community.org/",
"author": "Tecnativa, " "author": "Tecnativa, "

3
mail_tracking_mailgun/models/res_partner.py

@ -30,8 +30,7 @@ class ResPartner(models.Model):
body = _('Email has been bounced: %s\n' body = _('Email has been bounced: %s\n'
'Reason: %s\n' 'Reason: %s\n'
'Event: %s') % (partner.email, reason, 'Event: %s') % (partner.email, reason,
event and event.get('Message-Id',
_('unknown')))
event and event.id or _('unknown'))
partner.message_post(body=body) partner.message_post(body=body)
@api.multi @api.multi

4
mail_tracking_mailgun/tests/test_mailgun.py

@ -381,10 +381,10 @@ class TestMailgun(TransactionCase):
def test_email_bounced_set(self): def test_email_bounced_set(self):
message_number = len(self.partner.message_ids) + 1 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.assertEqual(len(self.partner.message_ids), message_number)
self.partner.email = "" 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) self.assertEqual(len(self.partner.message_ids), message_number)
@mock.patch(_packagepath + '.models.mail_tracking_email.requests') @mock.patch(_packagepath + '.models.mail_tracking_email.requests')

Loading…
Cancel
Save