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
[FIX] hr: filter employee_ids based on the current company #164294
Closed
alsh-odoo
wants to merge
1
commit into
odoo:saas-17.1
from
odoo-dev:saas-17.1-sentry-5289238474-valueerror-hr-alsh
Closed
[FIX] hr: filter employee_ids based on the current company #164294
alsh-odoo
wants to merge
1
commit into
odoo:saas-17.1
from
odoo-dev:saas-17.1-sentry-5289238474-valueerror-hr-alsh
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This traceback occurs when the user clicks on the employee smart button. To reproduce this issue:- 1) Install "Employees", "contacts" without demo data 2) Enter into multi-company environment by creating a new company 3) Now create a new employee with company as new company and related user in the "Hr settings" as "Administrator" 4) Now switch to single company environment 5) click on the "employee" smart button from contact module for the "Administrator" record 6) A traceback occurs Error:- "ValueError: Expected singleton: hr.employee(1, 3)" Because after the commit {1 }from saas-17.1 when we have multiple records for a record in multi-companies and shift to single company, the other company records are also accessible. Because of that it leads to the above traceback when trying to access "id" from "self.employee_ids" https://github.com/odoo/odoo/blob/4f9b67938032a8b253d930a70acd2283b30ecda6/addons/hr/models/res_partner.py#L30-L36 [1] odoo@3c8e449 After applying this commit will resolve this issue by filtering the employee_ids based on the current company record "id" sentry-5289238474
Hello @odoo/sentry_reviewers 👋 Can I have review on this PR Thank You 🙂 |
LGTM! |
abla001
approved these changes
May 13, 2024
robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
May 13, 2024
This traceback occurs when the user clicks on the employee smart button. To reproduce this issue:- 1) Install "Employees", "contacts" without demo data 2) Enter into multi-company environment by creating a new company 3) Now create a new employee with company as new company and related user in the "Hr settings" as "Administrator" 4) Now switch to single company environment 5) click on the "employee" smart button from contact module for the "Administrator" record 6) A traceback occurs Error:- "ValueError: Expected singleton: hr.employee(1, 3)" Because after the commit {1 }from saas-17.1 when we have multiple records for a record in multi-companies and shift to single company, the other company records are also accessible. Because of that it leads to the above traceback when trying to access "id" from "self.employee_ids" https://github.com/odoo/odoo/blob/4f9b67938032a8b253d930a70acd2283b30ecda6/addons/hr/models/res_partner.py#L30-L36 [1] 3c8e449 After applying this commit will resolve this issue by filtering the employee_ids based on the current company record "id" sentry-5289238474 closes #164294 Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com>
This was referenced May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This traceback occurs when the user clicks on the
employee
smart button.To reproduce this issue:-
Employees
,contacts
without demo datamulti-company
environment by creating a new companyemployee
with company as new company andrelated
user
in theHr settings
asAdministrator
single company
environment by disabling new companyemployee
smart button fromcontact
module for theAdministrator
recordError:-
Because after the commit
{1 }
fromsaas-17.1
when we have multiple records for a record in
multi-companies
and shift to
single company
, the other company records are alsoaccessible
.Because of that it leads to the above traceback when trying to access
id
fromself.employee_ids
odoo/addons/hr/models/res_partner.py
Lines 30 to 36 in 4f9b679
[1] 3c8e449
After applying this commit will resolve this issue by filtering
the
employee_ids
based on the current company recordid
sentry-5289238474