Bug 443728

Summary: Ledger selection list for Investment Account includes zero balance stocks
Product: [Applications] kmymoney Reporter: Glenn <gemdancer>
Component: ux-uiAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: minor    
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Glenn 2021-10-14 16:05:29 UTC
SUMMARY
In the Ledgers tab, the Ledger selection list for Investment accounts lists the stocks in the account (why???). For one account, which is a sub-account of Assets, only the stocks with non-zero number of shares are listed. For another account, which is a sub-account of IRA under Assets, ALL stocks are listed, even those which have been sold so the number of shares is zero. 

STEPS TO REPRODUCE
Not sure. try this.
1. Create a sub-account IRA under Assets.
2. Create an Investment account under IRA.
3. Add some stocks to the account, and Sell or Remove so at least one has zero shares.

OBSERVED RESULT
Ledger selection list for the Investment account lists ALL stocks, even those with zero shares.

EXPECTED RESULT
Only stocks with non-zero shares are listed.
OR, do not list the stocks at all.
Account name is sufficient, without all its holdings.

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2021-10-16 10:44:09 UTC
Git commit 4cea5503a721d761734c32826465b438f3422f3b by Thomas Baumgart.
Committed on 16/10/2021 at 10:19.
Pushed by tbaumgart into branch 'master'.

Implement option to hide zero balance equity and investment accounts

M  +1    -0    kmymoney/converter/mymoneystatementreader.cpp
M  +1    -0    kmymoney/dialogs/knewaccountdlg.cpp
M  +32   -0    kmymoney/models/accountsproxymodel.cpp
M  +3    -0    kmymoney/models/accountsproxymodel.h
M  +10   -8    kmymoney/models/accountsproxymodel_p.h
M  +1    -0    kmymoney/views/kaccountsview.cpp
M  +1    -0    kmymoney/views/kcategoriesview.cpp
M  +1    -0    kmymoney/views/kinvestmentview_p.h
M  +1    -0    kmymoney/views/kpayeesview_p.h
M  +1    -0    kmymoney/views/newspliteditor.cpp
M  +1    -0    kmymoney/views/newtransactioneditor.cpp
M  +3    -1    kmymoney/views/simpleledgerview.cpp
M  +1    -0    kmymoney/wizards/newaccountwizard/khierarchypage.cpp

https://invent.kde.org/office/kmymoney/commit/4cea5503a721d761734c32826465b438f3422f3b
Comment 2 Thomas Baumgart 2021-10-16 10:51:28 UTC
Fixing this in the 5.1 branch requires more work, as the option currently is only evaluated once at application start and the logic differs very much from the master version.