Skip to content

Commit

Permalink
WIP: fix portal access revocation bug
Browse files Browse the repository at this point in the history
To be automatically reproduced and tested!
  • Loading branch information
fcayre committed Sep 22, 2024
1 parent fe472a7 commit 898c686
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions customer_team_manager/models/employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ def prepare_portal_wizard(self, in_portal):
def action_revoke_portal_access(self):
self.ensure_one()
wizard = self.prepare_portal_wizard(False)

# Remove groups which imply portal otherwise wizard may not work:
portal = self.env.ref("base.group_portal")
remove_groups = (
self.env["res.groups"].sudo().search([("implied_ids", "=", portal.id)])
)
for partner in wizard.mapped("user_ids.partner_id"):
if partner.user_ids:
partner.user_ids[0].groups_id -= remove_groups

wizard.action_apply()
self._reset_roles()

Expand Down

0 comments on commit 898c686

Please sign in to comment.