From b3954ac3c22302289907630b7b1c0428f4f8563a 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: Tue, 28 Apr 2026 15:23:02 +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/property_lease_contract.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index f9bda6188..8a37c3cdd 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -2524,19 +2524,11 @@ class PropertyLeaseContractLine(models.Model): @api.depends('address_id', 'address_id.manage_information_ids') def _compute_property_area(self): - today = fields.Date.today() for line in self: - rent_area = 0.0 - if line.address_id: - valid_lines = line.address_id.manage_information_ids.filtered( - lambda r: - r.start_time <= today - and (not r.end_date or r.end_date >= today) - ) - if valid_lines: - rent_area = valid_lines[0].rent_area - line.property_area = rent_area - + line.property_area = 0.0 + if line.address_id and line.address_id.manage_information_ids: + latest_line = line.address_id.manage_information_ids.sorted('id', reverse=True)[0] + line.property_area = latest_line.rent_area def open_record(self): self.ensure_one()