From 93857bef828084b567d3073746da309781d92f89 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: Fri, 17 Jul 2026 15:46:51 +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 --- .../wizard/soong_workflow_comment_wizard.py | 9 +++++---- .../wizard/soong_workflow_record_delete_wizard.py | 4 +++- yuthon_holiday/models/inherit_hr_leave.py | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/soong_workflow/wizard/soong_workflow_comment_wizard.py b/soong_workflow/wizard/soong_workflow_comment_wizard.py index 5f319b1ae..910762c89 100644 --- a/soong_workflow/wizard/soong_workflow_comment_wizard.py +++ b/soong_workflow/wizard/soong_workflow_comment_wizard.py @@ -96,8 +96,7 @@ class SoongWorkflowCommentWizard(models.TransientModel): def _onchange_employee_ids1(self): self.employee_ids = False if not self.employee_ids1: - return - if not self.is_selection: + self.employee_ids = False return filtered_employees = self.employee_ids1 # 范围过滤 @@ -112,8 +111,10 @@ class SoongWorkflowCommentWizard(models.TransientModel): filtered_employees = self.employee_ids1.filtered( lambda e: e.department_id in all_depts or any(d in all_depts for d in e.department_ids) ) - self.employee_ids = filtered_employees - return + + if len(filtered_employees) == 1: + self.employee_ids = filtered_employees + return @api.onchange('scope_type', 'department_id', 'company_id') def _onchange_employee_ids2(self): diff --git a/soong_workflow/wizard/soong_workflow_record_delete_wizard.py b/soong_workflow/wizard/soong_workflow_record_delete_wizard.py index bdcc89b8c..e9a520527 100644 --- a/soong_workflow/wizard/soong_workflow_record_delete_wizard.py +++ b/soong_workflow/wizard/soong_workflow_record_delete_wizard.py @@ -79,7 +79,9 @@ class SoongWorkflowRecordDeleteWizard(models.TransientModel): workflow_record.write({"reclaim_state": True}) # 处理工作流日志 - log_ids = self.env["soong.workflow.log"].sudo().search([("code", "=", record.code)]) + log_ids = self.env["soong.workflow.log"].sudo().search([("res_id", "=", record.res_id), + ("res_model", "=", record.res_model), + ]) for log_id in log_ids: log_id.sudo().write({"active": False}) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 29eecc1c4..214ba9af4 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -254,7 +254,13 @@ class HrLeave(models.Model): days = (self.request_date_to - self.request_date_from).days + 1 if self.request_date_to and self.request_date_from else 0 self.leave_hours = days * 8 elif self.request_hour_from and self.request_hour_to: - self.leave_hours = float(self.request_hour_to) - float(self.request_hour_from) + start_hour = float(self.request_hour_from) + end_hour = float(self.request_hour_to) + leave_hours = end_hour - start_hour + # 跨中午(12:00-13:00 午休),减去1小时 + if start_hour < 13 and end_hour > 12: + leave_hours -= 1 + self.leave_hours = leave_hours elif self.holiday_status_id.type_of_work == "0": if self.request_hour_from and self.request_hour_to: start_hour = float(self.request_hour_from) @@ -262,7 +268,11 @@ class HrLeave(models.Model): if start_hour == 9 and end_hour == 12: self.leave_hours = 4 else: - self.leave_hours = end_hour - start_hour + leave_hours = end_hour - start_hour + # 跨中午(12:00-13:00 午休),减去1小时 + if start_hour < 13 and end_hour > 12: + leave_hours -= 1 + self.leave_hours = leave_hours else: self.leave_hours = 0