From 2e7cbca0e957578518e206f5a9a773fbf2d58be4 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 5 Jun 2019 08:43:24 +0000 Subject: [PATCH] [FIX] hr_holidays: Not able to fill holiday request Steps to reproduce the bug: - Log as admin user in company C - Go to Leaves module and click on Managers > Allocations - Create a leave.allocation with type = Compensatory Days, duration = 7 days mode = By Company and Company = C - Approve the allocation - Create a leave request LR for all the company C and approve it - Log as demo user (only user access right for Leaves) - Go to Leaves > My Leaves and click on "Leaves requests" Bug: A traceback was raised opw:2005813 closes odoo/odoo#33899 Signed-off-by: Simon Goffin (sig) --- addons/hr_holidays/models/hr_leave.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index c2121ace15e..57d72ca3da4 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -540,7 +540,7 @@ class HolidaysRequest(models.Model): return current_employee = self.env['hr.employee'].sudo().search([('user_id', '=', self.env.uid)], limit=1) for record in self: - emp_id = record._cache.get('employee_id', [False])[0] + emp_id = record._cache.get('employee_id', False) and record._cache.get('employee_id')[0] if emp_id != current_employee.id: try: record._cache['name']