From 9bb95d145d0e410e2ec9f5d4367d4fcc8902ecd5 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: Tue, 11 Nov 2025 11:29:22 +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 --- .../wizard/binding_information_wizard.py | 22 ++----------------- .../binding_information_wizard_views.xml | 5 ++--- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/yuthon_property_approval/wizard/binding_information_wizard.py b/yuthon_property_approval/wizard/binding_information_wizard.py index d4b017603..9ee1d09f8 100644 --- a/yuthon_property_approval/wizard/binding_information_wizard.py +++ b/yuthon_property_approval/wizard/binding_information_wizard.py @@ -11,23 +11,12 @@ class BindingInformationWizard(models.Model): contract_ids = fields.Many2many('property.lease.contract',string="租赁合同审批") lessee_ids = fields.Many2many('property.tenant.information', string="承租方") your_own_unit = fields.Char(string="账号单位") - available_property_ids = fields.Many2many( - 'yuthon.property', - 'binding_information_wizard_available_property_rel', - 'wizard_id', - 'property_id', - compute='_compute_available_records', - string='可用物业ID', - store=True - ) available_contract_ids = fields.Many2many( 'property.lease.contract', 'binding_information_wizard_available_contract_rel', 'wizard_id', 'contract_id', - compute='_compute_available_records', string='可用合同ID', - store=True ) @api.onchange('contract_ids') @@ -48,16 +37,9 @@ class BindingInformationWizard(models.Model): @api.onchange('bank_id') def _onchange_bank_id(self): - """计算可用的物业和合同ID""" + """计算不可用的合同ID""" for record in self: - # 搜索未对账的应收记录 - unreconciled_records = self.env['property.accounts.receivable'].search([ - ('is_reconciliation', '=', False) - ]) - contract_ids = list(set(record.contract_id.id for record in unreconciled_records if record.contract_id)) - - # 设置计算字段值 - record.available_contract_ids = [(6, 0, contract_ids)] if contract_ids else [(5,)] + record.available_contract_ids = [(6, 0, self.bank_id.contract_ids.ids)] if self.bank_id.contract_ids else [(5,)] def confirm(self): if self.bank_id.name: diff --git a/yuthon_property_approval/wizard/binding_information_wizard_views.xml b/yuthon_property_approval/wizard/binding_information_wizard_views.xml index b334dae9c..5d0c0da22 100644 --- a/yuthon_property_approval/wizard/binding_information_wizard_views.xml +++ b/yuthon_property_approval/wizard/binding_information_wizard_views.xml @@ -8,12 +8,11 @@ - - - + +