From 39d334c308b50107e84f4dc9946f34ebbb385e52 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, 9 Sep 2026 16:40:56 +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_property_approval/models/property_lease_contract.py | 3 ++- yuthon_property_approval/models/property_lease_renewal.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 3af605cfc..e0bcf37a2 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -977,7 +977,8 @@ class PropertyLeaseContract(models.Model): bank_accounts = self.env['property.bank.line'].search([ ('tenant_id', '=', self.lessee_id.id) ]).mapped('bank') - bank_accounts = [acc for acc in bank_accounts if acc][0] + filtered_accounts = [acc for acc in bank_accounts if acc] + bank_accounts = filtered_accounts[0] if filtered_accounts else None end_date = self.contract_id.actual_end_time + timedelta(days=1) start_time = f"{end_date} 09:00:00" bank_id = self.env['property.bank.statements'].sudo().create({ diff --git a/yuthon_property_approval/models/property_lease_renewal.py b/yuthon_property_approval/models/property_lease_renewal.py index 464fa35ff..e6fa40c7f 100644 --- a/yuthon_property_approval/models/property_lease_renewal.py +++ b/yuthon_property_approval/models/property_lease_renewal.py @@ -294,7 +294,8 @@ class PropertyLeaseRenewal(models.Model): bank_accounts = self.env['property.bank.line'].search([ ('tenant_id', '=', rec.lessee_id.id) ]).mapped('bank') - bank_accounts = [acc for acc in bank_accounts if acc][0] + filtered_accounts = [acc for acc in bank_accounts if acc] + bank_accounts = filtered_accounts[0] if filtered_accounts else None rec.contract_id.write({ 'actual_end_time': rec.early_quitting_date }) @@ -372,7 +373,8 @@ class PropertyLeaseRenewal(models.Model): bank_accounts = self.env['property.bank.line'].search([ ('tenant_id', '=', rec.lessee_id.id) ]).mapped('bank') - bank_accounts = [acc for acc in bank_accounts if acc][0] + filtered_accounts = [acc for acc in bank_accounts if acc] + bank_accounts = filtered_accounts[0] if filtered_accounts else None rec.contract_id.write({ 'actual_end_time': rec.early_quitting_date })