diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-12-22 09:44:43 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-12-22 16:24:22 +0000 |
| commit | ee2ca9cb4c4172479fb949ad7a9726c7aaac6021 (patch) | |
| tree | 7714b369edd4cfbcc108cad653ec8bee3373bab4 /addons/test_mail | |
| parent | b34d27449920cfd683223969fd9d24a19e715d04 (diff) | |
[FW][FIX] mail: warn about invalid invite instead of crashing
When inviting people to a group-based channel an error may be raised if
invite target users not having the right group. Indeed they do not have
access to the channel as read access it not given if not belonging to
the channel group.
We add an UserError so that wrong invites are now pompted to the user
instead of crashing.
Task ID-2411038
X-Original-Commit odoo/odoo@e4889fbdd975c2ffdd41a78fc16cb91b092c3798 (12)
X-Original-Commit odoo/odoo@0c6abe3c33f45566cfdaea0f2bcab934daf89acc (12.3)
Forward port of odoo/odoo#63676
Forward port of odoo/odoo#63680
closes odoo/odoo#63715
X-original-commit: aa00d8d010f14e9f801bdd9e957280eaba18ff22
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/test_mail')
| -rw-r--r-- | addons/test_mail/tests/test_mail_channel_partner.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/test_mail/tests/test_mail_channel_partner.py b/addons/test_mail/tests/test_mail_channel_partner.py index d2629b64551..93dd7072154 100644 --- a/addons/test_mail/tests/test_mail_channel_partner.py +++ b/addons/test_mail/tests/test_mail_channel_partner.py @@ -3,7 +3,7 @@ from odoo.tests.common import SavepointCase -from odoo.exceptions import AccessError +from odoo.exceptions import AccessError, UserError class TestMailSecurity(SavepointCase): @@ -187,7 +187,7 @@ class TestMailSecurity(SavepointCase): self.assertEqual(channel_partners.mapped('partner_id'), self.user_1.partner_id) # user 1 can not invite user 3 because he's not in the group - with self.assertRaises(AccessError): + with self.assertRaises(UserError): self.group_channel_1.with_user(self.user_1).channel_invite([self.user_3.partner_id.id]) channel_partners = self.env['mail.channel.partner'].search([('channel_id', '=', self.group_channel_1.id)]) self.assertEqual(channel_partners.mapped('partner_id'), self.user_1.partner_id) |
