Skip to content
Snippets Groups Projects
Commit a5ab7733 authored by MerlinGuillaume's avatar MerlinGuillaume
Browse files

[FIX] hr_leave: validate leave in multi-company environment


Validating an employee's leave with multiple companies selected doesn't
work when the employee isn't part of one of the selected companies

Steps to reproduce:
1. Install Time Off
2. Go to General Settings > Companies and create another company
3. Connect as Marc Demo, open Time Off and create a new time off request
4. Connect as Mitchell Admin and go to Time Off > Managers > Time Off
5. Approve and validate the time off request of Marc Demo
6. An access error is raised: `Access to unauthorized or invalid
   companies.`

Solution:
Clear `allowed_company_ids` from the context when we create the
`calendar.event` to avoid raising the error

Problem:
The creation of the `calendar.event` didn't use the correct user's
`allowed_company_ids` in the context

opw-3052973

closes odoo/odoo#107374

X-original-commit: df01e563
Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
Signed-off-by: default avatarGuillaume Merlin (megu) <megu@odoo.com>
parent cd9ca100
Branches
Tags
No related merge requests found
......@@ -957,6 +957,7 @@ class HolidaysRequest(models.Model):
Meeting = self.env['calendar.event']
for user_id, meeting_values in meeting_values_for_user_id.items():
meetings += Meeting.with_user(user_id or self.env.uid).with_context(
allowed_company_ids=[],
no_mail_to_attendees=True,
calendar_no_videocall=True,
active_model=self._name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment