summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-01-27 12:24:04 +0100
committerChristophe Simonis <chs@odoo.com>2016-01-27 12:24:04 +0100
commit78d20b552b4374b94aec7097c0e6a48a3dd2d961 (patch)
tree5acd7cbf1cc9e2f277034f44fc0ebebaa3a1a79c /addons/mail/models/mail_thread.py
parent740a6eadd379cc3fa26aefb9350f1c95b3e05ebd (diff)
parent7e44ddcda3f21c7e6401173539dc0fe93f9a7dd2 (diff)
[MERGE] forward port of branch saas-8 up to 7e44ddc
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index a5b95d131e0..205236d2d9f 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -169,6 +169,7 @@ class MailThread(models.AbstractModel):
@api.multi
def _get_message_unread(self):
res = dict((res_id, 0) for res_id in self.ids)
+ partner_id = self.env.user.partner_id.id
# search for unread messages, directly in SQL to improve performances
self._cr.execute(""" SELECT msg.res_id FROM mail_message msg
@@ -176,8 +177,8 @@ class MailThread(models.AbstractModel):
ON rel.mail_message_id = msg.id
RIGHT JOIN mail_channel_partner cp
ON (cp.channel_id = rel.mail_channel_id AND cp.partner_id = %s AND (cp.seen_message_id < msg.id))
- WHERE msg.model = %s AND msg.res_id in %s""",
- (self.env.user.partner_id.id, self._name, tuple(self.ids),))
+ WHERE msg.model = %s AND msg.res_id in %s AND msg.author_id != %s""",
+ (partner_id, self._name, tuple(self.ids), partner_id,))
for result in self._cr.fetchall():
res[result[0]] += 1
@@ -2008,3 +2009,13 @@ class MailThread(models.AbstractModel):
msg_comment.write({"res_id": new_thread.id, "model": new_thread._name})
msg_not_comment.write({"res_id": new_thread.id, "model": new_thread._name, "subtype_id": None})
return True
+
+ # ------------------------------------------------------
+ # Mass mailing
+ # ------------------------------------------------------
+
+ def message_mass_mailing_enabled(self):
+ if self._mail_mass_mailing:
+ # TODO master properly translate
+ # the _mail_mass_mailing is evaluted at code start so not translated
+ return _(self._mail_mass_mailing)