From 58459a5867e2d1ef95b2f60fbe4af9aad4e3fff5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?=
<9664676+pengyuthon@user.noreply.gitee.com>
Date: Thu, 25 Sep 2025 17:03:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yuthon_salary/wizard/salary_compute_wizard.py | 10 +++++++++-
yuthon_salary/wizard/salary_compute_wizard_views.xml | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/yuthon_salary/wizard/salary_compute_wizard.py b/yuthon_salary/wizard/salary_compute_wizard.py
index 5b59b3387..d3fe444a8 100644
--- a/yuthon_salary/wizard/salary_compute_wizard.py
+++ b/yuthon_salary/wizard/salary_compute_wizard.py
@@ -57,7 +57,15 @@ class SalaryComputeWizard(models.Model):
('contract_id.termination_date', '=', False),
('contract_id.date_end', '=', False)
])
- self.employee_ids = [(6, 0, employees.ids)]
+ last_day1 = (datetime(year, month + 1, 1) - timedelta(days=1)).strftime('%Y-%m-%d')
+ existing_employees = self.env['hr.payslip'].search([
+ ('date_from', '>=', first_day),
+ ('date_to', '<=', last_day1),
+ ('company_id', '=', self.company_id.id)
+ ]).mapped('employee_id')
+ new_employees = employees - existing_employees
+ self.employee_ids = [(6, 0, new_employees.ids)]
+
self.employee_number = len(employees)
for employee in employees:
print(f"员工姓名: {employee.name}")
diff --git a/yuthon_salary/wizard/salary_compute_wizard_views.xml b/yuthon_salary/wizard/salary_compute_wizard_views.xml
index 80ec82964..3582a493a 100644
--- a/yuthon_salary/wizard/salary_compute_wizard_views.xml
+++ b/yuthon_salary/wizard/salary_compute_wizard_views.xml
@@ -10,7 +10,7 @@
-
+