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):