Merge pull request !3048 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-06-03 09:30:39 +00:00
committed by Gitee
@@ -24,9 +24,9 @@ class YuthonHrEmployeeWizard(models.Model):
raise ValidationError('请上传文件。')
book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file))
sh = book.sheet_by_index(0)
for rx in range(1, sh.nrows):
for rx in range(2, sh.nrows):
row = sh.row(rx)
self.update_bank_account(row)
self.update_lc_employee(row)
return {
'name': '批量更新员工',
'type': 'ir.actions.act_window',
@@ -326,4 +326,33 @@ class YuthonHrEmployeeWizard(models.Model):
if employee_id:
employee_id.write({'education_experience_ids': [(5, 0, 0)]})
employee_id.write({'emergency_contact_ids': [(5, 0, 0)]})
employee_id.write(employee_date)
employee_id.write(employee_date)
def update_lc_employee(self, row):
employee_id = self.env['hr.employee'].search([('name', '=', row[0].value)])
job_id = self.env['hr.job'].search([('name', '=', row[1].value), ('company_id.name', '=', '天河粮储')], limit=1)
structure_type_id = self.env['hr.payroll.structure.type'].search([('name', '=', row[2].value), ('company_id.name', '=', '天河粮储')])
if row[3].value:
entry_date = self.employee_date(row[3].value)
else:
entry_date = None
if row[4].value:
open_start_time = self.employee_date(row[4].value)
else:
open_start_time = None
interrupt_work_month = row[5].value
salary_group_id = self.env['yuthon.salary.group'].search([('name', '=', row[6].value)])
if employee_id:
employee_date = {
'job_id': job_id.id,
'entry_date': entry_date,
'open_start_time': open_start_time,
'interrupt_work_month': interrupt_work_month,
'salary_group_id': salary_group_id.id
}
employee_id.write(employee_date)
employee_id.contract_id.write({'structure_type_id': structure_type_id.id})