Added note to the CSV output of ledgers.

This commit is contained in:
依瑪貓 2023-03-05 17:41:34 +08:00
parent 1d0a79e33c
commit b806b1ed1f
2 changed files with 8 additions and 3 deletions

View File

@ -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}

View File

@ -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: