Bug 343536 - Same stock investments in different accounts
Summary: Same stock investments in different accounts
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.7.1
Platform: Microsoft Windows Other
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL: http://www.directupload.net/file/d/38...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-29 19:04 UTC by T.B.
Modified: 2015-02-05 23:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Simple test file exposing the problem. Try to add the Stock "Peaches" to the account Depot 2, but from the ledgers view. E.g. try the transaction "Add shares". (4.72 KB, application/gzip)
2015-01-31 19:44 UTC, T.B.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description T.B. 2015-01-29 19:04:21 UTC
I have already created an investment account and have added the initial investments inventory, both stocks and fonds. Now I like to create a second depot and also like to start with an inital inventory by adding investments to the second account.

Some stocks are hold in both depots. On adding the stock, the investments dropdown box does not show the investments already created, I have to create new ones for the new depot which forces me to have duplicate investments in the investments overview.

Reproducible: Always

Steps to Reproduce:
1. new kmymoney file
2. add first investment account
3. add an investemt
4. add investment item to account
5. create second investment account
6. Try to add an investment so second: dropdown box is empty


Expected Results:  
The investments drop down box should contain any investment created earlier.
Comment 1 allan 2015-01-29 20:42:09 UTC
On 29/01/15 19:04, T.B. wrote:
> https://bugs.kde.org/show_bug.cgi?id=343536
>
>              Bug ID: 343536
>             Summary: Same stock investments in different accounts
>             Product: kmymoney4
>             Version: 4.7.1
>            Platform: MS Windows
>                 URL: http://www.directupload.net/file/d/3882/g6bpf7g5_png.h
>                      tm
>                  OS: other
>              Status: UNCONFIRMED
>            Severity: normal
>            Priority: NOR
>           Component: general
>            Assignee: kmymoney-devel@kde.org
>            Reporter: hummerfisch@yahoo.de
>
> I have already created an investment account and have added the initial
> investments inventory, both stocks and fonds. Now I like to create a second
> depot and also like to start with an inital inventory by adding investments to
> the second account.
>
> Some stocks are hold in both depots. On adding the stock, the investments
> dropdown box does not show the investments already created, I have to create
> new ones for the new depot which forces me to have duplicate investments in the
> investments overview.
>
> Reproducible: Always
>
> Steps to Reproduce:
> 1. new kmymoney file
> 2. add first investment account
> 3. add an investemt
> 4. add investment item to account
> 5. create second investment account
> 6. Try to add an investment so second: dropdown box is empty
>
>
> Expected Results:
> The investments drop down box should contain any investment created earlier.
>

To be sure I understand, you have created two separate investment 
accounts, and now want to add stocks, etc., to the second, and these 
stocks may or may not be the same as those in the first investment account?

If so, when you are creating  the new stock, as long as it is the same 
type - stock, bond, etc. - if you enter first the ticker symbol, you 
should be asked "The selected symbol is already on file. Do you want to 
reuse the existing security?"

Does that help?

Allan
Comment 2 T.B. 2015-01-31 19:44:40 UTC
Created attachment 90839 [details]
Simple test file exposing the problem. Try to add the Stock "Peaches" to the account Depot 2, but from the ledgers view. E.g. try the transaction "Add shares".
Comment 3 T.B. 2015-01-31 19:49:17 UTC
I've retried according to your comments, even with a new file it does not work as intended.

For the second account, on entering the already existing stock name, the new invenstment wizard comes up and is not aware that the stock entered already exists. No option to reuse the first one.
Comment 4 allan 2015-01-31 20:37:07 UTC
I loaded your file and was able to add the existing Peaches stock to Depot 2 in the way I described.

1) Load KMY file.
2) In Investments view, select Depot 1, then Peaches, just to identify its type as Stock.
3) Now select Depot 2 and right click to add new investment.
4) In the new investment wizard, set the type to Stock.
5) Click Next then enter the symbol for the existing Peaches stock.
6) On clicking Full Name, I get the Security found message, indicating  "The selected symbol is already on file. Do you want to reuse the existing security?"
7) Answer Yes, then finish.
8) Confirm that Depot 2 now shows Peaches.

In step 4), it is important to select the same type as the existing stock, or this will not work.
Comment 5 T.B. 2015-01-31 23:17:13 UTC
Yes, indeed in that way Depot 2 shows Peaches.

