两个薪资函数,名称:获取某薪资组某薪资项的值们,Get ALL Other Payroll Group Item Values
代码分别如下(中间等号分割):
def get_other_payroll_group_item_values(payroll_group_code, payitem_code):
employee_id = individual_dict['ref_employee_id']
key = (employee_id, payroll_group_code, payitem_code)
value_list = global_dict.get('F_ALLOtherPayrollGroupItemValues', {}).get(key, [])
if not value_list:
return 0
result = value_list[-1]
return result
================================
result = {}
other_payroll_group_parameter_dict = {}
current_period = payslip_run_record.payroll_period
current_month = current_period.name
current_month = datetime.datetime.strptime(str(current_month)+'01','%Y%m%d')-relativedelta.relativedelta(months=1)
pay_month = int(current_month.strftime('%Y%m'))
employee_ids = payslip_run_record.employee_ids.ids
hr_payslip_parameters = preFuncParameterDict.get('get_other_payroll_group_item_values', [])
- '获取某薪资组某薪资项的值'的参数
for hr_payslip_parameter in hr_payslip_parameters:
parameters = eval(hr_payslip_parameter['func_args'])
for parameter in parameters:
if isinstance(parameter, tuple):
other_payroll_group_parameter_dict.setdefault(tuple([eval(i) for i in parameter]), None)
else:
other_payroll_group_parameter_dict.setdefault((eval(parameter),), None)
payroll_group_code_payitem_dict = {}
for args in other_payroll_group_parameter_dict.keys():
if len(args) != 2:
continue
else:
payroll_group_code = args[0]
payitem_code = args[1]
if payroll_group_code not in payroll_group_code_payitem_dict:
payroll_group_code_payitem_dict[payroll_group_code] = []
if payitem_code not in payroll_group_code_payitem_dict[payroll_group_code]:
payroll_group_code_payitem_dict[payroll_group_code].append(payitem_code)
result = env['hr.payslip.run'].get_group_period_batch_result_data(payroll_group_code_payitem_dict, pay_month, employee_ids, payslip_run_record.id)