You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
1.8 KiB

# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
class MailTrackingEvent(models.Model):
_inherit = "mail.tracking.event"
@api.model
def process_open(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_open(
tracking_email, metadata)
mail_mail_stats = self.sudo().env['mail.mail.statistics']
mail_mail_stats.set_opened(mail_mail_ids=[tracking_email.mail_id_int])
return res
def _tracking_set_bounce(self, tracking_email, metadata):
mail_mail_stats = self.sudo().env['mail.mail.statistics']
mail_mail_stats.set_bounced(mail_mail_ids=[tracking_email.mail_id_int])
@api.model
def process_hard_bounce(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_hard_bounce(
tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_soft_bounce(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_soft_bounce(
tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_reject(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_reject(
tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res
@api.model
def process_spam(self, tracking_email, metadata):
res = super(MailTrackingEvent, self).process_spam(
tracking_email, metadata)
self._tracking_set_bounce(tracking_email, metadata)
return res