From ea79200131e43d13729d8846d89604928b1f1031 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Tue, 19 Jan 2021 14:22:08 -0500 Subject: [PATCH] ledger: Report accounts that are not open but have postings. --- conservancy_beancount/reports/ledger.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/conservancy_beancount/reports/ledger.py b/conservancy_beancount/reports/ledger.py index 57043d7..02306da 100644 --- a/conservancy_beancount/reports/ledger.py +++ b/conservancy_beancount/reports/ledger.py @@ -446,18 +446,20 @@ class LedgerODS(core.BaseODS[data.Posting, None]): for sheet_index, account in core.sort_and_filter_accounts( tally_by_account, sheet_names, ): - if not account.is_open_on_date(self.date_range.start): - continue while using_sheet_index < sheet_index: using_sheet_index += 1 self.start_sheet(sheet_names[using_sheet_index]) - self.norm_func = core.normalize_amount_func(account) postings = self.account_groups[account] - if postings: + # Accounts that aren't open can still have postings because of + # malformed input or rewrite rules. + if not (postings or account.is_open_on_date(self.date_range.start)): + continue + elif postings: totals_set = self.totals_with_entries else: totals_set = self.totals_without_entries want_totals = account.is_under(*totals_set) is not None + self.norm_func = core.normalize_amount_func(account) if postings or want_totals: self.write_header(account) if want_totals: