添加功能
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="bank_id" invisible="1"/>
|
||||
<field name="available_property_ids" widget="many2many_tags" invisible="1"/>
|
||||
<field name="lessee_ids" widget="many2many_tags" readonly="1"/>
|
||||
<field name="available_contract_ids" widget="many2many_tags" invisible="1"/>
|
||||
<field name="your_own_unit" invisible="1"/>
|
||||
<field name="property_ids" widget="many2many_tags" domain="[('id', 'in', available_property_ids)]" options="{'no_create': True}"/>
|
||||
<field name="contract_ids" widget="many2many_tags" domain="[('lessee_id', 'in', lessee_ids), ('lessor_id.referred', '=', your_own_unit), ('is_split', '=', False), ('id', 'in', available_contract_ids)]" options="{'no_create': True}"/>
|
||||
<field name="property_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||
<field name="contract_ids" widget="many2many_tags" domain="[('lessor_id.referred', '=', your_own_unit), ('is_split', '=', False), ('id', 'not in', available_contract_ids)]" options="{'no_create': True}"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user