[FIX] mail: add users from self-chat

Before this commit, when opening self-chat and trying to add users,
self id was duplicated with the chat partner id, leading to a crash.

This commit fixes the issue by removing duplicates in inviting users,
so that there's no longer a crash when inviting users in self-chat.

task-3381895

closes odoo/odoo#126605

X-original-commit: d101a82b97989d5c60c1b6dfbc5fa2143680bd3c
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Zelong Lin
2023-06-28 16:17:04 +02:00
committed by Alexandre Kühn
parent 3db0d97a7e
commit d32ba1a55e
@@ -1109,6 +1109,7 @@ class Channel(models.Model):
:returns: channel_info of the created channel
:rtype: dict
"""
partners_to = set(partners_to)
channel = self.create({
'channel_member_ids': [Command.create({'partner_id': partner_id}) for partner_id in partners_to],
'channel_type': 'group',