[FIX] portal: revoke regular portal users for real

When we revoke a user's portal permissions the user type will be changed
to public and be archived. There was an intended exception to check that
if the user had more groups than just the portal one we would keep the
user active.

But there are many groups that the user will have by default when we
install common apps like account, sale, etc.

TT43708

closes odoo/odoo#132404

X-original-commit: 96a5a12a8c277f3774520082d799a22577e00ebe
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
David
2023-08-21 12:39:38 +02:00
parent 1c16fb7844
commit a37214d7ba
+1 -5
View File
@@ -183,11 +183,7 @@ class PortalWizardUser(models.TransientModel):
# remove the user from the portal group
if user_sudo and user_sudo.has_group('base.group_portal'):
# if user belongs to portal only, deactivate it
if len(user_sudo.groups_id) <= 1:
user_sudo.write({'groups_id': [(3, group_portal.id), (4, group_public.id)], 'active': False})
else:
user_sudo.write({'groups_id': [(3, group_portal.id), (4, group_public.id)]})
user_sudo.write({'groups_id': [(3, group_portal.id), (4, group_public.id)], 'active': False})
return self.action_refresh_modal()