From fdbbecfa19177f5baaed342499259f3958e8ada2 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: Wed, 18 Mar 2026 16:07:29 +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 --- .../models/inherit_yuthon_property.py | 10 +++++++++- .../views/property_lease_contract.xml | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index df6519fd6..046905ad5 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -215,7 +215,7 @@ class PropertyBankStatements(models.Model): if record.lessee_ids: contract_set = self.env['property.lease.contract'] # 获取当前记录的日期(用于判断出租方变更行的生效期) - target_date = (record.start_time - timedelta(hours=8)).date() if record.start_time else fields.Date.today() + target_date = record.start_time.date() if record.start_time else fields.Date.today() for lessee in record.lessee_ids: # 从承租方的租户行提取合同 @@ -227,6 +227,14 @@ class PropertyBankStatements(models.Model): contract = tenant_line.lease_contract_id if not contract: continue + + is_contract_valid = False + if contract.actual_start_time and contract.actual_start_time <= target_date: + if not contract.actual_end_time or contract.actual_end_time >= target_date: + is_contract_valid = True + + if not is_contract_valid: + continue # 1. 筛选合同的出租方变更行:生效日期≤目标日期,失效日期≥目标日期/未设置 valid_lessor_lines = contract.lessor_line.filtered( lambda l: diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index ebff9e4d7..323df4638 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -350,6 +350,26 @@ + + + + + + + + + + + + + + + + + + + +