Bug 360210 - Msg: "Stock account must have investment account as parent" adding investment to existing account
Summary: Msg: "Stock account must have investment account as parent" adding investment...
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.7.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-07 15:16 UTC by Paul Gover
Modified: 2016-03-11 14:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test empty .kmy file exhibiting the problem (4.42 KB, application/x-kmymoney)
2016-03-08 15:36 UTC, Paul Gover
Details
Screen grab showing the inability to add a new investment (141.12 KB, image/png)
2016-03-08 15:36 UTC, Paul Gover
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Gover 2016-03-07 15:16:15 UTC
Following the help text instructions "Adding Investments to Your Account", clicking the "Finish" button on the New Investment wizard for a Stock investment. I get an error message:
"Stock account must have investment account as parent  caugt in /var/tmp/tmpdir/portage/app-office/kmymoney-4.7.2/work/kmymoney-4.7.2/kmymoney/mymoney/mymoneyfile.cpp:916".

I had a problem getting to this point - the New investment option on the Investments context menu was greyed out if I had clicked on any of the existing investments in the account; only Edit investment was allowed.  Changing to a different account and back allowed New investment, but finishing gives error as above, and no new investment.

Reproducible: Always

Steps to Reproduce:
1.Have an investment account with at least one investment.
2.Try adding another investment.
3.Drink beer.



Been using kymymoney for years, for which many thanks.  This particular database is about 7 years old.  The compressed and encrypted file is about 290 Kb.
Comment 1 allan 2016-03-07 17:17:33 UTC
I don't seem to be able to reproduce your problem, apart from Step 3.

Is the problem reproducible, possibly in another file.?  If so, are you able to provide a minimal .kmy file demonstrating the issue?

Have you tried to run the consistency check?
Comment 2 Paul Gover 2016-03-08 15:34:49 UTC
I thought this was going to be hard.   I created a new .kmy file, using the welcome wizard to create firstly a default chequeing account ("Splod", probably irrelevant), and an investment account set-up.  First step after the wizard completed was to try and add a new investment.  Oops, no can do!

I attach a screen grab and the test .kmy file.

FWIW, the consistency check works OK on my live .kmy database, and comes back instantly.  A probably irrelevant fact is that when adding certain new entries to my existing investments, I get a pop-up window telling me there's a problem with a split, which it automatically corrects.  I don't understand why, AFAIK there's nothing split.  I've been ignoring the problem since the last update to kmymoney (probably 4.7.2 in September last year, possibly 4.7.1 in March last year).  If you want, and I see it again, I'll append more useful details about the circumstances.
Comment 3 Paul Gover 2016-03-08 15:36:03 UTC
Created attachment 97767 [details]
Test empty .kmy file exhibiting the problem
Comment 4 Paul Gover 2016-03-08 15:36:55 UTC
Created attachment 97768 [details]
Screen grab showing the inability to add a new investment
Comment 5 Paul Gover 2016-03-10 12:13:12 UTC
Doh! That minimal file in attachment 1 [details] is useless.  I thought the initial setup wizard had created an investment account to go with the brokerage account that it had created, but no.  When I added an investment account, I could add investments to it as expected.  (So why does the wizard create a brokerage account but no matching investment account?)

I'll try seeing if I can strip down a copy of my live file to something usable that shows the problem.
Comment 6 Paul Gover 2016-03-10 12:17:24 UTC
Not my day.  The attmnt number in the preceding comment should have been 97767.  Number 1 has nothing to do with this bug report.  I didn't realize bugzilla assigned unique numbers, rather than relative ones for each bug.
Comment 7 allan 2016-03-10 12:41:09 UTC
(In reply to Paul Gover from comment #5)
> Doh! That minimal file in attachment 1 [details] is useless.  I thought the
> initial setup wizard had created an investment account to go with the
> brokerage account that it had created, but no.  When I added an investment
> account, I could add investments to it as expected.  (So why does the wizard
> create a brokerage account but no matching investment account?)
> 
> I'll try seeing if I can strip down a copy of my live file to something
> usable that shows the problem.

I ignored the brokerage account you had created and created a new investment account.

I added an initial investment, and the added a second with no trouble.

I don't think modifying your live file would be as helpful, as it could still contain whatever it was that caused your trouble.

So, try using the basic file and see how that goes.
Comment 8 allan 2016-03-10 12:45:11 UTC
Ah, I reread your comment and see that you too had been able to add a second investment.

So it looks like you may have to follow your suggestion and use the live file copy and strip it down.
Comment 9 Paul Gover 2016-03-11 13:20:39 UTC
I tried to reproduce the problem in the old file, and today I can't!

FWIW, yesterday I added the investment to a different account (due to finger trouble), without problem.  Today, I tried adding it to the right account, and got the same message as before.  While I didn't expect it to make any difference, I deleted the stock from the wrong account, and deleted it from the stock tab,  Now I retried adding the stock to the right account, and this time it just worked.

I guess close it as unreproducible.
It's a great program!
Comment 10 allan 2016-03-11 14:02:23 UTC
Just a final thought.

Looking at your attachment, which I think you thought was incorrect, I notice that, while it doesn't exactly correspond with your description of the problem, you said "I had a problem getting to this point - the New investment option on the Investments context menu was greyed out".

However, that account is an asset account, and it should be an investment account.  If I right click on 
Investments, then I too see your screen-grab 97768.  I suspect that this might be the root of the problem.

I'll close the bug, anyway.
Comment 11 allan 2016-03-11 14:50:14 UTC
Oh, and the Brokerage account is showing as an investment account when it should be a checking account.
So, things not quite as they should be.

Allan