添加功能
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -350,6 +350,26 @@
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="承租方变更明细">
|
||||
<field name="lessee_line">
|
||||
<tree editable="bottom">
|
||||
<field name="contract_id" column_invisible="1"/>
|
||||
<field name="lessee_id" options="{'no_open': True}"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page string="出租方变更明细">
|
||||
<field name="lessor_line">
|
||||
<tree editable="bottom">
|
||||
<field name="contract_id" column_invisible="1"/>
|
||||
<field name="lessor_id" options="{'no_open': True}"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="4">
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user