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 @@ + + + + + + + + + + + + + + + + + + + +