[FIX] hr_holidays: fix traceback on timeoff form

Remove "Time Off" permission from a normal user (i.e. Marc Demo)
Login in as the user, go to Time Off > Managers (Time Off) > Create
Switch user.

Traceback will popup. This is caused by the computed field function
acquiring empty fields on change so the date_from will be False

opw-2166477

closes odoo/odoo#42859

X-original-commit: 57a6e8be9eb6ff31cb1edb7878f8c5dc913df8ec
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-01-07 14:01:15 +00:00
parent 5c3451b404
commit 16cd396d03
+1 -1
View File
@@ -930,7 +930,7 @@ class HolidaysRequest(models.Model):
if state == 'draft':
if holiday.state == 'refuse':
raise UserError(_('Only a Time Off Manager can reset a refused leave.'))
if holiday.date_from.date() <= fields.Date.today():
if holiday.date_from and holiday.date_from.date() <= fields.Date.today():
raise UserError(_('Only a Time Off Manager can reset a started leave.'))
if holiday.employee_id != current_employee:
raise UserError(_('Only a Time Off Manager can reset other people leaves.'))