[FIX] mail: Access error closing chat
Current behavior: After creating a group chat in the discuss app you were not able to close it. Steps to reproduce: -Create a group chat with more than one user in the discuss app - Try to leave it - You get an access error opw-2736464 closes odoo/odoo#83717 X-original-commit: cc1c132ee092368e77108f327ecdc5a6d2c490a6 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
@@ -99,7 +99,7 @@ class Channel(models.Model):
|
||||
|
||||
@api.constrains('channel_last_seen_partner_ids', 'channel_partner_ids')
|
||||
def _constraint_partners_chat(self):
|
||||
for ch in self.filtered(lambda ch: ch.channel_type == 'chat'):
|
||||
for ch in self.sudo().filtered(lambda ch: ch.channel_type == 'chat'):
|
||||
if len(ch.channel_last_seen_partner_ids) > 2 or len(ch.channel_partner_ids) > 2:
|
||||
raise ValidationError(_("A channel of type 'chat' cannot have more than two users."))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user