Bug 213250 - QIF Import creates numerous Unneeded Accounts
Summary: QIF Import creates numerous Unneeded Accounts
Status: RESOLVED FIXED
Alias: None
Product: kmymoney2
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-05 14:03 UTC by allan
Modified: 2014-07-17 21:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description allan 2009-11-05 14:03:47 UTC
Version:           1.0.2-CVS (using KDE 4.3.1)
OS:                Linux
Installed from:    Compiled From Sources

I have imported from Quicken 2002 a file containing Accounts List, SecurityList, and Transactions for an investment account.  There is no brokerage account in Quicken, and the file has not been modified in any way, just imported.

The import completes successfully, but the particular account appears five times, as follows:-
1) Account name              	  Type - Investment
2)	"                    	  Type - Stock
3) Account name (Brokerage)       Type - Current	- empty
4) Account name (Investment)      Type - Investment	- empty
5) 	"		          Type - Stock		- empty

This sort of duplication occurs every time for me.

Allan
Comment 1 Thomas Baumgart 2009-11-05 18:53:09 UTC
That is partially by design, though it looks at bit awkward that there is a second investment type account.
Comment 2 allan 2011-05-13 19:23:14 UTC
Perhaps this may be closed?
Comment 3 allan 2012-12-18 00:36:39 UTC
(In reply to comment #2)
> Perhaps this may be closed?

Perhaps not, yet.

I thought I'd take another look at this, and I've been able to simplify things.

I found that the problem I had with - 
4) Account name (Investment)      Type - Investment	- being created when there was already an investment account was the result of a problem in the input file, where an account type of 'Mutual' was used.  This was for a UK unit trust fund, which is equivalent/similar to the US mutual fund.  I notice in the code,  a line - 
'else if (type == "mutual") { // stock account w/o umbrella investment account'.
In my case, however, I did have an umbrella investment account.  Editing the file to have an account type of 'Invst'  stopped that duplication.

Problem lines 2) and 5), I've not seen recently, but I think, were also the result of the same problem, so that leaves just the  account 'Account name (Brokerage)' being created, unnecessarily in my case.

As I don't have any genuine Brokerage accounts, and using the same file as above, in a DivX entry, I removed the 'L' line, and the amount concerned landed in the Brokerage account that had been created, so that seemed to be working as expected.

However, as that file was pretty large, I created in Quicken a much smaller one with all proceeds retained in the investment account.   Just for a change, though, I used a sell instead of a DivX.  Strangely, that didn't work, the sell amount was not transferred to the Brokerage account, and the item was flagged as missing an assignment.

When I compared the code for DivX and Sell, I noticed that in the DivX section - 
'if ((xAction == true)' failed, tr.m_strBrokerageAccount was set to m_account.brokerageName().

So, in the Sell section, I tested for an empty 'L' line and then also set tr.m_strBrokerageAccount  to m_account.brokerageName().  This import now worked.  Also, after reinserting the original transfer account name, that too worked.
Comment 4 allan 2013-01-16 23:46:37 UTC
Git commit 06493e0c02f7e6467f5b7d98724f0864c289b500 by Allan Anderson.
Committed on 16/01/2013 at 14:17.
Pushed by allananderson into branch 'master'.

M  +27   -46   kmymoney/converter/mymoneyqifreader.cpp

http://commits.kde.org/kmymoney/06493e0c02f7e6467f5b7d98724f0864c289b500
Comment 5 allan 2013-01-17 16:33:34 UTC
Git commit 8eeb1bfd57d769beed37044e786b08d3d1b3cb29 by Allan Anderson.
Committed on 17/01/2013 at 12:05.
Pushed by allananderson into branch 'master'.
Revert astyle/normalize signature normalization change.

M  +1    -1    kmymoney/converter/mymoneyqifreader.cpp

http://commits.kde.org/kmymoney/8eeb1bfd57d769beed37044e786b08d3d1b3cb29
Comment 6 Cristian Oneț 2014-07-17 07:00:29 UTC
While working on BUG 337251 I noticed that the fix for this bug will cause the brokerage account to not be created when importing this file https://bugs.kde.org/attachment.cgi?id=87747 leaving the transaction unassigned. While on 4.6.x the brokerage account is created and the transaction is assigned. I tend to think that the 4.6.x behavior is the expected one, could someone with more QIF/investments knowledge confirm this?
Comment 7 allan 2014-07-17 10:10:32 UTC
(In reply to Cristian Oneț from comment #6)
> While working on BUG 337251 I noticed that the fix for this bug will cause
> the brokerage account to not be created when importing this file
> https://bugs.kde.org/attachment.cgi?id=87747 leaving the transaction
> unassigned. While on 4.6.x the brokerage account is created and the
> transaction is assigned. I tend to think that the 4.6.x behavior is the
> expected one, could someone with more QIF/investments knowledge confirm this?

I think I'd better have a look at this.
Comment 8 allan 2014-07-17 21:39:54 UTC
What we have here is another example of how QIF file formats may differ.  I have referred to three different sources:-Intuit, GnuCash, and Wikipedia.
The first two indicate that investment transactions include an 'L' record - 
L      Account for transfer
       (category/class or transfer/class)
       (For MiscIncX or MiscExpX actions, this will be
       category/class|transfer/class or |transfer/class).

The third mentions -
Codes (actions) that end in X indicate that the transaction was generated by the account, but the cash is transferred to a different account (in which case the Category field is the destination account name). It also mention -
"... account name contained in brackets, such as [Checking Account]. The brackets reference another quicken account, and if left in place will post a transaction in that account "

This QIF file includes neither an 'L' record nor brackets.

The original bug, raised by me, was also the subject of https://git.reviewboard.kde.org/r/107797/.