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

[15.0][IMP] Don't update session_info if display_switch_company_menu unset. #678

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from

Conversation

amh-mw
Copy link

@amh-mw amh-mw commented Aug 8, 2024

This adds some defensive code to avoid an error updating session_info values that have not been populated.

res_company_code/models/ir_http.py Outdated Show resolved Hide resolved
if result.get("display_switch_company_menu"):
# Replace company name by company complete name in the session
# The values are used in the switch_company_menu widget (web module)
result["user_companies"]["current_company"] = user.company_id.id
Copy link
Author

Choose a reason for hiding this comment

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

This is the line that errors. Reproducible running stock odoo unit tests with --init mail,res_company_code. The user_companies value is not set for users without group base.group_user.

Copy link
Author

Choose a reason for hiding this comment

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

Covered with unit tests.

@amh-mw amh-mw force-pushed the 15.0-no_user_companies branch 4 times, most recently from 984441a to 0d22571 Compare August 13, 2024 13:52
This adds some defensive code to avoid an error updating session_info
values that have not been populated.
Copy link
Contributor

@Christian-RB Christian-RB left a comment

Choose a reason for hiding this comment

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

Make sense, LGTM

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

Successfully merging this pull request may close these issues.

2 participants