diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py index 7f6e3af28..db11ef6d4 100644 --- a/yuthon_property_approval/models/property_management.py +++ b/yuthon_property_approval/models/property_management.py @@ -112,7 +112,8 @@ class PropertyManagement(models.Model): 'work_end': False, 'version': new_version, 'condition': 'new', - 'code': self.env['ir.sequence'].next_by_code('property_lease_contract_code'), + 'contract_code': lease_contract_ids.contract_code, + 'contract_id': lease_contract_ids.id, 'self_users_ids': [(6, 0, [self.env.user.id])], 'contact_state': 'to', }) @@ -142,6 +143,11 @@ class PropertyManagement(models.Model): ]) for line in other_lines: line.copy({'other_id': new_contract.id}) + breakdown_lines = self.env['property.rent.breakdown.line'].search([ + ('breakdown_id', '=', lease_contract.lease_id.id) + ]) + for line in breakdown_lines: + line.copy({'breakdown_id': new_contract.id}) # 复制子合同明细 subset_lines = self.env['property.subset.contract'].search([ ('subset_id', '=', lease_contract.lease_id.id) @@ -153,14 +159,11 @@ class PropertyManagement(models.Model): ]) for line in lease_lines: line.copy({'lease_id': new_contract.id}) - lease_contract.lease_id.term_end_time = record.start_time - relativedelta(days=1) lease_contract.lease_id.actual_end_time = record.start_time - relativedelta(days=1) new_contract.term_start_time = record.start_time new_contract.actual_start_time = record.start_time new_contract._compute_name() - new_contract._onchange_contract_sort() new_contract._update_wkf_records() - new_contract._onchange_action_generate_details() existing_info = self.env['manage.information.line'].search([ ('yuthon_property_id', '=', target_property_id),