From 448aa527b0cf76da9cf58aae4f062fc3e6497207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Sat, 12 Jul 2025 16:09:46 +0800 Subject: [PATCH] 1 --- yuthon_salary/wizard/temporary_payslip_wizard.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/yuthon_salary/wizard/temporary_payslip_wizard.py b/yuthon_salary/wizard/temporary_payslip_wizard.py index 1d3272b46..cad7f9b45 100644 --- a/yuthon_salary/wizard/temporary_payslip_wizard.py +++ b/yuthon_salary/wizard/temporary_payslip_wizard.py @@ -55,20 +55,18 @@ class TemporaryPayslipWizard(models.Model): ("employee_id", "=", employee_id.id), ('is_push', '=', False), ]) - - line_vals = {} for col_idx in range(1, len(headers)): header = headers[col_idx] temporary_id = self.env['yuthon.payroll.temporary'].search([('name', '=', header)]) # 查找临时项 if not payslip.line_ids.search([('name', '=', header)]) or not temporary_id: - raise ValidationError(f'未识别到存在工资项,请检查是否有该项目和格式名称是否对应\n员工: {employee_id.name}\n批次: {self.select_year}' + raise ValidationError(f'未识别到存在工资项,请检查是否有该项目和格式名称是否对应\n' + f'员工: {employee_id.name}\n批次: {self.select_year}' f'年-{month_name}\n薪资结构: {payslip.struct_id.name}\n导入工资项名称: {header}') cell_value = row[col_idx].value if cell_value in (None, "", " "): continue - for line in payslip.line_ids.search([('name', '=', header), - ('employee_id', '=', employee_id.id), + for line in payslip.line_ids.search([('name', '=', header), ('employee_id', '=', employee_id.id), ('slip_id.payslip_run_id.name', '=', f'{self.select_year}年-{month_name}')]): line_vals[line.id] = {"total": float(cell_value)} if line_vals: