From b13cd6c62698521ea48fa343d4dfe482a35d74ec Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Fri, 3 Jan 2025 14:46:47 +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 --- yuthon_property/models/yuthon_property.py | 8 +------- .../models/property_lease_contract.py | 6 ++++++ .../views/property_lease_contract.xml | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 2a67c61da..7e552271b 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -88,7 +88,7 @@ class YuthonProperty(models.Model): 'management_area':latest_record_id.management_area, 'rent_area': latest_record_id.rent_area, 'admin_id':latest_record_id.admin_id.id, - 'company_id':latest_record_id.company_id, + 'company_id':latest_record_id.company_id.id, }) @api.onchange('property_archives_id') @@ -271,12 +271,6 @@ class YuthonProperty(models.Model): "target": "new", } - # @api.onchange('property_meter_archives_id') - # def _onchange_water_meter_ids(self): - # for rec in self: - # rec.property_meter_archives_id.write({'yuthon_property_id': rec.property_meter_archives_id.id}) - - class TitleInformationLine(models.Model): _name = 'title.information.line' _description = '产权信息明细行' diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 4ec8a1717..80b27975f 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -485,6 +485,12 @@ class PropertyLeaseContract(models.Model): rec.electricity_fee_ids = electricity_list rec.mange_fee_ids = fee_list + def trigger_lease_ids(self): + property_ids = self.env["property.lease.contract"].browse(self._context.get('active_ids', self._context.get('active_id'))) + for record in property_ids: + company_id = record.lease_ids[0].address_id.company_id.id if record.lease_ids else '' + record.company_id = company_id + def action_yuthon_property_contract_wizard(self): return { "type": "ir.actions.act_window", diff --git a/yuthon_property_approval/views/property_lease_contract.xml b/yuthon_property_approval/views/property_lease_contract.xml index 6921d7179..fedbcdc2d 100644 --- a/yuthon_property_approval/views/property_lease_contract.xml +++ b/yuthon_property_approval/views/property_lease_contract.xml @@ -261,4 +261,11 @@ code action = model.action_relevance_property() + + 更新出租方信息 + + + code + action = model.trigger_lease_ids() + \ No newline at end of file