ledger: Report accounts that are not open but have postings.

This commit is contained in:
Brett Smith 2021-01-19 14:22:08 -05:00
parent 5c6d9d6f69
commit ea79200131

View file

@ -446,18 +446,20 @@ class LedgerODS(core.BaseODS[data.Posting, None]):
for sheet_index, account in core.sort_and_filter_accounts( for sheet_index, account in core.sort_and_filter_accounts(
tally_by_account, sheet_names, tally_by_account, sheet_names,
): ):
if not account.is_open_on_date(self.date_range.start):
continue
while using_sheet_index < sheet_index: while using_sheet_index < sheet_index:
using_sheet_index += 1 using_sheet_index += 1
self.start_sheet(sheet_names[using_sheet_index]) self.start_sheet(sheet_names[using_sheet_index])
self.norm_func = core.normalize_amount_func(account)
postings = self.account_groups[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 totals_set = self.totals_with_entries
else: else:
totals_set = self.totals_without_entries totals_set = self.totals_without_entries
want_totals = account.is_under(*totals_set) is not None want_totals = account.is_under(*totals_set) is not None
self.norm_func = core.normalize_amount_func(account)
if postings or want_totals: if postings or want_totals:
self.write_header(account) self.write_header(account)
if want_totals: if want_totals: