Changed the CSV field name to be title-cased.

This commit is contained in:
依瑪貓 2023-03-05 17:38:17 +08:00
parent d4a690ebbc
commit 1d0a79e33c
2 changed files with 20 additions and 20 deletions

View File

@ -62,13 +62,13 @@ class JournalRow(ReportRow):
"""The account."""
def as_dict(self) -> dict[str, t.Any]:
return {"date": self.transaction.date,
"currency": str(self.currency),
"account": str(self.account),
"summary": self.summary,
"debit": self.amount if self.is_debit else None,
"credit": None if self.is_debit else self.amount,
"note": self.transaction.note}
return {"Date": self.transaction.date,
"Currency": str(self.currency),
"Account": str(self.account),
"Summary": self.summary,
"Debit": self.amount if self.is_debit else None,
"Credit": None if self.is_debit else self.amount,
"Note": self.transaction.note}
class LedgerRow(ReportRow):
@ -103,13 +103,13 @@ class LedgerRow(ReportRow):
def as_dict(self) -> dict[str, t.Any]:
if self.is_total:
return {"date": "Total",
"summary": None,
"debit": self.debit,
"credit": self.credit,
"balance": self.balance}
return {"date": self.date,
"summary": self.summary,
"debit": self.debit,
"credit": self.credit,
"balance": self.balance}
return {"Date": "Total",
"Summary": None,
"Debit": self.debit,
"Credit": self.credit,
"Balance": self.balance}
return {"Date": self.date,
"Summary": self.summary,
"Debit": self.debit,
"Credit": self.credit,
"Balance": self.balance}

View File

@ -198,8 +198,8 @@ class Journal(JournalEntryReport[JournalRow]):
@property
def csv_field_names(self) -> list[str]:
return ["date", "currency", "account", "summary", "debit", "credit",
"note"]
return ["Date", "Currency", "Account", "Summary", "Debit", "Credit",
"Note"]
@property
def csv_filename(self) -> str:
@ -345,7 +345,7 @@ class Ledger(JournalEntryReport[LedgerRow]):
@property
def csv_field_names(self) -> list[str]:
return ["date", "summary", "debit", "credit", "balance"]
return ["Date", "Summary", "Debit", "Credit", "Balance"]
@property
def csv_filename(self) -> str: