From ced585214405a62a06aba27ea4c5817914301bf8 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 25 Jul 2014 14:45:48 +0200 Subject: [PATCH] [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 --- addons/hr_holidays/hr_holidays.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 793ab247a2d..fbe72a1898c 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -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")