[FIX] mail: find direct partner from right channel

Previously, when getting channel info, it was possible that the
channel name was the name of the partner of another channel.

This bug was introduced with 975164473c

closes odoo/odoo#32730

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Xavier-Do
2019-04-12 12:36:52 +00:00
parent fdd0179f4f
commit b583b118f8
+1 -1
View File
@@ -616,7 +616,7 @@ class Channel(models.Model):
if channel.channel_type == 'chat':
# direct_partner should be removed from channel info since we can find it from members and channel_type
# we keep it know to avoid change tests and javascript
direct_partner = direct_channel_partners.filtered(lambda pc: pc.partner_id.id != self.env.user.partner_id.id)
direct_partner = channel_partners.filtered(lambda pc: pc.partner_id.id != self.env.user.partner_id.id)
info['direct_partner'] = [partner_infos[direct_partner[0].partner_id.id]]
# add needaction and unread counter, since the user is logged
info['message_needaction_counter'] = channel.message_needaction_counter