From 31989ca2ec29bf397c4a832d6bebcaa8f10db3a8 Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Sun, 26 Oct 2025 23:31:11 +0800 Subject: [PATCH] 1 --- yuthon_property_approval/models/inherit_yuthon_property.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yuthon_property_approval/models/inherit_yuthon_property.py b/yuthon_property_approval/models/inherit_yuthon_property.py index 2707009e3..0fba68d05 100644 --- a/yuthon_property_approval/models/inherit_yuthon_property.py +++ b/yuthon_property_approval/models/inherit_yuthon_property.py @@ -208,8 +208,9 @@ class PropertyBankStatements(models.Model): bank_ids = self.env["property.bank.statements"].browse(self._context.get('active_ids', self._context.get('active_id'))) for property in bank_ids: for pro in property.property_ids: - property.write({'contract_ids': [(4, pro.property_contract_ids.lease_contract_id.id)]}) - property.write({'lessee_ids': [(4, pro.property_contract_ids.lessee_id.id)]}) + if pro.property_contract_ids: + property.write({'contract_ids': [(4, pro.property_contract_ids[-1].lease_contract_id.id)]}) + property.write({'lessee_ids': [(4, pro.property_contract_ids[-1].lessee_id.id)]}) def revocation(self): self.ensure_one()