From 77c95afeb4630507b0ef2c32af6e6a7451fcdbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=B9=8F=E5=AE=87?= Date: Mon, 22 Jun 2026 11:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yuthon_report/models/receivable_report.py | 20 +++++++++++++++----- yuthon_report/models/yuthon_dashboard.py | 11 +++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/yuthon_report/models/receivable_report.py b/yuthon_report/models/receivable_report.py index 1377fb648..6167ec3cf 100644 --- a/yuthon_report/models/receivable_report.py +++ b/yuthon_report/models/receivable_report.py @@ -7,8 +7,8 @@ from .report_utils import _id_list # 导入工具函数:将参数转换为列 class YuthonProperty(models.Model): _inherit = 'property.accounts.receivable' - # 固定费用类型列(用于报表横向展示) - FEE_COLUMNS = ['租金', '管理费', '水费', '电费', '违约金', '其他费用'] + # 固定费用类型列(用于报表横向展示,不含违约金) + FEE_COLUMNS = ['租金', '管理费', '水费', '电费', '其他费用'] def _get_tax_rate_display(self, rec): """从合同获取税率显示字符串""" @@ -34,7 +34,7 @@ class YuthonProperty(models.Model): elif '电' in type_name: return '电费' elif '违约' in type_name: - return '违约金' + return None # 违约金不统计,归类为 None 直接跳过 else: return '其他费用' @@ -97,8 +97,15 @@ class YuthonProperty(models.Model): for rec in data['recs']: type_name = rec.management_type_id.name if rec.management_type_id else '' col = self._classify_fee_type(type_name) + if col is None: + # 违约金不统计,跳过 + continue total_fees[col] += (rec.original_amount or 0.0) - (rec.discount_amount or 0.0) - subtotal = sum((rec.original_amount or 0.0) - (rec.discount_amount or 0.0) for rec in data['recs']) + subtotal = sum( + (rec.original_amount or 0.0) - (rec.discount_amount or 0.0) + for rec in data['recs'] + if self._classify_fee_type(rec.management_type_id.name if rec.management_type_id else '') is not None + ) total_subtotal += subtotal summary_stats = [] for col in self.FEE_COLUMNS: @@ -110,10 +117,13 @@ class YuthonProperty(models.Model): info_rec = data['info_rec'] fee_row = {col: 0.0 for col in self.FEE_COLUMNS} - # 归类费用 + # 归类费用(违约金归类为 None,跳过不统计) for rec in data['recs']: type_name = rec.management_type_id.name if rec.management_type_id else '' col = self._classify_fee_type(type_name) + if col is None: + # 违约金不统计,跳过 + continue fee_row[col] += (rec.original_amount or 0.0) - (rec.discount_amount or 0.0) subtotal = sum(fee_row.values()) diff --git a/yuthon_report/models/yuthon_dashboard.py b/yuthon_report/models/yuthon_dashboard.py index 19d4a4e86..13439fbf3 100644 --- a/yuthon_report/models/yuthon_dashboard.py +++ b/yuthon_report/models/yuthon_dashboard.py @@ -84,15 +84,15 @@ class YuthonDashboard(models.Model): # ==================== 一、经营收入板块 ==================== # 当期应收(合同应收):receivable_report.py 的 get_complete_ledger_report - # stats: [租金, 管理费, 水费, 电费, 违约金, 其他费用, 小计合计] → 取 index 6 + # stats: [租金, 管理费, 水费, 电费, 其他费用, 小计合计] → 取 index 5(违约金已移除) # 注意:该报表使用 ReceivableReport 组件,默认 dateMode="range"(全月范围) - current_receivable = safe_get('property.accounts.receivable', 'get_complete_ledger_report', 6, overrides=range_params) + current_receivable = safe_get('property.accounts.receivable', 'get_complete_ledger_report', 5, overrides=range_params) # 前期欠收 pre_arrears = safe_get('receivable.modify.line', 'get_pre_arrears_report', 1) # 前期预收 pre_advance = safe_get('receivable.modify.line', 'get_pre_advance_report', 1) - # 本月应收 - month_receivable = safe_get('receivable.modify.line', 'get_month_receivable_report', 0) + # 本月应收 = 当期应收 + 前期欠收 - 前期预收(仅展示,不跳转) + month_receivable = current_receivable + pre_arrears - pre_advance # 实收总额 total_received = safe_get('receivable.modify.line', 'get_total_received_report', 0) # 归属本月 @@ -188,8 +188,7 @@ class YuthonDashboard(models.Model): 'action': 'yuthon_report.action_pre_arrears_report', 'action_context': make_ctx()}, {'label': '前期预收', 'value': pre_advance, 'is_negative': False, 'action': 'yuthon_report.action_pre_advance_report', 'action_context': make_ctx()}, - {'label': '本月应收', 'value': month_receivable, 'is_negative': False, - 'action': 'yuthon_report.action_month_receivable_report', 'action_context': make_ctx()}, + {'label': '本月应收', 'value': month_receivable, 'is_negative': False}, {'label': '实收总额', 'value': total_received, 'is_negative': False, 'action': 'yuthon_report.action_total_received_report', 'action_context': make_ctx()}, {'label': '归属本月', 'value': current_month_received, 'is_negative': False,