[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) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-06-06 07:29:02 +00:00
parent 6b14ceb225
commit 2e7cbca0e9
+1 -1
View File
@@ -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']