Bug 429710

Summary: Capital gains report issue when account closed
Product: [Applications] kmymoney Reporter: stephanesp <stephane_1802>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description stephanesp 2020-11-27 07:21:05 UTC
SUMMARY

When closing a dealing account and the shares within it, the shares do not appear in the capital gains report anymore. However, if I leave them open, the price update keeps updating their price (even if those are, for instance, all funds that no longer exist). They should appear, at least in the "by type" capital gains report

STEPS TO REPRODUCE
1. Open two dealing accounts A & B
2. Buy and sell shares of the same stock in both
3. Sell all in account A
4. Close account A
5. Run capital gains report by type

OBSERVED RESULT
Gains are only calculated on trades in account B (All benefits/losses made in account A are ignored)

EXPECTED RESULT
Include all trades when calculating capital gains

SOFTWARE/OS VERSIONS
Linux Ubuntu 20.10

ADDITIONAL INFORMATION
Comment 1 Jack 2020-11-28 22:03:02 UTC
I think the report is working as designed.  Closing an account says you are no longer interested in it.  If you want the capital gains of a final sale of shares to be included in a report, you need to leave the account open.  If reports included closed accounts, they would either end up excessively crowded, or you would have to explicitly exclude all the closed accounts (at least all except the one you did want included.)

You might turn this into a "wishlist" to add a configuration item to reports to allow inclusion of closed accounts, but given the workaround is so easy, I don't know if it matters.
Comment 2 stephanesp 2020-11-29 08:22:28 UTC
In the case of dealing accounts, if I leave the stocks as open to have the gains/losses in the "by type" report, their price is updated each time an "update stocks & currency prices" is run", which takes a long time.

Also, if I leave the old dealing account open and have the same stock in another dealing account (e.g. different bank), the stock appears twice in the "by type" report. I agree it should appear twice in the "by account" report but I am not sure it should in the "by type". At the moment, it seems to be done at the equity x account level; should it not be at the security level ?