Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] base_user_role_company: Migration to 18.0 #328

Merged
merged 35 commits into from
Feb 28, 2025

Conversation

yankinmax
Copy link

@yankinmax yankinmax commented Jan 8, 2025

Thanks to @BertVGroenendael the base_user_role_company is migrated here: #315
This PR is opened to fast-line the merge process.

@StefanRijnhart @ristecona

Chandresh-OSI and others added 24 commits January 8, 2025 14:30
Currently translated at 100.0% (11 of 11 strings)

Translation: server-backend-14.0/server-backend-14.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_user_role_company/it/
Issue found on logout / relogin.
The user groups were applied correctly, but the main menu showed apps
the user did not have access to.

This was related to the menu caching mechanisn, that was disabled here.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-backend-14.0/server-backend-14.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_user_role_company/
Currently translated at 90.9% (10 of 11 strings)

Translation: server-backend-14.0/server-backend-14.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_user_role_company/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: server-backend-16.0/server-backend-16.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_role_company/
Currently translated at 100.0% (8 of 8 strings)

Translation: server-backend-16.0/server-backend-16.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_role_company/es/
pedrocs-exo and others added 5 commits January 21, 2025 15:30
Currently translated at 100.0% (8 of 8 strings)

Translation: server-backend-16.0/server-backend-16.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_role_company/pt/
Currently translated at 100.0% (8 of 8 strings)

Translation: server-backend-16.0/server-backend-16.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_role_company/es/
Currently translated at 100.0% (8 of 8 strings)

Translation: server-backend-16.0/server-backend-16.0-base_user_role_company
Translate-URL: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_user_role_company/it/
@StefanRijnhart
Copy link
Member

/ocabot migration base_user_role_company

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone Jan 22, 2025
@OCA-git-bot OCA-git-bot mentioned this pull request Jan 22, 2025
6 tasks
@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from 13aba35 to 159adb6 Compare January 22, 2025 08:35
@yankinmax
Copy link
Author

@StefanRijnhart I need to debug the issue and will get with an update soon

@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from 159adb6 to 0d5896d Compare January 24, 2025 07:30
@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from 0d5896d to 5a3cdaa Compare January 24, 2025 07:35
@yankinmax
Copy link
Author

@yankinmax Wait, you just overwrote most of the migration changes: https://github.com/OCA/server-backend/compare/159adb6ffde762fde388818051c4b42de4cf2618..0d5896d724568725e66730da1842b3b34ef782ca?diff=unified&w=#diff-37a501b2f98480be68553ef3a061c6f92bc31c331e2a7ccf59a9eafb6bb542de

My bad, I'll update now

@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from 5a3cdaa to aad3857 Compare January 24, 2025 08:53
@StefanRijnhart
Copy link
Member

Maybe I don't know how to configure this module, but on runbot my session crashes if I log in as a user with different roles in two companies, and both companies enabled. At that point, Odoo redirects to portal url my, then crashes on currency_id access.

image
image
image

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 2366, in __call__
    response = request._serve_db()
  File "/opt/odoo/odoo/http.py", line 1894, in _serve_db
    return self._transactioning(
  File "/opt/odoo/odoo/http.py", line 1966, in _transactioning
    exc.error_response = self.registry['ir.http']._handle_error(exc)
  File "/opt/odoo/addons/http_routing/models/ir_http.py", line 610, in _handle_error
    code, html = 418, request.env['ir.ui.view']._render_template('http_routing.http_error', values)
  File "/opt/odoo/odoo/addons/base/models/ir_ui_view.py", line 2191, in _render_template
    return self.env['ir.qweb']._render(template, values)
  File "/opt/odoo/odoo/tools/profiler.py", line 306, in _tracked_method_render
    return method_render(self, template, values, **options)
  File "/opt/odoo/odoo/addons/base/models/ir_qweb.py", line 601, in _render
    result = ''.join(rendering)
  File "<265>", line 67, in template_265
  File "<265>", line 56, in template_265_content
  File "<190>", line 668, in template_190
  File "<190>", line 428, in template_190_content
  File "<190>", line 40, in template_190_t_nocache_1
odoo.addons.base.models.ir_qweb.QWebException: Error while render the template
AccessError: You are not allowed to access 'Currency' (res.currency) records.

This operation is allowed for the following groups:
	- Administration/Settings
	- Invoicing/Administrator
	- User types/Internal User
	- User types/Portal
	- User types/Public

Contact your administrator to request access if necessary.
Template: web.frontend_layout
Path: /t/html/head/script[2]/t
Node: <t t-out="json.dumps(request.env[\'ir.http\'].get_frontend_session_info())"/>
2025-01-24 09:29:26,187 18 INFO bc4602eac-8098-4d0e-9ef0-7753ccdae140 werkzeug: 65.108.98.234 - - [24/Jan/2025 09:29:26] "GET /my HTTP/1.1" 500 - 16 0.004 0.009

It's not a migration issue because something similar happens in v17, but I think this module should be allowed in the next version before it's fixed (unless someone can point out a beginner mistake I'm making with the configuration).

@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from aad3857 to 2f95458 Compare January 27, 2025 06:48
@yankinmax
Copy link
Author

yankinmax commented Feb 27, 2025

hello @StefanRijnhart , this migration (runboat) was tested by the Camptocamp business analyst.
"The Readme.srt specifies that “A company specific Role will only be enabled if it is set for all the currently selected companies.”.

So if a user has a role as Sales Admin on company A and a role as Purchase Admin on company B, then if both companies are selected no role is enabled.
Same behavior if a user has a role as Sales Admin for company A and a role as Sales Own Document for company B, if both companies are selected then no role is enabled.

Now, if a user has a role as Sales Admin for company A and a role as Sales Own Document for company A and company B, then, if both companies are selected, only the role Sales Own Document will be applied."

Can you pls check again and in case it's ok we go further here?

@yankinmax yankinmax force-pushed the 18.0-mig-base_user_role_company branch from 2f95458 to 4a76665 Compare February 27, 2025 16:25
Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! I think we can rely on the functional analyst in that case.

@StefanRijnhart
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-328-by-StefanRijnhart-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit b93bc3e into OCA:18.0 Feb 28, 2025
5 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at adf0f9e. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.