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 @@ - +