From 4f7fd4f209cb10e0de0fc9c817928be995dc8c2e 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: Mon, 16 Mar 2026 12:00:50 +0800 Subject: [PATCH 1/2] =?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/models/yuthon_property.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 9fb1042b3..ab1762419 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -108,6 +108,7 @@ class YuthonProperty(models.Model): for prop in rentable_properties: contract_lines = self.env['property.lease.contract.line'].search([ ('address_id', '=', prop.id), + ('lease_id.is_contract', '=', False), ]) if contract_lines: sorted_lines = sorted( From 44ca37e51b5bd57b8c2df10a2f4cba67be26491c 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: Mon, 16 Mar 2026 12:06:23 +0800 Subject: [PATCH 2/2] =?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/models/yuthon_property.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index ab1762419..056e5db48 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -113,7 +113,7 @@ class YuthonProperty(models.Model): if contract_lines: sorted_lines = sorted( contract_lines, - key=lambda line: line.lease_id.actual_end_time, + key=lambda line: line.lease_id.actual_end_time or date.max, reverse=True ) lease_id = sorted_lines[0]