You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For any contact without login, Grant Portal Access and revoke it again
Create a new Website
The New website will have the user, you revoked portal access for, as "public user". This can cause a lot (really a lot) of issues later, because this user might not properly set up to be a public user of a new website, it will have email address and other values set, leading to difficult to find follow-up errors, especially with custom modules that expect a correct setup.
Technical Details:
Public users in odoo are archived and part of group public. They are used as placeholder for users without login.
Please note, that the _get_public_user-method is used in multiple custom modules, that we sometimes use. For example, to calculate the public pricelist for a company, but there are more. All of them break after we revoke portal access of a user, because this changes the default public user of our company in the _get_public_user-method.
I'm not sure about your desired solution. In our opinion, the revoke_portal_access is just wrong: It should not assign the user to group public.
We tested this:
modify addons/portal/wizard/portal_wizard.py, so that users are just archived, but not assigned to public group, and with a small adaption of _compute_group_details it all worked out fine. Issue solved.
Before we provide a pull request, we would like to get feedback if our approach points in the right direction to fix this issue. Then we will provide a PR with tests.
Thanks in advance!
Log Output
No response
Support Ticket
No response
The text was updated successfully, but these errors were encountered:
mjrk
changed the title
[17.0] website: Revoke Access changes company public user
[17.0] website: Revoke Portal Access changes company default public user
Aug 23, 2024
Odoo Version
Steps to Reproduce
The New website will have the user, you revoked portal access for, as "public user". This can cause a lot (really a lot) of issues later, because this user might not properly set up to be a public user of a new website, it will have email address and other values set, leading to difficult to find follow-up errors, especially with custom modules that expect a correct setup.
Technical Details:
Public users in odoo are archived and part of group public. They are used as placeholder for users without login.
The method revoke_portal_access assigns a user to public group and archives it
https://github.com/odoo/odoo/blob/36af138d231bffbfaff28d42bca972c1ddf172e2/addons/portal/wizard/portal_wizard.py#L131
Therefore, the method _get_public_user will return the user, whose portal access we just removed
https://github.com/odoo/odoo/blob/36af138d231bffbfaff28d42bca972c1ddf172e2/addons/website/models/res_company.py#L43C1-L43C32
Please note, that the _get_public_user-method is used in multiple custom modules, that we sometimes use. For example, to calculate the public pricelist for a company, but there are more. All of them break after we revoke portal access of a user, because this changes the default public user of our company in the _get_public_user-method.
I'm not sure about your desired solution. In our opinion, the revoke_portal_access is just wrong: It should not assign the user to group public.
We tested this:
Before we provide a pull request, we would like to get feedback if our approach points in the right direction to fix this issue. Then we will provide a PR with tests.
Thanks in advance!
Log Output
No response
Support Ticket
No response
The text was updated successfully, but these errors were encountered: