Skip to content
Snippets Groups Projects
Commit ced58521 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] hr_holidays: do not allow reduce remaining leaves

In the Employee form, a remaining legal leaves field is available, which shows remaining validated leaves from allocation requests
As this is not allowed to delete a validated allocation requets, it shouldn't be possible to reduce the validated remaining leaves of an employee.
To reduce the remaining leaves of an employee, the user should cancel and remove the allocation request
parent 46ef1356
Branches
Tags
No related merge requests found
......@@ -491,7 +491,7 @@ class hr_employee(osv.osv):
if diff > 0:
leave_id = holiday_obj.create(cr, uid, {'name': _('Allocation for %s') % employee.name, 'employee_id': employee.id, 'holiday_status_id': status_id, 'type': 'add', 'holiday_type': 'employee', 'number_of_days_temp': diff}, context=context)
elif diff < 0:
leave_id = holiday_obj.create(cr, uid, {'name': _('Leave Request for %s') % employee.name, 'employee_id': employee.id, 'holiday_status_id': status_id, 'type': 'remove', 'holiday_type': 'employee', 'number_of_days_temp': abs(diff)}, context=context)
raise osv.except_osv(_('Warning!'), _('You cannot reduce validated allocation requests'))
else:
return False
wf_service = netsvc.LocalService("workflow")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment