diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index fa44205b1..722524ee0 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -456,6 +456,8 @@ class PropertyLeaseContract(models.Model): record.name = self._description def update_property(self): + existing_lines = self.env['property.contract.line'].search([]) + existing_lines.unlink() contract_ids = self.env["property.lease.contract"].browse( self._context.get('active_ids', self._context.get('active_id'))) for contract_id in contract_ids: diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index be1c5a0c4..1746f7019 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -896,13 +896,13 @@ code action = model.trigger_lease_ids() - - - - - - - + + 关联物业 + + + code + action = model.update_property() + 管理员强制结束