From 7f081cffaa8e2a47f05353822eec48ddeb4540c6 Mon Sep 17 00:00:00 2001 From: Yolann Sabaux Date: Tue, 19 Apr 2022 10:00:45 +0000 Subject: [PATCH] [FIX] hr_holidays: set correct default date Steps to reproduce: - Go to time off - >New Time Off-> in the list you will see the all the times that are possible to take(that require allocation and not) - Go to time off->My time off->create - Select Sick Time Off Issue: If you want to select "Paid Time Off" it won't be displayed anymore Cause: When selecting a leave_type that does not require allocation the "default_date_from" is False. And so the get(key, default) does not return the default. opw-2813263 closes odoo/odoo#89196 X-original-commit: ee6e6cb26528f42de9652b88fe022ebae2cfacfc Signed-off-by: Kevin Baptiste Signed-off-by: yosa-odoo --- addons/hr_holidays/models/hr_leave_type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave_type.py b/addons/hr_holidays/models/hr_leave_type.py index 15872ffd283..39f41fb5787 100644 --- a/addons/hr_holidays/models/hr_leave_type.py +++ b/addons/hr_holidays/models/hr_leave_type.py @@ -241,7 +241,7 @@ class HolidaysType(models.Model): ]) if not date: - date = self.env.context.get('default_date_from', fields.Date.context_today(self)) + date = self.env.context.get('default_date_from') or fields.Date.context_today(self) allocations = self.env['hr.leave.allocation'].search([ ('employee_id', 'in', employee_ids), ('state', 'in', ['confirm', 'validate1', 'validate']),