From 30821e3980089098c2dfee2287bcbff46132901f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= <9664676+pengyuthon@user.noreply.gitee.com> Date: Wed, 10 Sep 2025 18:50:58 +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 --- .../models/property_lease_contract.py | 15 ++++++++++++++- .../wizard/choose_property_wizard.py | 8 -------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/yuthon_property_approval/models/property_lease_contract.py b/yuthon_property_approval/models/property_lease_contract.py index c69054d9b..332c8c956 100644 --- a/yuthon_property_approval/models/property_lease_contract.py +++ b/yuthon_property_approval/models/property_lease_contract.py @@ -216,11 +216,24 @@ class PropertyLeaseContract(models.Model): responsibility_book_name = fields.Char(string="安全生产责任书(住宅)名称", compute='_compute_attachment_names', store=True) self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])]) - title_information = fields.Text(string="产权证信息") + title_information = fields.Text(string="产权证信息", compute='_compute_title_information') contract_count = fields.Integer(string="联系人数量", compute='_compute_contract_count') reconciliation_count = fields.Integer(string="对账数量", compute='_compute_reconciliation_count') process_count = fields.Integer(string="流程数量", compute='_compute_process_count') + @api.depends('lease_ids.address_id.title_deed') + def _compute_title_information(self): + for record in self: + seen_titles = set() + unique_titles = [] + for lease in record.lease_ids: + if lease.address_id and lease.address_id.title_deed: + title = lease.address_id.title_deed.strip() + if title and title not in seen_titles: + seen_titles.add(title) + unique_titles.append(title) + record.title_information = ', '.join(unique_titles) + def contract_signature(self): return { 'type': 'ir.actions.act_window', diff --git a/yuthon_property_approval/wizard/choose_property_wizard.py b/yuthon_property_approval/wizard/choose_property_wizard.py index 2bd4822c4..bd01efa76 100644 --- a/yuthon_property_approval/wizard/choose_property_wizard.py +++ b/yuthon_property_approval/wizard/choose_property_wizard.py @@ -66,12 +66,6 @@ class ChoosePropertyWizard(models.Model): name_val = lease.address_id.name existing_names.append(name_val if name_val is not None else "无") - information_names = [] - for lease in self.lease_contract_id.lease_ids: - if lease.address_id and lease.address_id.title_deed != '无产权': - deed_val = lease.address_id.title_deed - information_names.append(str(deed_val) if deed_val is not None else "无") - title_name = [] for lease in self.lease_contract_id.lease_ids: if lease.address_id: @@ -80,7 +74,6 @@ class ChoosePropertyWizard(models.Model): # 过滤空字符串,避免拼接时出现空内容 all_names = [name for name in list(set(existing_names + lease_name)) if name] - title_information = [info for info in list(set(information_names + title_deed))] title_address_combined = [addr for addr in list(set(title_address + title_name)) if addr] existing_lease_ids = [(4, lease.id) for lease in self.lease_contract_id.lease_ids] @@ -94,7 +87,6 @@ class ChoosePropertyWizard(models.Model): if self.lease_contract_id.lease_ids else False, 'use_address': ','.join(all_names), 'address_for_delivery': ','.join(all_names), - 'title_information': ','.join(title_information), 'total_area': sum([lease.property_area for lease in rec.lease_ids]) })