@@ -66,13 +66,18 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>原承租方</strong></td>
|
||||
<td><span t-esc="doc.lessee_id.name or doc.display_name or ''"/></td>
|
||||
<td><span t-esc="doc.display_name or ''"/></td>
|
||||
<td class="header-cell"><strong>租赁合同</strong></td>
|
||||
<td><span t-esc="doc.contract_id.name or ''"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="header-cell"><strong>租金支付周期</strong></td>
|
||||
<td><span t-esc="doc.cycle_dict or ''"/></td>
|
||||
<td>
|
||||
<t t-if="doc.cycle_dict == 'monthly'">月度</t>
|
||||
<t t-elif="doc.cycle_dict == 'quarter'">季度</t>
|
||||
<t t-elif="doc.cycle_dict == 'half'">半年</t>
|
||||
<t t-elif="doc.cycle_dict == 'year'">年度</t>
|
||||
</td>
|
||||
<td class="header-cell"><strong>租金</strong></td>
|
||||
<td><span t-esc="'%.2f' % doc.monthly_rent if doc.monthly_rent else '0.00'"/></td>
|
||||
</tr>
|
||||
|
||||
@@ -9,10 +9,15 @@ class TotalReceivedReport(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_total_received_report(self, params):
|
||||
"""实收总额:查询月当月,应收类型不为押金和违约金的已对金额"""
|
||||
domain = [('reconciliation_date', '!=', False)]
|
||||
"""本月实收总额 = 归属本月实收 + 本月预收
|
||||
取数逻辑:收款日期(reconciliation_date)在查询月内的所有收款记录,金额取 amount
|
||||
"""
|
||||
domain = [
|
||||
('reconciliation_date', '!=', False),
|
||||
('receivable_id.is_invalid', '=', False),
|
||||
]
|
||||
|
||||
# 单月日期过滤
|
||||
# 收款日期在查询月内
|
||||
if params.get('date_start'):
|
||||
query_date = datetime.datetime.fromisoformat(params['date_start']).date()
|
||||
month_start = query_date.replace(day=1)
|
||||
@@ -23,11 +28,6 @@ class TotalReceivedReport(models.Model):
|
||||
('reconciliation_date', '<=', month_end),
|
||||
]
|
||||
|
||||
# 排除押金和违约金
|
||||
domain += [
|
||||
('receivable_id.management_type_id.name', 'not in', ['押金', '违约金']),
|
||||
]
|
||||
|
||||
if params.get('keyword'):
|
||||
keyword = params['keyword']
|
||||
domain += ['|', '|',
|
||||
@@ -40,6 +40,9 @@ class TotalReceivedReport(models.Model):
|
||||
partner_id = params.get('partner_id')
|
||||
company_id = params.get('company_id')
|
||||
management_type_id = params.get('management_type_id')
|
||||
property_id = params.get('property_id')
|
||||
lessee_id = params.get('lessee_id')
|
||||
contract_id = params.get('contract_id')
|
||||
|
||||
if condition:
|
||||
domain.append(('receivable_id.tenure_type', '=', condition))
|
||||
@@ -49,6 +52,12 @@ class TotalReceivedReport(models.Model):
|
||||
domain.append(('receivable_id.company_id', '=', company_id))
|
||||
if management_type_id:
|
||||
domain.append(('receivable_id.management_type_id', '=', management_type_id))
|
||||
if property_id:
|
||||
domain.append(('receivable_id.property_ids', 'in', [property_id]))
|
||||
if lessee_id:
|
||||
domain.append(('receivable_id.lessee_id', '=', lessee_id))
|
||||
if contract_id:
|
||||
domain.append(('receivable_id.contract_id', '=', contract_id))
|
||||
|
||||
lines = self.search(domain, order='reconciliation_date asc')
|
||||
|
||||
@@ -57,7 +66,7 @@ class TotalReceivedReport(models.Model):
|
||||
for idx, line in enumerate(lines, start=1):
|
||||
rec = line.receivable_id
|
||||
contract = rec.contract_id if rec else None
|
||||
amount = round(line.original_amount or 0.0, 2)
|
||||
amount = round(line.amount or 0.0, 2)
|
||||
total_amount += amount
|
||||
|
||||
# 物业穿透
|
||||
@@ -98,11 +107,11 @@ class TotalReceivedReport(models.Model):
|
||||
'收款类型': rec.management_type_id.name if rec and rec.management_type_id else '',
|
||||
'金额': amount,
|
||||
'所属公司': contract.lessor_id.name if contract and contract.lessor_id else '',
|
||||
"管理员": {
|
||||
'管理员': {
|
||||
'model': 'res.users',
|
||||
'id': rec.admin_id.id,
|
||||
'display_name': rec.admin_id.name,
|
||||
} if rec.admin_id else "",
|
||||
} if rec.admin_id else '',
|
||||
})
|
||||
|
||||
stats = [{'name': '合计', 'amount': round(total_amount, 2)}]
|
||||
|
||||
Reference in New Issue
Block a user