From a9a47f85267162004582e1e8db711f1084fb5d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 3 Aug 2020 19:32:41 +0800 Subject: [PATCH] Fixed the error not setting the label correctly in the cash account summary and ledger summary in the accounting application. --- accounting/views.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/accounting/views.py b/accounting/views.py index f5763d1..10bb9ea 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -241,13 +241,14 @@ def cash_summary(request, account): for month in months: cumulative_balance = cumulative_balance + month.balance month.cumulative_balance = cumulative_balance - months.append(RecordSummary( - label=pgettext("Accounting|", "Total"), + total = RecordSummary( credit=sum([x.credit for x in months]), debit=sum([x.debit for x in months]), balance=sum([x.balance for x in months]), cumulative_balance=cumulative_balance, - )) + ) + total.label = pgettext("Accounting|", "Total") + months.append(total) pagination = Pagination(request, months, True) shortcut_accounts = settings.ACCOUNTING["CASH_SHORTCUT_ACCOUNTS"] return render(request, "accounting/cash-summary.html", { @@ -383,13 +384,14 @@ def ledger_summary(request, account): for month in months: cumulative_balance = cumulative_balance + month.balance month.cumulative_balance = cumulative_balance - months.append(RecordSummary( - label=pgettext("Accounting|", "Total"), + total = RecordSummary( credit=sum([x.credit for x in months]), debit=sum([x.debit for x in months]), balance=sum([x.balance for x in months]), cumulative_balance=cumulative_balance, - )) + ) + total.label = pgettext("Accounting|", "Total") + months.append(total) pagination = Pagination(request, months, True) return render(request, "accounting/ledger-summary.html", { "item_list": pagination.items,