odoo/odoo#183215

Created by Bugfix, Youssef Bashandy (yoba)
Closed
label
odoo-dev:saas-17.4-opw-4224592-calculate_allocation_duration_using_employee_resource-yoba
head
b7e9a29251e289a7a258bcfaf2ab1d93ebc51b30
odoo/odoo
saas-17.4 #183215

[FIX] hr_holidays : Use employee resource for computation of allocation

Steps to reproduce:

- Create a new working schedule that is not 8 hours a day
- Assign this working schedule to one of the employees
- Create a Time off type and set the unit as 'Hours'
- Create an allocation for the created type and the employee with the new working schedule
- Set the Allocation for 80 hours and save
- Notice the 80 has been changed

Current behavior before PR:

This is happening because in this commit odoo-dev@1d8898bae93da9ccc1687971a19b238f279032eb we changed the computation of the allocation to use HOURS_PER_DAY which is a static variable set to 8 -default working hours per day- so if the employee has different working hours a day it will be calculated wrongly.

Desired behavior after PR is merged:

We are now using the working hours for the resource of the employee and we only fallback on HOURS_PER_DAY if there isn't a resource for the employee.

opw-4224592