Bug 507370

Summary: Investment account value shows 0, even when it is not
Product: [Applications] kmymoney Reporter: crushedtortilla
Component: ux-uiAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.2.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.2.1
Sentry Crash Report:
Attachments: test file
home page
accounts page
institution page
stocks page

Description crushedtortilla 2025-07-22 16:35:00 UTC
Created attachment 183432 [details]
test file

SUMMARY
The value from Investment accounts is not properly displayed on the Institutions and Accounts pages, showing up as $0 even though the account value is actually non-zero.

STEPS TO REPRODUCE
1. Create an Investment account under some institution, and buy some stock in it with a non-zero price.

I've included a sample .kmy file showing this, as well as some screenshots.


OBSERVED RESULT
1. Notice on the Accounts page that the value of that Investment account is properly included in the Asset's "Total Value", but both the Balance and Total Value are $0 on the Investment account's row

2. On the Institutions page, the value from the Investment account is included in "Accounts with no institution assigned" even though the account has an institution assigned.

3. On the Home page, the value from the Investment account does indeed show up correctly.

EXPECTED RESULT
1. On the Accounts page, the Investment account row should display the correct value in the Balance and Total Value cells, based on the last entered price.

2. On the Institutions page, the value from the Investment account should show up under the correct institution.
Comment 1 crushedtortilla 2025-07-22 16:35:12 UTC
Created attachment 183433 [details]
home page
Comment 2 crushedtortilla 2025-07-22 16:35:24 UTC
Created attachment 183434 [details]
accounts page
Comment 3 crushedtortilla 2025-07-22 16:35:36 UTC
Created attachment 183435 [details]
institution page
Comment 4 crushedtortilla 2025-07-22 16:35:46 UTC
Created attachment 183436 [details]
stocks page
Comment 5 Thomas Baumgart 2025-07-23 12:35:37 UTC
The balance in the accounts view will remain zero due to the fact that it can contain investments denominated in different investments. You can make those details visible when turning on the "Show equity accounts" option in the General filter settings.
Comment 6 Thomas Baumgart 2025-07-23 12:37:47 UTC
Git commit 522136e84d35337bba7291112c892185461e5a41 by Thomas Baumgart.
Committed on 23/07/2025 at 12:37.
Pushed by tbaumgart into branch 'master'.

Fix values displayed in accounts and institutions view

In certain cases involving investment accounts the values displayed were not correct. This change makes sure that correct values are presented to the user.
FIXED-IN: 5.2.1

M  +10   -2    kmymoney/mymoney/storage/institutionsmodel.cpp
M  +21   -8    kmymoney/views/accountdelegate.cpp

https://invent.kde.org/office/kmymoney/-/commit/522136e84d35337bba7291112c892185461e5a41
Comment 7 Thomas Baumgart 2025-07-23 14:24:34 UTC
Git commit b6606b429c6de4d55375fc5184143f359c194a57 by Thomas Baumgart.
Committed on 23/07/2025 at 12:43.
Pushed by tbaumgart into branch '5.2'.

Fix values displayed in accounts and institutions view

In certain cases involving investment accounts the values displayed were
not correct. This change makes sure that correct values are presented to
the user.
FIXED-IN: 5.2.1
(cherry picked from commit 522136e84d35337bba7291112c892185461e5a41)

M  +10   -2    kmymoney/mymoney/storage/institutionsmodel.cpp
M  +21   -8    kmymoney/views/accountdelegate.cpp

https://invent.kde.org/office/kmymoney/-/commit/b6606b429c6de4d55375fc5184143f359c194a57
Comment 8 crushedtortilla 2025-07-23 15:28:27 UTC
Thanks, I didn't know about that setting.

It looks like even with that setting enabled, the total value for the individual stock accounts does not get rolled into the investment account and other parent accounts when the account is expanded (it's really weird, the total value cell of the investment account is 0 if the row is expanded and it's a non-zero value if it's collapsed). I think maybe that's what 522136e84d35337bba7291112c892185461e5a41 is fixing, but I'm not entirely sure.
Comment 9 Thomas Baumgart 2025-07-24 07:59:51 UTC
When expanded, the values shown for the balance of an account are for that account only. Since investment accounts don't carry any amounts their value must be zero in this case. When collapsed, the value shown includes the values of all the sub-ordinate accounts (which are hidden in this case). This is by design so that the sum of all (visible) values presented in that column is always the same no matter if collapsed or expanded.
Comment 10 crushedtortilla 2025-07-25 03:54:34 UTC
I see, thanks for the explanation.

And thanks for all the responses on this and the other bug I filed, it's very appreciated getting quick replies back!