From 2fa406afa2789c3ec7ba8fcaef98e38efca61907 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Sat, 14 Jun 2025 20:31:49 +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_contract/models/inherit_hr_contract.py | 13 +++++++------ .../views/yuthon_hr_employee_views.xml | 2 +- yuthon_salary/models/yuthon_payroll_project.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/yuthon_contract/models/inherit_hr_contract.py b/yuthon_contract/models/inherit_hr_contract.py index 874c14650..b081da233 100644 --- a/yuthon_contract/models/inherit_hr_contract.py +++ b/yuthon_contract/models/inherit_hr_contract.py @@ -42,12 +42,13 @@ class HrContract(models.Model): @api.onchange('date_end') def _onchange_date_end(self): today = date.today() - if self.date_end < today: - self.state = 'close' - elif self.date_end == today: - self.state = 'close' - else: - self.state = 'open' + if self.date_end: + if self.date_end < today: + self.state = 'close' + elif self.date_end == today: + self.state = 'close' + else: + self.state = 'open' @api.depends_context('uid', 'company') @api.depends('company_id') diff --git a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml index 037bc3b17..b1c6957c8 100644 --- a/yuthon_hr_employee/views/yuthon_hr_employee_views.xml +++ b/yuthon_hr_employee/views/yuthon_hr_employee_views.xml @@ -153,7 +153,7 @@ - + diff --git a/yuthon_salary/models/yuthon_payroll_project.py b/yuthon_salary/models/yuthon_payroll_project.py index 9f44858b3..b95e6e908 100644 --- a/yuthon_salary/models/yuthon_payroll_project.py +++ b/yuthon_salary/models/yuthon_payroll_project.py @@ -76,7 +76,7 @@ class YuthonPayrollCommon(models.Model): if ins.name == '安全生产管理补贴': formula_salary = "result = 320 if employee.department_id.name != '领导班子' else 0" if ins.name == '工龄补贴': - formula_salary = "result = min(400, ((employee.entry_date - employee.open_start_time).days // 30.4375 - employee.interrupt_work_month) // 12) * 10 + employee.salary_year * 20 if employee.department_id.name != '领导班子' else 0" + formula_salary = formula_salary = "result = min(400, max(0, ((employee.entry_date - employee.open_start_time).days // 30.4375 - employee.interrupt_work_month) // 12) * 10 + employee.salary_year * 20) if employee.department_id.name != '领导班子' else 0" if ins.name == '岗位绩效': formula_salary = "result = 0" if ins.name == '高温补贴':