!6965 添加功能

Merge pull request !6965 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-12-10 10:47:02 +00:00
committed by Gitee
2 changed files with 29 additions and 8 deletions
+28 -7
View File
@@ -34,6 +34,7 @@ class YuthonProperty(models.Model):
properties = self.search(domain, limit=100)
result = []
if partner_id:
admin_properties = self.env['yuthon.property'].search([
('precinct_id', '=', partner_id),
@@ -43,20 +44,41 @@ class YuthonProperty(models.Model):
prop.rent_area for prop in admin_properties
if prop.property_state == 'on_rent' and prop.rent_area
)
# 统计管理员下所有空置面积
total_vacant_area = sum(
prop.rent_area for prop in admin_properties
if prop.property_state == 'vacant' and prop.rent_area
)
if total_rentable_area > 0:
rental_rate = round(((total_rentable_area - total_vacant_area) / total_rentable_area) * 100, 2)
else:
rental_rate = 0.0
admin_contracts = self.env['property.lease.contract'].search([
('precinct_id', '=', partner_id),
('contact_state', '=', 'ing')
])
if admin_contracts:
receivable_domain = [
('contract_id', 'in', admin_contracts.ids),
]
if params.get("date_end"):
date_end = datetime.datetime.fromisoformat(params.get("date_end")).date()
receivable_domain.append(('due_date', '<=', date_end))
receivable_records = self.env['property.accounts.receivable'].search(receivable_domain)
if receivable_records:
total_delivered = sum(rec.delivered1 for rec in receivable_records) # 已交金额
total_amount = sum(rec.original_amount for rec in receivable_records) # 当期金额
if total_amount > 0:
collection_rate = round((total_delivered / total_amount) * 100, 2)
else:
collection_rate = 0.0
else:
collection_rate = 0.0
else:
collection_rate = 0.0
else:
rental_rate = 0.0
collection_rate = 0.0
for p in properties:
if params.get("date_end"):
@@ -67,7 +89,6 @@ class YuthonProperty(models.Model):
)
else:
valid_info = p.manage_information_ids[-1]
management_area = valid_info.management_area if valid_info else 0
rent_area = valid_info.rent_area if valid_info else 0
lease_id = self.env['property.lease.contract.line'].search([
@@ -92,8 +113,8 @@ class YuthonProperty(models.Model):
"管理面积": management_area or 0.0,
"可租面积": rent_area or 0.0,
"已租面积": leased_area or 0.0,
"出租率": rental_rate or "",
"收费率": p.precinct_id.name if (p.precinct_id) else "",
"出租率": rental_rate ,
"收费率": collection_rate,
"所属公司": contract_id.lessor_id.referred if contract_id else "",
"租赁状态": "在租" if p.property_state == 'on_rent' else "空置" if p.property_state == 'vacant' else "",
"合同编号": contract_id.contract_code if contract_id else "",
+1 -1
View File
@@ -21,11 +21,11 @@
{"headerName": "出租率", "field": "出租率", "flex": 1},
{"headerName": "收费率", "field": "收费率", "flex": 1},
{"headerName": "租赁状态", "field": "租赁状态", "flex": 1},
{"headerName": "所属公司", "field": "所属公司", "flex": 1},
{"headerName": "合同编号", "field": "合同编号", "flex": 1},
{"headerName": "承租方", "field": "承租方", "flex": 1},
{"headerName": "单价", "field": "单价", "flex": 1},
{"headerName": "租金", "field": "租金", "flex": 1},
{"headerName": "所属公司", "field": "所属公司", "flex": 1},
{"headerName": "管理员", "field": "管理员", "flex": 1}
]
}