From 52a814e482c696b129ad7622e3d0b722828bfcb4 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: Mon, 2 Mar 2026 10:51:37 +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_holiday/models/inherit_hr_leave.py | 46 +++++++++++++------ .../models/property_lease_renewal.py | 2 +- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/yuthon_holiday/models/inherit_hr_leave.py b/yuthon_holiday/models/inherit_hr_leave.py index 10b2cca1c..6caf3c73b 100644 --- a/yuthon_holiday/models/inherit_hr_leave.py +++ b/yuthon_holiday/models/inherit_hr_leave.py @@ -578,17 +578,28 @@ class HolidaysRequestBatch(models.Model): actual_vacation_report = vacation_report1 if not actual_vacation_report: continue - - existing_overtime_line = self.env['vacation.over.line'].search([ - ('vacation_id', '=', actual_vacation_report.id), + overtime_line_domain = [ ('employee_id', '=', employee_id), ('workflow_record_id', '=', leave_data.get('workflow_id', False)), ('update_type', '=', 'reduce'), ('text', '=', f"请假审批"), ('is_void', '=', False), ('workday', '=', interval_hours), - ], limit=1) - if not existing_overtime_line: + ] + existing_line_in_vacation_report = False + if vacation_report: + existing_line_in_vacation_report = self.env['vacation.over.line'].search( + [('vacation_id', '=', vacation_report.id)] + overtime_line_domain, + limit=1 + ) + existing_line_in_vacation_report1 = False + if vacation_report1: + existing_line_in_vacation_report1 = self.env['vacation.over.line'].search( + [('vacation_id', '=', vacation_report1.id)] + overtime_line_domain, + limit=1 + ) + # 4. 只有当两个报表中都没有该记录时,才创建新记录 + if not existing_line_in_vacation_report and not existing_line_in_vacation_report1: self.env['vacation.over.line'].create({ 'vacation_id': actual_vacation_report.id, 'employee_id': employee_id, @@ -604,6 +615,7 @@ class HolidaysRequestBatch(models.Model): }) actual_vacation_report.update_line() actual_vacation_report._compute_working_overtime() + if self.env.user.company_id.name == '集团本部': domain = [ ('employee_id', '=', employee_id), @@ -696,20 +708,28 @@ class HolidaysRequestBatch(models.Model): if not actual_vacation_report: continue - # 3.3 检查当前月的记录是否已存在(避免重复) - existing_annual_leave_line = self.env['vacation.leave.line'].search([ - ('vacation_id', '=', actual_vacation_report.id), + leave_line_domain = [ ('employee_id', '=', employee_id), ('workflow_record_id', '=', leave_data.get('workflow_id', False)), ('update_type', '=', 'reduce'), ('allocation_type', '=', 'vacation'), - ('update_lines', '=', interval_hours), ('text', '=', f"请假审批"), ('is_void', '=', False), - ], limit=1) - - # 不存在则创建当前月的年假扣减记录 - if not existing_annual_leave_line: + ('update_lines', '=', interval_hours), + ] + existing_line_in_vacation_report = False + if vacation_report: + existing_line_in_vacation_report = self.env['vacation.leave.line'].search( + [('vacation_id', '=', vacation_report.id)] + leave_line_domain, + limit=1 + ) + existing_line_in_vacation_report1 = False + if vacation_report1: + existing_line_in_vacation_report1 = self.env['vacation.leave.line'].search( + [('vacation_id', '=', vacation_report1.id)] + leave_line_domain, + limit=1 + ) + if not existing_line_in_vacation_report and not existing_line_in_vacation_report1: self.env['vacation.leave.line'].create({ 'vacation_id': actual_vacation_report.id, 'employee_id': employee_id, diff --git a/yuthon_property_approval/models/property_lease_renewal.py b/yuthon_property_approval/models/property_lease_renewal.py index 714101ce2..3fafccc02 100644 --- a/yuthon_property_approval/models/property_lease_renewal.py +++ b/yuthon_property_approval/models/property_lease_renewal.py @@ -204,7 +204,7 @@ class PropertyLeaseRenewal(models.Model): 'remark': rec.total_remake, }) if rec.receivables_ids: - refund_lines = rec.receivables_ids.filtered(lambda l: l.refund_amount > 0 and management_type_id.name != '押金') + refund_lines = rec.receivables_ids.filtered(lambda l: l.refund_amount > 0 and l.management_type_id.name != '押金') bills_line_list = [] # 除押金的明细 if refund_lines: