コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2818 ビュー

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)]}}
アバター
破棄
関連投稿 返信 ビュー 活動
1
1月 20
2655
1
12月 19
3933
1
5月 24
2756
3
6月 23
15450
1
3月 22
12842