添加功能
This commit is contained in:
@@ -14,27 +14,17 @@ class PropertyTenantInformation(models.Model):
|
||||
tenant_ids = self.env["property.tenant.information"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for record in tenant_ids:
|
||||
if record.property_contract_ids:
|
||||
for contract in record.property_contract_ids:
|
||||
if not contract.lease_contract_id:
|
||||
contract.unlink()
|
||||
contract_ids = self.env["property.lease.contract"].search([
|
||||
('lessee_id', '=', record.id)
|
||||
])
|
||||
for contract in contract_ids:
|
||||
existing_line = self.env['property.tenant.line'].search([
|
||||
('tenant_id', '=', record.id),
|
||||
('lease_contract_id', '=', contract.id)
|
||||
], limit=1)
|
||||
if not existing_line:
|
||||
self.env['property.tenant.line'].create({
|
||||
'tenant_id': record.id,
|
||||
'lease_contract_id': contract.id,
|
||||
})
|
||||
|
||||
# record.property_contract_ids.write({'property_contract_ids': [(5, 0, 0)]})
|
||||
# property_contract_list = []
|
||||
# contract_ids = self.env["property.lease.contract"].search([('lessee_id', '=', record.id)])
|
||||
# for contract_id in contract_ids:
|
||||
# property_ids = []
|
||||
# if contract_id.lease_ids:
|
||||
# for lease_id in contract_id.lease_ids:
|
||||
# if lease_id.address_id:
|
||||
# address_id = lease_id.address_id.id
|
||||
# else:
|
||||
# continue
|
||||
# property_ids.append(address_id)
|
||||
# property_contract_list.append([0, 0,{
|
||||
# 'tenant_id': record.id,
|
||||
# 'lease_contract_id': contract_id.id,
|
||||
# 'property_ids': [(6, 0, property_ids)],
|
||||
# 'rent': contract_id.rent,
|
||||
# }])
|
||||
# record.write({'property_contract_ids': property_contract_list})
|
||||
|
||||
Reference in New Issue
Block a user