Skip to content

Commit

Permalink
Display parent accounts with one child if they contain posts
Browse files Browse the repository at this point in the history
Display parent accounts with one child if they contain posts to avoid
the user thinking the parent account doesn't have any posts. Previously
an account with postings and a child account would just display the
child account balance, which hides the actual account balance.

Fixes #2009
  • Loading branch information
Sven Püschel authored and jwiegley committed Oct 19, 2024
1 parent 033759c commit a1891fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ format_accounts::mark_accounts(account_t& account, const bool flat)
bind_scope_t bound_scope(report, account);
call_scope_t call_scope(bound_scope);
if ((! flat && to_display > 1) ||
(! flat && to_display == 1 && ! account.posts.empty()) ||
((flat || to_display != 1 ||
account.has_xflags(ACCOUNT_EXT_VISITED)) &&
(report.HANDLED(empty) ||
Expand Down
17 changes: 17 additions & 0 deletions test/regress/cmd-balance-parent-has-transaction.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
2021/01/01 Test
Left Column:Account A:Sub-Account 100
Right Column:Account 1:Sub-Account -100

2021/01/02 Test
Left Column:Account A -100
Right Column:Account 2 100

test bal
0 Left Column:Account A
100 Sub-Account
0 Right Column
-100 Account 1:Sub-Account
100 Account 2
--------------------
0
end test

0 comments on commit a1891fa

Please sign in to comment.