employee = env['hr.employee'].search([('employee_number','=',self.x_employee_number),('active','=',True)])
if employee:
if self.x_solution:
vals =
{'solution_id':self.x_solution.id,'start_date':self.x_solution_start_date,'end_date':self.x_solution_end_date}
employee.update(
{
'solution_ids':[[0,False,vals]]
}
)
if self.x_archive
adjust_payroll_date = self.x_execute_month.strftime('%Y-%m') if self.x_execute_month else ''
archive_vals1 =
{'payroll_item_id':self.x_archive.id,
'tenure_type':'full_time',
'position_id':self.x_position.id,
'amount':self.x_amount,
'effective_date':self.x_archive_start_date,
'expired_date':self.x_archive_end_date,
'adjust_payroll_period_date':adjust_payroll_date,
'currency_id':
}
employee.update(
{
'payroll_archive_ids':[[0,False,archive_vals1]]
}
)
if self.x_archive2
adjust_payroll_date2 = self.x_execute_month2.strftime('%Y-%m') if self.x_execute_month2 else ''
archive_vals2 =
{'payroll_item_id':self.x_archive2.id,
'tenure_type':'full_time',
'position_id':self.x_position.id,
'amount':self.x_amount2,
'effective_date':self.x_archive_start_date2,
'expired_date':self.x_archive_end_date2,
'adjust_payroll_period_date':adjust_payroll_date2,
'currency_id':
}
employee.update(
{
'payroll_archive_ids':[[0,False,archive_vals2]]
}
)
if self.x_archive3
adjust_payroll_date3 = self.x_execute_month3.strftime('%Y-%m') if self.x_execute_month3 else ''
archive_vals3 =
{'payroll_item_id':self.x_archive3.id,
'tenure_type':'full_time',
'position_id':self.x_position.id,
'amount':self.x_amount3,
'effective_date':self.x_archive_start_date3,
'expired_date':self.x_archive_end_date3,
'adjust_payroll_period_date':adjust_payroll_date3,
'currency_id':
}
employee.update(
{
'payroll_archive_ids':[[0,False,archive_vals3]]
}
)