From 16525d5b568e61de8daeaa4dee9c2977a5aaa44c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 7 Feb 2020 14:31:15 +0000 Subject: [PATCH] [FIX] hr_holidays: incorrect number_of_hours_display - Go to Settings > Technical > Resource > Working Times - Have a Resource Calendar RC with Average hour per day != 8.00 - Have an Employee E with Working Hours == RC - Leaves > Configuration > Leave Types - Have a Leave Type LT with Take Leaves in Hours - Leaves > Managers > All > Allocations - Create an Allocation A with Employee E and Leave Type LT - Enter any number in Duration The number of hours entered changes as we leave the field. Being totally honest, what happens here is not clear at all, but using the corresponding `resource_id.calendar_id` field seems to fix the problem. opw-2191795 closes odoo/odoo#44903 X-original-commit: e239b354da9fa072e03e4d1186927fa3d74bcfe6 Signed-off-by: Nicolas Martinelli (nim) --- addons/hr_holidays/models/hr_leave_allocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index 9e24ba844ea..35c34ad1738 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -257,7 +257,7 @@ class HolidaysAllocation(models.Model): if allocation.parent_id and allocation.parent_id.type_request_unit == "hour": allocation.number_of_hours_display = allocation.number_of_days * HOURS_PER_DAY else: - allocation.number_of_hours_display = allocation.number_of_days * (allocation.employee_id.sudo().resource_calendar_id.hours_per_day or HOURS_PER_DAY) + allocation.number_of_hours_display = allocation.number_of_days * (allocation.employee_id.sudo().resource_id.calendar_id.hours_per_day or HOURS_PER_DAY) @api.depends('number_of_hours_display', 'number_of_days_display') def _compute_duration_display(self):