From 1637e940a7813cfa2c1c5abc5f504c27b75ea4fe 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, 4 Nov 2025 16:18:23 +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/processing_order_approval.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/yuthon_maintain/models/processing_order_approval.py b/yuthon_maintain/models/processing_order_approval.py index 0cae16270..c9769981c 100644 --- a/yuthon_maintain/models/processing_order_approval.py +++ b/yuthon_maintain/models/processing_order_approval.py @@ -70,11 +70,15 @@ class ProcessingOrderApproval(models.Model): @api.depends('property_id') def _compute_contract_id(self): - if self.property_id: - contract_id = self.env["property.lease.contract.line"].search([('address_id', '=', self.property_id.id)], limit=1) - else: - contract_id = False - self.contract_id = contract_id.lease_id.id + for record in self: + if record.property_id: + contract_id = self.env["property.lease.contract.line"].search( + [('address_id', '=', record.property_id.id)], + limit=1 + ) + else: + contract_id = False + record.contract_id = contract_id.lease_id.id if contract_id else False @api.depends("company_id") def _compute_name(self):