From 51cb6f38d883913362dbe90c4166cac809199033 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: Tue, 3 Feb 2026 16:16:37 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E5=81=87=E7=BB=93=E6=9D=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
soong_workflow/views/soong_hr_employee_views.xml | 1 +
.../models/yuthon_holiday_statement.py | 4 ++++
.../views/yuthon_holiday_statement.xml | 2 +-
yuthon_hr_employee/data/abnormal_time_data.xml | 13 +++++++++++++
yuthon_hr_employee/models/yuthon_hr_employee.py | 5 +++++
.../models/yuthon_reassignment_approval.py | 15 +++++++--------
6 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/soong_workflow/views/soong_hr_employee_views.xml b/soong_workflow/views/soong_hr_employee_views.xml
index f31bd1604..df7c65597 100644
--- a/soong_workflow/views/soong_hr_employee_views.xml
+++ b/soong_workflow/views/soong_hr_employee_views.xml
@@ -8,6 +8,7 @@
+
diff --git a/yuthon_hr_attendance/models/yuthon_holiday_statement.py b/yuthon_hr_attendance/models/yuthon_holiday_statement.py
index f24b3d258..74401256a 100644
--- a/yuthon_hr_attendance/models/yuthon_holiday_statement.py
+++ b/yuthon_hr_attendance/models/yuthon_holiday_statement.py
@@ -12,6 +12,7 @@ class InheritHrLeave(models.Model):
caption = fields.Char(string="标题", compute="_compute_application_reason")
employee_id = fields.Many2one('hr.employee', string="发起人")
+ length_leave = fields.Float(string="请假时长", compute="_compute_application_reason")
leave_stats = fields.Char(string="请假统计", compute="_compute_leave_stats")
is_filing = fields.Boolean(string="归档")
application_reason = fields.Char(string="申请原因", compute="_compute_application_reason")
@@ -42,12 +43,15 @@ class InheritHrLeave(models.Model):
if rec.batch_id:
rec.application_reason = rec.batch_id.text
rec.caption = rec.batch_id.name
+ rec.length_leave = rec.batch_id.days
elif rec.hour_batch_id:
rec.application_reason = rec.hour_batch_id.text
rec.caption = rec.hour_batch_id.name
+ rec.length_leave = rec.hour_batch_id.days
else:
rec.application_reason = ''
rec.caption = ''
+ rec.length_leave = 0
@api.depends('holiday_status_id', 'employee_id')
def _compute_leave_stats(self):
diff --git a/yuthon_hr_attendance/views/yuthon_holiday_statement.xml b/yuthon_hr_attendance/views/yuthon_holiday_statement.xml
index 4fe89a236..e34bb8698 100644
--- a/yuthon_hr_attendance/views/yuthon_holiday_statement.xml
+++ b/yuthon_hr_attendance/views/yuthon_holiday_statement.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/yuthon_hr_employee/data/abnormal_time_data.xml b/yuthon_hr_employee/data/abnormal_time_data.xml
index c6a475226..809a4e70b 100644
--- a/yuthon_hr_employee/data/abnormal_time_data.xml
+++ b/yuthon_hr_employee/data/abnormal_time_data.xml
@@ -42,5 +42,18 @@
-1
+
+ 定时任务:更新花名册员工颜色
+
+ code
+ model.update_end_comparison()
+
+
+ 1
+ days
+
+ -1
+
+
diff --git a/yuthon_hr_employee/models/yuthon_hr_employee.py b/yuthon_hr_employee/models/yuthon_hr_employee.py
index a998e85a7..3663676c2 100644
--- a/yuthon_hr_employee/models/yuthon_hr_employee.py
+++ b/yuthon_hr_employee/models/yuthon_hr_employee.py
@@ -289,6 +289,11 @@ class YuthonHrEmployee(models.Model):
if record.contract_id.date_end <= date.today() + timedelta(days=8):
record.is_membership = False
+ def update_end_comparison(self):
+ employees = self.env['hr.employee'].search([])
+ for employee in employees:
+ employee._compute_end_comparison()
+
@api.depends('date_end')
def _compute_end_comparison(self):
for record in self:
diff --git a/yuthon_hr_employee_approval/models/yuthon_reassignment_approval.py b/yuthon_hr_employee_approval/models/yuthon_reassignment_approval.py
index 9b554e17a..5864aa3ad 100644
--- a/yuthon_hr_employee_approval/models/yuthon_reassignment_approval.py
+++ b/yuthon_hr_employee_approval/models/yuthon_reassignment_approval.py
@@ -87,10 +87,10 @@ class YuthonReassignmentApproval(models.Model):
def end_approval(self):
current_date = fields.Date.today()
# 筛选已完成审批的记录
- reassignment_approval_ids = self.search([('work_end', '=', True),
- ('is_execution', '=', False),
- ])
- for record in reassignment_approval_ids:
+ # reassignment_approval_ids = self.search([('work_end', '=', True),
+ # ('is_execution', '=', False),
+ # ])
+ for record in self:
if record.change_date <= current_date:
employee = record.employee_id
old_contract = employee.contract_id
@@ -121,7 +121,7 @@ class YuthonReassignmentApproval(models.Model):
'date_start': record.change_date,
'date_end': False,
'resource_calendar_id': old_contract.resource_calendar_id.id,
- 'structure_type_id': old_contract.structure_type_id.id,
+ # 'structure_type_id': old_contract.structure_type_id.id,
'department_id': old_contract.department_id.id,
'job_id': old_contract.job_id.id,
'termination_date': old_contract.termination_date,
@@ -134,18 +134,17 @@ class YuthonReassignmentApproval(models.Model):
if record.change_job_id:
new_contract_vals['job_id'] = record.change_job_id.id
if record.change_structure_id:
- new_contract_vals[ 'structure_type_id'] = record.change_structure_id.id
+ new_contract_vals[ 'structure_type_id'] = record.change_structure_id.type_id.id
if record.change_department_id:
new_contract_vals['department_id'] = record.change_department_id.id
- new_contract = self.env['hr.contract'].create(new_contract_vals)
old_contract.write({
'state': 'cancel',
'date_end': record.change_date - timedelta(days=1),
})
+ new_contract = self.env['hr.contract'].create(new_contract_vals)
employee.contract_id = new_contract.id
record.is_execution = True
-
class HrJobType(models.Model):
_name = "hr.job.type"