Skip to Content
Menu
This question has been flagged
838 Views

How to automatically increase the total annual leave duration if employees applies for compensatory days in time off module odoov15

please help me to solve this.

Avatar
Discard
Author

please help me to solve this..

Author

def alloc_leaves(self):
alloc_obj = self.env['hr.leave.allocation']
for al in self:
if al.iwave_auto_allocation is True:
if al.holiday_status_id.name is 'Holiday Work Request':

for emp in al.employee_ids:
vals = {
'name': 'Personal/Sick Leave ' + emp.name,
'holiday_status_id': al.leave_type_id.id,
'holiday_type': 'employee',
'employee_id': emp.id,
}
if al.request_unit == 'days':
vals.update({'number_of_days': al.number_of_days})
alloc = alloc_obj.create(vals)

alloc.action_approve()