Bug 273950 - QIF investment import containing L[parent:sub-account] flagged
Summary: QIF investment import containing L[parent:sub-account] flagged
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.5
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 11:35 UTC by timothy
Modified: 2011-05-27 12:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch file (910 bytes, patch)
2011-05-25 01:51 UTC, allan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description timothy 2011-05-23 11:35:52 UTC
Version:           4.5 (using KDE 1.2) 
OS:                Linux

This query/response from Allan (CSV importer plugin author)  & Thomas Baumgart explains the problem better than I can. 

Hi,

on Saturday 21 May 2011 17:41:10 aga wrote:

> Hi Thomas
> 
> You may have missed this point in this busy thread, but I've been
> helping Timothy with some import difficulties, and one of these
> relates to  importing (of a QIF file) an investment transaction requiring a 
> transfer to/from a checking account.

I saw that and say thanks because I currently don't have too much time for 
support.

> In his QIF file, Timothy has this type of line  'L[Bank Accounts:chq]',
> having setup 'Bank Accounts as an asset type account, and chq as a
> checking sub-account.  He found that those transactions, while
> importing the investment side, did not do a transfer, but were flagged,
> I think, as needing an account.  My understanding is that this is a
> valid construction and should do what Timothy was expecting.
> 
> After some experimentation, I found that provided his accounts were
> already set up as above, the QIF file entry needed to be just '[chq],
> and that would correctly transfer the proceeds to/from the correct
> account.  Incidentally, QIF import also auto-created a top-level 'chq'
> account, which remained empty.  This has at least, got him a way to
> proceed.  Subsequent imports appeared to ignore the new auto account,
> somehow, and go into the correct sub-account.
> 
> Should KMM handle 'L[Bank Accounts:chq]' like this, or is this a bug,
> do you think?  There is a subsidiary question about into which 'chq'
> account the transfer would be made, if there were a top-level or
> su-account of that name.

KMM should support it (well, in fact it's the old QIF importer that does not 
somehow) and it should use it and not a top-level even if it exists. At least 
it seems that this part is working.
-- 
Regards
Thomas Baumgart


Reproducible: Always

Steps to Reproduce:
Requires QIF file with investments transactions NBuyX or NSellX or NDivX which implies a transfer of monies to/from another account indicated by L[parent:sub-account]. File>Import>QIF. Select QIF file; default profile; Source both Bank statement and other.
!Type:Invst

D3/11/04

NBuyX

YsecurityA

I1.311137

Q1,545.613

T2,026.51

L[Bank-Accounts:chq]

$2,026.51

^



Actual Results:  
The file is imported without problems. However in the ledger view of the investment account/securityA, the transaction is flagged (yellow triangle/exclamation). The account field is blank and no money is transferred to the chq account as above

Expected Results:  
It should have done the Buy/Sell with money correctly transferred to/from the specified account and with the account parent:name in the account field

1)As mentioned in the details Allan discovered that the transaction worked correctly if the line in the QIF  was L[chq] and not L[Bank-Accounts:chq]. A side effect was the auto-creation of another chq at top level, but no transfers to this particular account.

2)I should mention that I am running KMM 1.0.5 on KDE 3.5.10. However the problems experienced have been confirmed by Allan who is running KMM 4.5x on up-to-date KDE.
Comment 1 allan 2011-05-25 01:51:00 UTC
Created attachment 60290 [details]
patch file

Proposed fix for this bug.
Comment 2 Alvaro Soliverez 2011-05-25 01:55:51 UTC
Can you submit it through reviewboard, if possible?
Comment 3 allan 2011-05-25 01:58:13 UTC
(In reply to comment #0)
> Version:           4.5 (using KDE 1.2) 
> OS:                Linux
> 
> This query/response from Allan (CSV importer plugin author)  & Thomas Baumgart
> explains the problem better than I can. 
<snip>

> Actual Results:  
> The file is imported without problems. However in the ledger view of the
> investment account/securityA, the transaction is flagged (yellow
> triangle/exclamation). The account field is blank and no money is transferred
> to the chq account as above
<snip>

The account contained in the 'L' record gets passed correctly from
kmymoney/kmymoney/converter/mymoneyqifreader.cpp to mymoneystatementreader.cpp,
as 'brokerageaccount'.  There, however, the 'brokerageactid' does not get set
correctly.  The attached patch appears to fix the problem.

With the patch applied, an 'L' record of 'L[Bank-Accounts:chq]' will generate
automatically those two accounts and correctly transfer money into/from
'Bank-Accounts:chq' .  However the asset account automatically created is of
type 'checking'.  So, to achieve what the OP requires, an account of type
'asset' first needs to be created.  Then, the required result is obtained.  If
both the 'Bank-Accounts' and 'chq' accounts are created manually, the same
result is achieved.

Tested with buy, sell and dividend transactions.  Both QIF and CSV imports now
work correctly.
Comment 4 allan 2011-05-25 01:58:51 UTC
(In reply to comment #2)
> Can you submit it through reviewboard, if possible?

OK
Comment 5 allan 2011-05-25 02:16:38 UTC
On Wed, 25 May 2011 01:51:02 +0200 (CEST)
allan <agander93@gmail.com> wrote:

> https://bugs.kde.org/show_bug.cgi?id=273950
> 
> 
> 
> 
> 
> --- Comment #1 from allan <agander93 gmail com>  2011-05-25 01:51:00
> --- Created an attachment (id=60290)
>  --> (http://bugs.kde.org/attachment.cgi?id=60290)
> patch file
> 
> Proposed fix for this bug.
> 

The patch included with the reviewboard entry should be used, rather
than this one.  Logically, they are identical, but the header kdesvn
produced was incomplete.

Allan
Comment 6 Cristian Oneț 2011-05-27 12:30:56 UTC
http://websvn.kde.org/?view=revision&revision=1233773