diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index 6c6a339b3a4..b6191138795 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -133,7 +133,8 @@ class hr_holidays(osv.osv):
'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
'category_id': fields.many2one('hr.employee.category', "Category", help='Category of Employee'),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True),
- 'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
+ 'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'),
+ 'double_validation': fields.related('holiday_status_id', 'double_validation', type='boolean', relation='hr.holidays.status', string='Apply Double Validation'),
}
_defaults = {
'employee_id': _employee_get,
@@ -235,10 +236,10 @@ class hr_holidays(osv.osv):
manager = ids2 and ids2[0] or False
self.write(cr, uid, ids, {'state':'validate'})
data_holiday = self.browse(cr, uid, ids)
- holiday_ids = set()
+ holiday_ids = []
for record in data_holiday:
if record.holiday_status_id.double_validation:
- holiday_ids.add(record.id)
+ holiday_ids.append(record.id)
if record.holiday_type == 'employee' and record.type == 'remove':
meeting_obj = self.pool.get('crm.meeting')
vals = {
@@ -275,7 +276,6 @@ class hr_holidays(osv.osv):
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'confirm', cr)
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'validate', cr)
wf_service.trg_validate(uid, 'hr.holidays', leave_id, 'second_validate', cr)
- holiday_ids = list(holiday_ids)
if holiday_ids:
self.write(cr, uid, holiday_ids, {'manager_id2': manager})
return True
@@ -284,10 +284,14 @@ class hr_holidays(osv.osv):
self.check_holidays(cr, uid, ids)
return self.write(cr, uid, ids, {'state':'confirm'})
- def holidays_refuse(self, cr, uid, ids, *args):
+ def holidays_refuse(self, cr, uid, ids, approval, *args):
obj_emp = self.pool.get('hr.employee')
ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
manager = ids2 and ids2[0] or False
+ if approval == 'first_approval':
+ self.write(cr, uid, ids, {'manager_id': manager})
+ else:
+ self.write(cr, uid, ids, {'manager_id2': manager})
self.write(cr, uid, ids, {'state': 'refuse'})
self.holidays_cancel(cr, uid, ids)
return True
@@ -324,5 +328,4 @@ class resource_calendar_leaves(osv.osv):
'holiday_id': fields.many2one("hr.holidays", "Holiday"),
}
-resource_calendar_leaves()
-
+resource_calendar_leaves()
\ No newline at end of file
diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml
index 7740470ccc7..3ed5db02068 100644
--- a/addons/hr_holidays/hr_holidays_view.xml
+++ b/addons/hr_holidays/hr_holidays_view.xml
@@ -85,19 +85,20 @@
+
-
+
-
+
-
+
@@ -127,19 +128,20 @@
+
-
+
-
+
-
+
diff --git a/addons/hr_holidays/hr_holidays_workflow.xml b/addons/hr_holidays/hr_holidays_workflow.xml
index 8443ddb68d9..9b0c5652bdd 100644
--- a/addons/hr_holidays/hr_holidays_workflow.xml
+++ b/addons/hr_holidays/hr_holidays_workflow.xml
@@ -42,10 +42,8 @@
refuse
- function
True
stopall
- holidays_refuse()