From b3ec4c76e6b27acd32bb7b646292810184b3b1ec 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, 4 Nov 2025 15:07:23 +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_hr_attendance/models/hr_attendance.py | 20 +++-----
.../models/yuthon_shift_approval.py | 2 +-
.../views/yuthon_shift_approval_views.xml | 47 +++++++------------
.../models/processing_order_approval.py | 1 -
.../views/processing_order_approval_views.xml | 1 -
yuthon_trade/models/yuthon_task_approval.py | 2 +-
6 files changed, 25 insertions(+), 48 deletions(-)
diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py
index 3eeb1fbf4..86f101e21 100644
--- a/yuthon_hr_attendance/models/hr_attendance.py
+++ b/yuthon_hr_attendance/models/hr_attendance.py
@@ -75,20 +75,11 @@ class HrAttendance(models.Model):
resource_user_ids = emp.resource_calendar_id.resource_user_ids.ids
is_resource_user = True if emp.id in resource_user_ids else False
if not is_resource_user and not test1:
- slot_start = datetime.combine(fields.Date.today(), datetime.min.time())
- slot_end = datetime.combine(fields.Date.today() + timedelta(days=1), datetime.min.time())
- # 查找员工对应的班次
- planning_slots = self.env['planning.slot'].search([
- ('employee_id', '=', emp.id),
- ('start_datetime', '>=', slot_start),
- ('start_datetime', '<', slot_end),
- ], limit=1)
- att_ids.create({
+ new_att = att_ids.create({
'employee_id': emp.id,
- 'shift_id': planning_slots.id,
- 'shift_name': planning_slots.display_name,
'current_data': fields.Date.today(),
})
+ new_att.compute_attend()
def state_fix(self):
for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))):
@@ -122,8 +113,11 @@ class HrAttendance(models.Model):
def compute_attendance_ids(self):
for att in self.env["hr.attendance"].browse(self._context.get('active_ids', self._context.get('active_id'))):
- current_data = fields.Datetime.to_datetime(att.current_data) + timedelta(hours=8)
- self.env["hr.attendance.detail"].compute_attendance_detail(att.employee_id, current_data.date(), is_manual=True)
+ att.compute_attend()
+
+ def compute_attend(self):
+ current_data = fields.Datetime.to_datetime(self.current_data) + timedelta(hours=8)
+ self.env["hr.attendance.detail"].compute_attendance_detail(self.employee_id, current_data.date(), is_manual=True)
@api.depends('current_data')
def _compute_month_status(self):
diff --git a/yuthon_hr_attendance/models/yuthon_shift_approval.py b/yuthon_hr_attendance/models/yuthon_shift_approval.py
index a1ec20f88..41e28b1cb 100644
--- a/yuthon_hr_attendance/models/yuthon_shift_approval.py
+++ b/yuthon_hr_attendance/models/yuthon_shift_approval.py
@@ -17,7 +17,7 @@ class YuthonShiftApproval(models.Model):
alternate_id = fields.Many2one('resource.resource', string="顶班对象", domain="[('id', 'in', resource_ids)]")
alternate_shifts = fields.Selection([('transferees', '换班'), ('alternate', '顶班')], string="申请类型" , default='transferees')
shift_date = fields.Date(string="日期")
- shift_id = fields.Many2one('planning.slot', string="我的班次")
+ shift_id = fields.Many2one('planning.slot', string="我的班次", compute='_compute_shift_id')
shift_two_date = fields.Date(string="日期")
shift_two_id = fields.Many2one('planning.slot', string="我的班次")
return_date = fields.Date(string="日期")
diff --git a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml
index 919350e71..b2ec3cb61 100644
--- a/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml
+++ b/yuthon_hr_attendance/views/yuthon_shift_approval_views.xml
@@ -64,32 +64,29 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
-
@@ -101,12 +98,7 @@
-
-
diff --git a/yuthon_maintain/models/processing_order_approval.py b/yuthon_maintain/models/processing_order_approval.py
index 259d2b23b..bb3c5f49a 100644
--- a/yuthon_maintain/models/processing_order_approval.py
+++ b/yuthon_maintain/models/processing_order_approval.py
@@ -17,7 +17,6 @@ class ProcessingOrderApproval(models.Model):
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
company_id = fields.Many2one(related='users_id.employee_id.company_id', string="公司")
- remake = fields.Text(string="备注")
documents_ids = fields.Many2many('ir.attachment', string="维修图片")
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
diff --git a/yuthon_maintain/views/processing_order_approval_views.xml b/yuthon_maintain/views/processing_order_approval_views.xml
index 7272252ce..0b695e10d 100644
--- a/yuthon_maintain/views/processing_order_approval_views.xml
+++ b/yuthon_maintain/views/processing_order_approval_views.xml
@@ -48,7 +48,6 @@
-
diff --git a/yuthon_trade/models/yuthon_task_approval.py b/yuthon_trade/models/yuthon_task_approval.py
index b74cbbe7b..0746a7ce5 100644
--- a/yuthon_trade/models/yuthon_task_approval.py
+++ b/yuthon_trade/models/yuthon_task_approval.py
@@ -42,7 +42,7 @@ class YuthonTaskApproval(models.Model):
def _onchange_employee_task(self):
if self.employee_ids and self.task_id:
employee_names = ', '.join(self.employee_ids.mapped('name'))
- self.name = f"{employee_names} - {self.task_id.name}"
+ self.name = f"{self.task_id.name} - {employee_names}"
@api.depends('task_start_time', 'task_end_time')
def _compute_duration(self):