summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-01-27 12:23:09 +0100
committerChristophe Simonis <chs@odoo.com>2016-01-27 12:23:09 +0100
commit7e44ddcda3f21c7e6401173539dc0fe93f9a7dd2 (patch)
tree322d7f2ce86ce328c27197c5c1b31c9f4a2b2c5c /addons/mail/models/mail_thread.py
parent3c7b08c030daf84323279b3d87361214e4f1b729 (diff)
parent6f923cbdcdc9a78d1999999b3bbd917eb8b4e921 (diff)
[MERGE] forward port of branch saas-7 up to 6f923cb
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)