[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
This commit is contained in:
Denis Ledoux 2014-07-25 14:45:48 +02:00
parent 46ef1356d6
commit ced5852144
1 changed files with 1 additions and 1 deletions

View File

@ -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")