But it's only a work around. When I add the stock from the depot view upon some transaction on a not yet existing stock in that depot, the existing symbol message doesn't show although it should have.
Comment 6 T.B. 2015-01-31 23:18:52 UTC
Furthermore, is there an easy way to correct the duplicate Apple entry in Investments / Securities?
Comment 7 allan 2015-02-01 00:42:17 UTC
(In reply to T.B. from comment #5)
> Yes, indeed in that way Depot 2 shows Peaches.
> 
> But it's only a work around. 
No, that's as it was designed.

> When I add the stock from the depot view upon
> some transaction on a not yet existing stock in that depot, the existing
> symbol message doesn't show although it should have.

I'm afraid I'm not following this.  Can you give step by step detail, with what happens against what you expect.  If there is a problem, then I need to be able to reproduce it, otherwise I might 'fix' the wrong thing.
Comment 8 allan 2015-02-01 01:16:16 UTC
(In reply to T.B. from comment #6)
> Furthermore, is there an easy way to correct the duplicate Apple entry in
> Investments / Securities?

Initially, neither may be deleted because they have transactions attached.  You'll need to delete the transaction/s concerned and that will then allow deletion of the account.
Comment 9 T.B. 2015-02-05 21:52:02 UTC
It seems we are closing the circle here. The very first description shows the neccessary steps to reproduce the faulty behaviour.

In other words: The observation is that it makes a difference if an investment is created from the investments view (as stated in comment #4) or from the ledgers view (as originally described). The same forms appear and the user cannot be aware that it is behaving differently: upon adding the investment from the ledgers view, the form is not checking the ticker ID against the existing ones. This results in duplicate investments when operated from the ledgers view.

Fortunatly my second account contained just a few investments and I was able to fix that but had a hard time doing so. Eventually this exposed another issue but currently I am not willing to reproduce it, to be able to describe it as a real bug. Still maybe a fix description is helpful for others finding this bug:
1. Find out which of the duplicates belong to the second depot. Can be done by renaming, e.g. both Apples to Apple_1 and Apple_2 (later one may be the ducplicate to remove)
2. Delete all transaction in the second account.
3. Still the duplicate investment couldn't be deleted as I had already retrieved online quotes.
4. Deleted all online quote prices from the Extras > Prices view. I double and triple checked this the view showed no quotes for Apple_2
5. Still deletion was not possible
6. Used File > Save as database. SQL Lite was convenient for me.
7. Used Mozillar Firefox with SQLLite Manager to access that database. In the table kmmSecurities I identified the ID for Apple_2
8. Went to kmmPrices and found some prices for Apple_2 although these were not shown in step 4 (maybe that's a bug?). Deleted these prices.
9. Saved the database
10. Went back to kmymoney and used File > Open Database to open the changed version.
11. Anything looked as before. But now I was able to delete Apple_2
12. Now I could enter my investments for account 2 from the investements view first before adding transactions.
Comment 10 allan 2015-02-05 23:38:55 UTC
(In reply to T.B. from comment #9)
> It seems we are closing the circle here. The very first description shows
> the neccessary steps to reproduce the faulty behaviour.
> 
> In other words: The observation is that it makes a difference if an
> investment is created from the investments view (as stated in comment #4) or
> from the ledgers view (as originally described). The same forms appear and
> the user cannot be aware that it is behaving differently: upon adding the
> investment from the ledgers view, the form is not checking the ticker ID
> against the existing ones. This results in duplicate investments when
> operated from the ledgers view.

It is possible to do what you are trying to do, from the Ledger view.  However, when you get the wizard, before entering the symbol you wish to use, you need to clear the name that has been created.  Otherwise, the newly created security you've just agreed to create will be used.  Clearing that new name in effect starts anew.  (@Jack) Perhaps an addition to the handbook should cover that.
> Fortunatly my second account contained just a few investments and I was able
> to fix that but had a hard time doing so. Eventually this exposed another
> issue but currently I am not willing to reproduce it, to be able to describe
> it as a real bug. Still maybe a fix description is helpful for others
> finding this bug:
> 1. Find out which of the duplicates belong to the second depot. Can be done
> by renaming, e.g. both Apples to Apple_1 and Apple_2 (later one may be the
> ducplicate to remove)
> 2. Delete all transaction in the second account.
> 3. Still the duplicate investment couldn't be deleted as I had already
> retrieved online quotes.
> 4. Deleted all online quote prices from the Extras > Prices view. I double
> and triple checked this the view showed no quotes for Apple_2
> 5. Still deletion was not possible
> 6. Used File > Save as database. SQL Lite was convenient for me.
> 7. Used Mozillar Firefox with SQLLite Manager to access that database. In
> the table kmmSecurities I identified the ID for Apple_2
> 8. Went to kmmPrices and found some prices for Apple_2 although these were
> not shown in step 4 (maybe that's a bug?). Deleted these prices.
> 9. Saved the database
> 10. Went back to kmymoney and used File > Open Database to open the changed
> version.
> 11. Anything looked as before. But now I was able to delete Apple_2
> 12. Now I could enter my investments for account 2 from the investements
> view first before adding transactions.

I'll try to digest this tomorrow.