From b806b1ed1fc42b1ee27888653d2ea2b6fb235d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sun, 5 Mar 2023 17:41:34 +0800 Subject: [PATCH] Added note to the CSV output of ledgers. --- src/accounting/report/report_rows.py | 8 ++++++-- src/accounting/report/reports.py | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/accounting/report/report_rows.py b/src/accounting/report/report_rows.py index 7e67e84..58a1b4b 100644 --- a/src/accounting/report/report_rows.py +++ b/src/accounting/report/report_rows.py @@ -95,6 +95,8 @@ class LedgerRow(ReportRow): """The credit amount.""" self.balance: Decimal | None = None """The balance.""" + self.note: str | None = None + """The note.""" if entry is not None: self.entry = entry self.summary = entry.summary @@ -107,9 +109,11 @@ class LedgerRow(ReportRow): "Summary": None, "Debit": self.debit, "Credit": self.credit, - "Balance": self.balance} + "Balance": self.balance, + "Note": None} return {"Date": self.date, "Summary": self.summary, "Debit": self.debit, "Credit": self.credit, - "Balance": self.balance} + "Balance": self.balance, + "Note": self.note} diff --git a/src/accounting/report/reports.py b/src/accounting/report/reports.py index d975cb8..98ba9cd 100644 --- a/src/accounting/report/reports.py +++ b/src/accounting/report/reports.py @@ -342,10 +342,11 @@ class Ledger(JournalEntryReport[LedgerRow]): if row.entry is not None: row.transaction = transactions[row.entry.transaction_id] row.date = row.transaction.date + row.note = row.transaction.note @property def csv_field_names(self) -> list[str]: - return ["Date", "Summary", "Debit", "Credit", "Balance"] + return ["Date", "Summary", "Debit", "Credit", "Balance", "Note"] @property def csv_filename(self) -> str: