[FIX] mail: disable seen notification for 'channel' channels

This commit fully disables seen notification (vv) on channels with
multiple members.

This feature was already disabled on the UI, but the computation
still happened in the background. This was problematic with some
channels with thousands of members, as it took dozens of seconds
to fully compute seen "notification-related" fields during
`mail/init_messaging`.

Part of task-2308312

closes odoo/odoo#55449

X-original-commit: a03b0f3a0486dc86db1c69363723f71047812053
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Alexandre Kühn
2020-08-05 10:27:15 +00:00
parent faab9ee9f6
commit 10f231f15e
+7 -6
View File
@@ -600,12 +600,13 @@ class Channel(models.Model):
# add members infos
partner_ids = channel_partners.mapped('partner_id').ids
info['members'] = [partner_infos[partner] for partner in partner_ids]
info['seen_partners_info'] = [{
'id': cp.id,
'partner_id': cp.partner_id.id,
'fetched_message_id': cp.fetched_message_id.id,
'seen_message_id': cp.seen_message_id.id,
} for cp in channel_partners]
if channel.channel_type != 'channel':
info['seen_partners_info'] = [{
'id': cp.id,
'partner_id': cp.partner_id.id,
'fetched_message_id': cp.fetched_message_id.id,
'seen_message_id': cp.seen_message_id.id,
} for cp in channel_partners]
channel_infos.append(info)
return channel_infos