Skip to content

Commit

Permalink
[FIX] hr_holidays: Wrong computation of leave duration
Browse files Browse the repository at this point in the history
When all days in a calendar don't have the same schedule, it's wrong
to compute the leave duration with the average working time hour per day.

opw:1909145
  • Loading branch information
simongoffin committed Dec 6, 2018
1 parent 8a0e42e commit 2921a53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/hr_holidays/models/hr_leave.py
Expand Up @@ -363,7 +363,8 @@ def _compute_number_of_days_display(self):
def _compute_number_of_hours_display(self): def _compute_number_of_hours_display(self):
for holiday in self: for holiday in self:
calendar = holiday.employee_id.resource_calendar_id or self.env.user.company_id.resource_calendar_id calendar = holiday.employee_id.resource_calendar_id or self.env.user.company_id.resource_calendar_id
holiday.number_of_hours_display = holiday.number_of_days * (calendar.hours_per_day or HOURS_PER_DAY) number_of_hours = calendar.get_work_hours_count(self.date_from, self.date_to)
holiday.number_of_hours_display = number_of_hours or (holiday.number_of_days * HOURS_PER_DAY)


@api.multi @api.multi
@api.depends('state', 'employee_id', 'department_id') @api.depends('state', 'employee_id', 'department_id')
Expand Down

0 comments on commit 2921a53

Please sign in to comment.