Fixed the error not setting the label correctly in the cash account summary and ledger summary in the accounting application.

This commit is contained in:
依瑪貓 2020-08-03 19:32:41 +08:00
parent 841fbc1223
commit a9a47f8526

View File

@ -241,13 +241,14 @@ def cash_summary(request, account):
for month in months: for month in months:
cumulative_balance = cumulative_balance + month.balance cumulative_balance = cumulative_balance + month.balance
month.cumulative_balance = cumulative_balance month.cumulative_balance = cumulative_balance
months.append(RecordSummary( total = RecordSummary(
label=pgettext("Accounting|", "Total"),
credit=sum([x.credit for x in months]), credit=sum([x.credit for x in months]),
debit=sum([x.debit for x in months]), debit=sum([x.debit for x in months]),
balance=sum([x.balance for x in months]), balance=sum([x.balance for x in months]),
cumulative_balance=cumulative_balance, cumulative_balance=cumulative_balance,
)) )
total.label = pgettext("Accounting|", "Total")
months.append(total)
pagination = Pagination(request, months, True) pagination = Pagination(request, months, True)
shortcut_accounts = settings.ACCOUNTING["CASH_SHORTCUT_ACCOUNTS"] shortcut_accounts = settings.ACCOUNTING["CASH_SHORTCUT_ACCOUNTS"]
return render(request, "accounting/cash-summary.html", { return render(request, "accounting/cash-summary.html", {
@ -383,13 +384,14 @@ def ledger_summary(request, account):
for month in months: for month in months:
cumulative_balance = cumulative_balance + month.balance cumulative_balance = cumulative_balance + month.balance
month.cumulative_balance = cumulative_balance month.cumulative_balance = cumulative_balance
months.append(RecordSummary( total = RecordSummary(
label=pgettext("Accounting|", "Total"),
credit=sum([x.credit for x in months]), credit=sum([x.credit for x in months]),
debit=sum([x.debit for x in months]), debit=sum([x.debit for x in months]),
balance=sum([x.balance for x in months]), balance=sum([x.balance for x in months]),
cumulative_balance=cumulative_balance, cumulative_balance=cumulative_balance,
)) )
total.label = pgettext("Accounting|", "Total")
months.append(total)
pagination = Pagination(request, months, True) pagination = Pagination(request, months, True)
return render(request, "accounting/ledger-summary.html", { return render(request, "accounting/ledger-summary.html", {
"item_list": pagination.items, "item_list": pagination.items,