From d114d5d0502fc483e6eb583696c7160bc5062eed Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Fri, 3 Jan 2025 15:36:00 +0800 Subject: [PATCH 1/2] =?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 | 7 +++++++ yuthon_property/views/yuthon_property_views.xml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py index 6b3770bad..b85757290 100644 --- a/yuthon_property/models/yuthon_property.py +++ b/yuthon_property/models/yuthon_property.py @@ -274,6 +274,13 @@ class YuthonProperty(models.Model): "target": "new", } + def trigger_company_id(self): + property_ids = self.env["yuthon.property"].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 + class YuthonPropertyWater(models.Model): _name = 'yuthon.property.water' _description = '水表' diff --git a/yuthon_property/views/yuthon_property_views.xml b/yuthon_property/views/yuthon_property_views.xml index e2cea7cab..2bc469a52 100644 --- a/yuthon_property/views/yuthon_property_views.xml +++ b/yuthon_property/views/yuthon_property_views.xml @@ -357,4 +357,11 @@ code action = model.action_yuthon_property_wizard() + + 更新公司 + + + code + action = model.trigger_company_id() + \ No newline at end of file From 895388f7a249e5577778fad9a74e540b8e4d7d7b Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Fri, 3 Jan 2025 15:40:36 +0800 Subject: [PATCH 2/2] =?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_approval/models/property_lease_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index 6b53ad469..17c702e0f 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -488,7 +488,7 @@ class PropertyLeaseContract(models.Model): 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 + record.write({'company_id': company_id}) def action_yuthon_property_contract_wizard(self): return {