Bug 394394

Summary: problems adding securities to investment accounts
Product: [Applications] kmymoney Reporter: Jack <ostroffjh>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: chrisjoshtopher, lukasz.wojnilowicz
Priority: NOR    
Version: 5.0.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.2
Sentry Crash Report:

Description Jack 2018-05-17 23:23:46 UTC
I'm getting some inconsistent behavior trying to add securities to investment accounts.  Created a new kmy file, with standard checking account, and two investment accounts, each with associated default brokerage account.  Go to one of the investment accounts and try to buy shares.  Tabbing out of the "security" field, it asks if I want to create the security, I say yes, and go through those few windows.  I add the number of shares and cost, but the "save' button remains disabled.  If I look at the investments tab, it seems the security HAS been created, and if I go back to the investment account, I CAN buy some shares.  If I go to the other investment account, I get the same behavior - can't buy at first, but cancel and go back, and it's ok.  However, buying the same security in the second account never gives me the option to use the already existing security with the same symbol.  This problem has been reported and fixed in the past, but it seems to be back, at least for me.  (Same behavior in 5.0.1 Arch linux package and git master on Gentoo.)

Can anyone else confirm this, or is it telling my I shouldn't be in the market?
Comment 1 wojnilowicz 2018-06-02 08:02:15 UTC
Could you provide test file and minimal count of steps to reproduce?
Comment 2 Jack 2018-06-02 17:21:22 UTC
My initial post provides sufficient steps to reproduce this with a new .kmy file.
1) create new .kmy file with a checking account.
2) add two investment accounts, each with a brokerage account
3) create a "buy shares" transaction in the first investment account
4) when you tab out of the security field, answer "yes" to creating the new security
5) unable to "save" the transaction, so "cancel"
6) switch to investments view and note the security HAS been created
7) try again to "buy shares" and it works
8) try to "buy shares" in the second investment account, and note the same behavior.  On a second try, when you CAN create the "buy shares" transaction, note it still does not offer to use the existing security, and creates a new one.
Comment 3 Thomas Baumgart 2018-06-04 14:15:38 UTC
Git commit 87d3c4ef0cbe1bddd19df2ef64b762c8c82b349d by Thomas Baumgart.
Committed on 04/06/2018 at 14:15.
Pushed by tbaumgart into branch 'master'.

Reload widget to use newly created security

A security created on the fly could not be used in the current edit
session. This change fixes this problem.
FIXED-IN: 5.1.0

M  +1    -0    kmymoney/dialogs/investtransactioneditor.cpp

https://commits.kde.org/kmymoney/87d3c4ef0cbe1bddd19df2ef64b762c8c82b349d
Comment 4 Thomas Baumgart 2018-06-04 14:18:32 UTC
In order to reuse an existing security, you need to add it to the investment account first before you can use it. To do so

1) remember the symbol of the existing investment
2) open the second investment account in the investment view
3) RMB on the list of equities
4) Select New investment
5) Enter the symbol remembered in 1)
6) Tab out of the field
7) You will be asked if you want to re-use the existing investment or create a new one
8) Select re-use and continue with the wizard
9) Done!

Now goto investment account 2 and the investment is present.
Comment 5 Thomas Baumgart 2018-06-04 14:20:16 UTC
Git commit c8b202f550a0fe32a95ca0c547029ee15274f125 by Thomas Baumgart.
Committed on 04/06/2018 at 14:20.
Pushed by tbaumgart into branch '5.0'.

Reload widget to use newly created security

A security created on the fly could not be used in the current edit
session. This change fixes this problem.
FIXED-IN: 5.0.2

(cherry picked from commit 87d3c4ef0cbe1bddd19df2ef64b762c8c82b349d)

M  +1    -0    kmymoney/dialogs/investtransactioneditor.cpp

https://commits.kde.org/kmymoney/c8b202f550a0fe32a95ca0c547029ee15274f125
Comment 6 Jack 2018-06-05 16:00:11 UTC
This works correctly for me now.  However, I might file a separate wishlist to eliminate the need to manually create the security account before using it.  I also wonder if the symbol is found, but for a different type (stock v. mutual fund) if the user should still be offered to reuse the security.
Comment 7 Thomas Baumgart 2018-08-19 13:29:23 UTC
*** Bug 395591 has been marked as a duplicate of this bug. ***