diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index b7a5b73145c..91699c29d92 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -177,7 +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 AND msg.author_id != %s""",
+ WHERE msg.model = %s AND msg.res_id in %s AND msg.author_id != %s AND
+ (msg.message_type != 'notification' OR msg.model != 'mail.channel')""",
(partner_id, self._name, tuple(self.ids), partner_id,))
for result in self._cr.fetchall():
res[result[0]] += 1
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js
index 74db804b7fc..5e37bf237d8 100644
--- a/addons/mail/static/src/js/chat_manager.js
+++ b/addons/mail/static/src/js/chat_manager.js
@@ -147,7 +147,7 @@ function add_message (data, options) {
channel.hidden = false;
chat_manager.bus.trigger('new_channel', channel);
}
- if (channel.type !== 'static' && !msg.is_author) {
+ if (channel.type !== 'static' && !msg.is_author && !msg.is_system_notification) {
if (options.increment_unread) {
update_channel_unread_counter(channel, channel.unread_counter+1);
}
@@ -179,6 +179,7 @@ function make_message (data) {
subtype_description: data.subtype_description,
is_author: data.author_id && data.author_id[0] === session.partner_id,
is_note: data.is_note,
+ is_system_notification: data.message_type === 'notification' && data.model === 'mail.channel',
attachment_ids: data.attachment_ids,
subject: data.subject,
email_from: data.email_from,
@@ -820,7 +821,7 @@ var chat_manager = {
var msg = _.findWhere(messages, {id: channel.last_seen_message_id});
if (msg) {
var i = _.sortedIndex(messages, msg, 'id') + 1;
- while (i < messages.length && messages[i].is_author) {
+ while (i < messages.length && (messages[i].is_author || messages[i].is_system_notification)) {
msg = messages[i];
i++;
}
diff --git a/addons/mail/static/src/js/thread.js b/addons/mail/static/src/js/thread.js
index d0123c0457e..0c57ea8ad88 100644
--- a/addons/mail/static/src/js/thread.js
+++ b/addons/mail/static/src/js/thread.js
@@ -132,7 +132,7 @@ var Thread = Widget.extend({
msg.hour = msg.date.format('LT');
}
- msg.display_subject = message.subject && message.message_type !== 'notification' && !(message.model && (message.model !== 'mail.channel'));
+ msg.display_subject = message.subject && !message.is_system_notification;
return msg;
},
diff --git a/addons/mail/static/src/xml/thread.xml b/addons/mail/static/src/xml/thread.xml
index 970c8ff6a6f..83436f37495 100644
--- a/addons/mail/static/src/xml/thread.xml
+++ b/addons/mail/static/src/xml/thread.xml
@@ -97,7 +97,7 @@
(from #)
-