|
|
@ -10,6 +10,7 @@ import requests |
|
|
|
from datetime import datetime |
|
|
|
from openerp import _, api, fields, models |
|
|
|
from openerp.exceptions import UserError, ValidationError |
|
|
|
from openerp.tools import email_split |
|
|
|
|
|
|
|
import logging |
|
|
|
_logger = logging.getLogger(__name__) |
|
|
@ -241,8 +242,13 @@ class MailTrackingEmail(models.Model): |
|
|
|
if "items" not in content: |
|
|
|
raise ValidationError(_("Event information not longer stored")) |
|
|
|
for item in content["items"]: |
|
|
|
# mailgun event hasn't been synced and recipient is the same as |
|
|
|
# in the evaluated tracking. We use email_split since tracking |
|
|
|
# recipient could come in format: "example" <to@dest.com> |
|
|
|
if not self.env['mail.tracking.event'].search( |
|
|
|
[('mailgun_id', '=', item["id"])]): |
|
|
|
[('mailgun_id', '=', item["id"])]) and ( |
|
|
|
item.get("recipient", "") == |
|
|
|
email_split(tracking.recipient)[0]): |
|
|
|
mapped_event_type = self._mailgun_event_type_mapping.get( |
|
|
|
item["event"], item["event"]) |
|
|
|
metadata = self._mailgun_metadata( |
|
|
|