summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/models
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-14 20:16:03 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-14 20:16:03 +0200
commit0ac7f8fbe62cf52fe43d73561a0bbd205c48e810 (patch)
tree1dfef6a191d118ddaa25380723e27485dd35c985 /addons/mass_mailing/models
parent8c2b380768b813915b0fa90c8e832a29a13ccbb7 (diff)
parentdabe59df9c84d5dbb7109decb193606b8cc2efe0 (diff)
[MERGE] forward port branch saas-11.4 up to dabe59df9c8
Diffstat (limited to 'addons/mass_mailing/models')
-rw-r--r--addons/mass_mailing/models/mail_thread.py2
-rw-r--r--addons/mass_mailing/models/mass_mailing_stats.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/addons/mass_mailing/models/mail_thread.py b/addons/mass_mailing/models/mail_thread.py
index 6ed94ba6b76..4d17c5321c6 100644
--- a/addons/mass_mailing/models/mail_thread.py
+++ b/addons/mass_mailing/models/mail_thread.py
@@ -35,7 +35,7 @@ class MailThread(models.AbstractModel):
""" Override to update the parent mail statistics. The parent is found
by using the References header of the incoming message and looking for
matching message_id in mail.mail.statistics. """
- if message.get('References'):
+ if message.get('References') and routes:
message_ids = [x.strip() for x in decode_smtp_header(message['References']).split()]
self.env['mail.mail.statistics'].set_opened(mail_message_ids=message_ids)
self.env['mail.mail.statistics'].set_replied(mail_message_ids=message_ids)
diff --git a/addons/mass_mailing/models/mass_mailing_stats.py b/addons/mass_mailing/models/mass_mailing_stats.py
index 3a2d4da527d..662b6adbaaf 100644
--- a/addons/mass_mailing/models/mass_mailing_stats.py
+++ b/addons/mass_mailing/models/mass_mailing_stats.py
@@ -97,7 +97,7 @@ class MailMailStats(models.Model):
def set_opened(self, mail_mail_ids=None, mail_message_ids=None):
statistics = self._get_records(mail_mail_ids, mail_message_ids, [('opened', '=', False)])
- statistics.write({'opened': fields.Datetime.now()})
+ statistics.write({'opened': fields.Datetime.now(), 'bounced': False})
return statistics
def set_clicked(self, mail_mail_ids=None, mail_message_ids=None):
@@ -111,6 +111,7 @@ class MailMailStats(models.Model):
return statistics
def set_bounced(self, mail_mail_ids=None, mail_message_ids=None):
- statistics = self._get_records(mail_mail_ids, mail_message_ids, [('bounced', '=', False)])
+ statistics = self._get_records(
+ mail_mail_ids, mail_message_ids, [('bounced', '=', False), ('opened', '=', False)])
statistics.write({'bounced': fields.Datetime.now()})
return statistics