Bug 421260 - Networth "account balances by institution" provides incorrect results
Summary: Networth "account balances by institution" provides incorrect results
Alias: None
Product: kmymoney
Classification: Unclassified
Component: reports (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
Depends on:
Reported: 2020-05-10 05:08 UTC by Thomas Baumgart
Modified: 2020-06-05 04:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Baumgart 2020-05-10 05:08:14 UTC

When investment accounts assigned to an institution are grouped under an umbrella that does not have an institution assigned, then they will be listed as account with no institution in the networth "account balances by institution" report

1. Create institution B
2. Create investment account I with institution B
3. Create an investment S in I
4. Create plain asset account A with no institution
5. Make A the parent account of I

1. The Networth "Account balances by institution" report shows S under "None"
2. The Information "Account information" I is shown under B 

The Networth "Account balances by institution" report shows S under B

- With I being a top-level account S is reported correctly under B
- Accounts of type checking, savings, and asset are properly organized/grouped under their respective institutions.
Comment 1 Thomas Baumgart 2020-05-10 05:57:33 UTC
Git commit 650d68b395dcd87dfa41294565d86d0fdbfcbab4 by Thomas Baumgart.
Committed on 10/05/2020 at 05:57.
Pushed by tbaumgart into branch '5.0'.

Use the correct institution in reports

When an account has no institution assigned the one of the top-level
account was used in some reports. This leads to wrong results in case of
investments which don't have an institution assigned but should use the
one of the parent investment account.

This worked as long as the investment account itself was the top-level
account. In case the investment account itself was a sub-account to a
top-level account or even further down in the account hierarchy, the
institution was always taken from the top-level account.

This change fixes the problem by walking up the hierarchy and using the
first institution found.
FIXED-IN: 5.0.9

M  +1    -6    kmymoney/plugins/views/reports/core/querytable.cpp
M  +17   -0    kmymoney/plugins/views/reports/core/reportaccount.cpp
M  +7    -0    kmymoney/plugins/views/reports/core/reportaccount.h