Skip to content

Commit

Permalink
[FIX] hr_employee_calendar_planning: fill calendar if empty
Browse files Browse the repository at this point in the history
We should only fill the calendar with sync_user if and only if you don't have one

Sync user is used also when we modify the user of an employee
  • Loading branch information
victoralmau committed Jun 27, 2023
1 parent cb29ccf commit b488b72
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions hr_employee_calendar_planning/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,18 @@ def copy(self, default=None):
def _sync_user(self, user):
res = super()._sync_user(user=user)
# set calendar_ids from Create employee button from user
res.update(
{
"calendar_ids": [
(
0,
0,
{"calendar_id": user.company_id.resource_calendar_id.id,},
),
]
}
)
if not self.calendar_ids:
res.update(
{
"calendar_ids": [
(
0,
0,
{"calendar_id": user.company_id.resource_calendar_id.id,},
),
]
}
)
return res

@api.model_create_multi
Expand Down

0 comments on commit b488b72

Please sign in to comment.