添加功能
This commit is contained in:
@@ -143,18 +143,21 @@ class PropertyBankStatements(models.Model):
|
||||
contract_ids = fields.Many2many('property.lease.contract', string="租赁合同审批")
|
||||
property_name = fields.Text(string="物业名称", compute="compute_property_name", store=True)
|
||||
accounts_id = fields.Many2one('property.accounts.approval', string="关联生成应收审批单")
|
||||
lessee_id = fields.Many2one('property.tenant.information', string='承租方', compute="_compute_property_employee_id")
|
||||
lessee_ids = fields.Many2many('property.tenant.information', string='承租方', compute="_compute_property_employee_id")
|
||||
admin_id = fields.Many2one('res.users', string="片区管理员", compute="_compute_property_employee_id", store=True, index=True)
|
||||
|
||||
@api.depends('contract_ids')
|
||||
def _compute_property_employee_id(self):
|
||||
for emp in self:
|
||||
if emp.contract_ids:
|
||||
emp.admin_id = emp.contract_ids[0].admin_id.id
|
||||
emp.lessee_id = emp.contract_ids[0].lessee_id.id
|
||||
else:
|
||||
emp.admin_id = False
|
||||
emp.lessee_id = False
|
||||
for record in self:
|
||||
lessee_set = set()
|
||||
if record.contract_ids:
|
||||
for contract in record.contract_ids:
|
||||
if contract.lessee_id:
|
||||
lessee_set.add(contract.lessee_id.id)
|
||||
record.admin_id = record.contract_ids[0].admin_id.id if record.contract_ids[0].admin_id else False
|
||||
record.lessee_ids = [(6, 0, list(lessee_set))] if lessee_set else [(5, 0, 0)]
|
||||
|
||||
|
||||
|
||||
def update_property_name(self):
|
||||
property_ids = self.env["property.bank.statements"].browse(
|
||||
|
||||
@@ -628,7 +628,7 @@
|
||||
</header>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name_account']" position="after">
|
||||
<field name="lessee_id"/>
|
||||
<field name="lessee_ids" widget="many2many_tags" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='property_ids']" position="before">
|
||||
<field name="contract_ids" string="合同编号" widget="many2many_tags" readonly="1" domain="[('lessor_id.name', '=', your_own_unit)]" context="{'open_form_view': 'yuthon_property_approval.view_property_lease_contract_tree1'}"/>
|
||||
|
||||
Reference in New Issue
Block a user