diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 65f2d12c1..60055f928 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -643,17 +643,16 @@ class PropertyLeaseContract(models.Model): 'rent_list_ids': rent_list, 'management_list_ids':management_list,}) - - - - def action_copy_record(self): - for record in self: - vals = record.read()[0] - vals['state'] = 'new' - vals.pop('id', None) - new_record = self.create(vals) - - + def disposable_button(self): + property_ids = self.env["property.lease.contract"].browse( + self._context.get('active_ids', self._context.get('active_id'))) + for record in property_ids: + admin_id = record.admin_id + user_id = record.users_id + if admin_id and user_id: + record.write({ + 'admin_id': user_id.id, + 'users_id': admin_id.id,}) class PropertyLeaseContractLine(models.Model): _name = 'property.lease.contract.line' diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 84c46db64..67f9da858 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -55,7 +55,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -311,4 +311,11 @@ code action = model.action_use_address() + + 调换 + + + code + action = model.disposable_button() + \ No newline at end of file