Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3101 Prikazi

i have this python function to make 'holiday_status_id' field change dynamically ..
i want to add this function to action 'hr_holidays.open_allocation_holidays'


@api.onchange('employee_id')
def change_leave_type(self):
for holiday_type in self:
if holiday_type.env.uid == holiday_type.user_id.id and not holiday_type.env.user.has_group('hr_holidays.group_hr_holidays_user'):
allocate_type = holiday_type.env['hr.holidays.status'].search([('name', '=', 'Compensatory Days')]).id
return {'domain': {'holiday_status_id':[('id', '=', allocate_type)]}}
elif holiday_type.env.user.has_group('hr_holidays.group_hr_holidays_user') and not holiday_type.env.user.has_group('hr_holidays.group_hr_holidays_manager'):
ids = []
allocation_types = holiday_type.env['hr.holidays.status'].search([])
for allocate in allocation_types:
if allocate.name != 'Unpaid':
ids.append(allocate.id)
return {'domain': {'holiday_status_id':[('id', '=', ids)]}}
Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
jan. 20
2909
1
dec. 19
4137
1
maj 24
2979
3
jun. 23
15873
1
mar. 22
13301