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

View File

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