Permalink
Browse files

[FIX] hr_holidays: Wrong computation of leave duration

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 43b3f6e6483d75e6e9bd7e566f2ae6e24d8ecc50
Showing with 2 additions and 1 deletion.
  1. +2 −1 addons/hr_holidays/models/hr_leave.py
@@ -363,7 +363,8 @@ def _compute_number_of_days_display(self):
def _compute_number_of_hours_display(self):
for holiday in self:
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.depends('state', 'employee_id', 'department_id')

0 comments on commit 43b3f6e

Please sign in to comment.