diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-20 14:16:48 +0000 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-20 14:33:54 +0000 |
| commit | 58a83d12228fbbd4e9dde542e133d264204ee0f3 (patch) | |
| tree | 60aaf45e3281e88fddc58fea8fe75de0ad4e2f46 /odoo/addons/base/tests/test_user_has_group.py | |
| parent | f6da4d57bcc8e19ae0bd6d571926706bee46e08f (diff) | |
| parent | 4a1321bc99dd7d8d153aceb2d0076161ce28bcd7 (diff) | |
[MERGE] forward port branch saas-12.4 up to 4a1321bc99d
closes odoo/odoo#37127
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'odoo/addons/base/tests/test_user_has_group.py')
| -rw-r--r-- | odoo/addons/base/tests/test_user_has_group.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/odoo/addons/base/tests/test_user_has_group.py b/odoo/addons/base/tests/test_user_has_group.py index 61f6efaecfb..4f5b2bc61dd 100644 --- a/odoo/addons/base/tests/test_user_has_group.py +++ b/odoo/addons/base/tests/test_user_has_group.py @@ -143,3 +143,21 @@ class TestHasGroup(TransactionCase): }) with self.assertRaises(ValidationError): self.grp_internal.users = [(4, test_user.id)] + + def test_two_user_types_implied_groups(self): + """Contrarily to test_two_user_types, we simply add an implied_id to a group. + This will trigger the addition of the relevant users to the relevant groups; + if, say, this was done in SQL and thus bypassing the ORM, it would bypass the constraints + and thus give us a case uncovered by the aforementioned test. + """ + grp_test = self.env["res.groups"].create( + {"name": "test", "implied_ids": [(6, 0, [self.grp_internal.id])]}) + + test_user = self.env['res.users'].create({ + 'login': 'test_user_portal', + 'name': "Test User with one user types", + 'groups_id': [(6, 0, [grp_test.id])] + }) + + with self.assertRaises(ValidationError): + grp_test.write({'implied_ids': [(4, self.grp_portal.id)]}) |
