ledger: Include balances for accounts without activity.
This commit is contained in:
parent
4483d76999
commit
e5aa63996a
1 changed files with 9 additions and 5 deletions
|
@ -252,17 +252,16 @@ class LedgerODS(core.BaseODS[data.Posting, data.Account]):
|
||||||
self.lock_first_row()
|
self.lock_first_row()
|
||||||
|
|
||||||
def _report_section_balance(self, key: data.Account, date_key: str) -> None:
|
def _report_section_balance(self, key: data.Account, date_key: str) -> None:
|
||||||
uses_opening = key.is_under('Assets', 'Equity', 'Liabilities')
|
|
||||||
related = self.account_groups[key]
|
related = self.account_groups[key]
|
||||||
if date_key == 'start':
|
if date_key == 'start':
|
||||||
if not uses_opening:
|
if not key.keeps_balance():
|
||||||
return
|
return
|
||||||
date = self.date_range.start
|
date = self.date_range.start
|
||||||
balance = related.start_bal
|
balance = related.start_bal
|
||||||
description = "Opening Balance"
|
description = "Opening Balance"
|
||||||
else:
|
else:
|
||||||
date = self.date_range.stop
|
date = self.date_range.stop
|
||||||
if uses_opening:
|
if key.keeps_balance():
|
||||||
balance = related.stop_bal
|
balance = related.stop_bal
|
||||||
description = "Ending Balance"
|
description = "Ending Balance"
|
||||||
else:
|
else:
|
||||||
|
@ -358,7 +357,7 @@ class LedgerODS(core.BaseODS[data.Posting, data.Account]):
|
||||||
tally_by_account = {
|
tally_by_account = {
|
||||||
account: count
|
account: count
|
||||||
for account, count in tally_by_account_iter
|
for account, count in tally_by_account_iter
|
||||||
if count
|
if count or account.keeps_balance()
|
||||||
}
|
}
|
||||||
sheet_names = self.plan_sheets(
|
sheet_names = self.plan_sheets(
|
||||||
tally_by_account, self.required_sheet_names, self.sheet_size,
|
tally_by_account, self.required_sheet_names, self.sheet_size,
|
||||||
|
@ -370,7 +369,12 @@ class LedgerODS(core.BaseODS[data.Posting, data.Account]):
|
||||||
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])
|
||||||
super().write(self.account_groups[account])
|
postings = self.account_groups[account]
|
||||||
|
if postings:
|
||||||
|
super().write(postings)
|
||||||
|
elif account.keeps_balance() and account.is_open_on_date(self.date_range.start):
|
||||||
|
self.start_section(account)
|
||||||
|
self.end_section(account)
|
||||||
for index in range(using_sheet_index + 1, len(sheet_names)):
|
for index in range(using_sheet_index + 1, len(sheet_names)):
|
||||||
self.start_sheet(sheet_names[index])
|
self.start_sheet(sheet_names[index])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue