Bug 296883 - OFX and QIF import of investment Buy / Sell transactions not assigned to brokerage account
Summary: OFX and QIF import of investment Buy / Sell transactions not assigned to brok...
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 4.6.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-27 14:15 UTC by timothy
Modified: 2021-05-04 22:13 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.1


Attachments
snapshot of the buy error with blank Account information (140.88 KB, image/jpeg)
2012-03-27 14:15 UTC, timothy
Details
Patch to use brokerage account as default for buy/sell (1.81 KB, patch)
2012-12-10 14:56 UTC, George Baltz
Details
OFX file which exhibits the problem (3.50 KB, text/plain)
2014-11-12 20:29 UTC, Jack
Details
Anonymous .kmy file which exhibits the problem (203.50 KB, application/x-kmymoney)
2014-11-12 20:31 UTC, Jack
Details
OFX -> KMyMoney transaction field mapping for specific investment transaction (53.63 KB, application/pdf)
2018-08-26 07:51 UTC, Thomas Baumgart
Details
attachment-17424-0.html (2.57 KB, text/html)
2019-03-06 13:38 UTC, Caio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description timothy 2012-03-27 14:15:31 UTC
Created attachment 69937 [details]
snapshot of the buy error with blank Account information

I am running KMM 4.6.1 on Mint12 with Classic desktop.
also tested on KMM 4.6.0 on Ubuntu 11.10 with Classic desktop

Note: This error occurs in both QIF and OFX imports
          This error occurs in both investment Buy and Sell transactions
 
When I import an OFX investment 'Buy' transaction, the ledger entry for
'Buy Shares' shows a yellow triangle-exclamation in the equity account.

The problem is that the transaction is not assigned to an account whch 
should be debitted for the payment of the shares bought. This
should be the brokerage account for this equity account. There is
consequently no corresponding Payment 'Buy' transaction in the brokerage
account.

When the brokerage account is manually assigned the transaction performs
correctly and a corresponding entry is placed in the brokerage account.

I have tried the same investment transaction with a QIF file and the
same error occurs. 

I checked with KMM 4.6.0 on Ubuntu 11.10 and the same error occurs.
Comment 1 timothy 2012-03-28 09:34:11 UTC
The share total balance is increased by the number of shares bought, but the amount paid is zero.
Comment 2 George Baltz 2012-12-10 14:56:57 UTC
Created attachment 75767 [details]
Patch to use brokerage account as default for buy/sell

Patch checked out on QIF file imported from Moneydance.
Comment 3 George Baltz 2012-12-10 15:00:16 UTC
I ran into the same problem on the current GIT version of KMM (4.6.90), openSUSE 12.2.
Comment 4 Jack 2014-01-07 22:09:23 UTC
I confirm this in 4.6.3 with OFX, even if the brokerage account name is set to the default of the investment account name followed by ' (brokerage)'.  However, editing the imported transaction and specifying the brokerage account does fix the transaction - leaving a correctly incremented number of shares and the correct purchase price deducted from the brokerage account.  Interestingly, when I hover over the transaction in the ledger, the error is missing category, which might technically be correct, but that terminology seems to apply to a normal transaction not to an investment transaction.
Comment 5 Jack 2014-11-05 14:10:06 UTC
While this issue is still present, there does seem to have been an improvement.  (I think the change is present in 4.7, but I will have to reconfirm.)  Now, the error shows up on import, but as soon as I open the transaction for editing, the brokerage account is filled in correctly.  However, if I click "Accept" (before editing) then the yellow background (showing imported) goes away, but the status does not change to "cleared" and if I then edit, although the brokerage account is filled in, the "Enter" button is not available until I change the status.  I will try to create a test file, but as I do most of my investment imports with OFX direct, I'll have to try to capture one of those transactions in a file.
Comment 6 Jack 2014-11-12 00:12:56 UTC
When I create a new .kmy file to test, this works fine, indicating the brokerage account on import, no intervention required.  I'm still seeing the issue with my own file, but it may be related to how I created the investmenta and brokerage accounts (long ago).  I did not initially accept the default, and used a non-standard name for the brokerage account, later renaming it to the standard format.  However, creating a new file and renaming the brokerage account like this also works correctly.  Since it will not be reasonably possible to pare down my own file to submit, I'm going to say this is resolved, unless anyone else is seeing the problem.  (I confirm with git master, but I don't have 4.7 installed.)
Comment 7 Cristian Oneț 2014-11-12 07:28:34 UTC
It would be nice if you could find the difference between the new file and your file. If you have that we can conclude if there is a bug or not, did you try creating an anonymous file?
Comment 8 Jack 2014-11-12 20:03:37 UTC
The anonymous file is about 6MB.  Should I just attach it, or try to delete unnecessary accounts and stuff?  Also note, the anonymous file loses the proper matching name of the brokerage account, although it does show this problem with or without renaming the brokerage account.
Comment 9 Jack 2014-11-12 20:29:51 UTC
Created attachment 89563 [details]
OFX file which exhibits the problem
Comment 10 Jack 2014-11-12 20:31:00 UTC
Created attachment 89564 [details]
Anonymous .kmy file which exhibits the problem
Comment 11 Jack 2014-11-12 20:35:24 UTC
I was able to get the file down to ~200KB.  If you import the ofx file from comment 9 into the anonymous kmy file from comment 10, importing into account A000255, both imported transactions show the problem.  If you rename account A000256 to "A000255 (Brokerage)" and then import, the problem still happens, but as soon as you edit one of the imported transactions, the brokerage account is filled in.  Also note the newly discovered issue that in the two situations (renaming the brokerage account or not) the imported transactions are different, but that's a bug for a different report.
Comment 12 Cristian Oneț 2014-11-13 07:56:48 UTC
I'll take a look at it sometime next week, thanks for creating the necessary test data.
Comment 13 Cristian Oneț 2014-12-04 22:27:50 UTC
OK, reproduced the problem looking at what is causing this.
Comment 14 Cristian Oneț 2014-12-04 23:01:16 UTC
I found what's causing the pre-fill behavior it's Activity::preloadAssetAccount(). I assume we would need the same logic in the importer but I need to think about this after a good night's sleep.
Comment 15 allan 2014-12-04 23:16:42 UTC
This refers both to OFX and QIF (in 2012).  Is there still aproblem with QIF import?  In what way?

I used to have problems with QIF when importing a new investment, which also, and unwanted by me, automatically created the (Brokerage) account even if the transactions included an existing check account to use.  I much later incorporated a fix which created the Brokerage account later, and only of needed.

It may be that the QIF issue no longer exists, or then....  Has anyone noticed?
Comment 16 Jack 2018-07-16 22:31:40 UTC
I don't know if the patch Cristian created would even be applicable to 5.x, but the problem seems to be still present, although perhaps slightly changed.  Importing OFX now prompts me for the brokerage account, even when it does use the default name.  I will try with the attached sample files, but I'd love to know if I'm the only one seeing this issue.  (Happens with OFX file or direct connect.)
Comment 17 Jack 2018-08-01 19:00:50 UTC
This is still present in git master.  If I import ofx, even if the brokerage account has the default name, I am prompted for the name of the brokerage account every import.  Even worse, with the recent change to not pop up a status for every account, if you Update All Accounts, you don't know which account is being prompted for, making it useless to to that with multiple investment accounts.
Comment 18 Thomas Baumgart 2018-08-26 07:51:52 UTC
Created attachment 114609 [details]
OFX -> KMyMoney transaction field mapping for specific investment transaction

Taking the attached OFX file and a manually entered reinvestment transaction I think one could implement the attached conversion. I have no idea if this makes sense and supports the necessary reporting requirements as it is simply based on current existing logic. Comments welcome.
Comment 19 Caio 2019-03-06 13:38:40 UTC
Created attachment 118592 [details]
attachment-17424-0.html

 I recently downloaded Kmymoney 5.0 for windows 8.1. I had an unpleasant
surprise, because using OFX to download the bank statement is not working
for banks here in Brazil - English version - there is no Portuguese version
- because in previous versions this always worked well. Now, even wanting
to go back to previous versions, they do not work as they did before. I've
used more than one browser to see if the problem would resolve itself, but
it was in vain.

Em seg, 16 de jul de 2018 às 19:31, Jack <bugzilla_noreply@kde.org>
escreveu:

> https://bugs.kde.org/show_bug.cgi?id=296883
>
> Jack <ostroffjh@users.sourceforge.net> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|
> |ostroffjh@users.sourceforge
>                    |                            |.net
>
> --- Comment #16 from Jack <ostroffjh@users.sourceforge.net> ---
> I don't know if the patch Cristian created would even be applicable to
> 5.x, but
> the problem seems to be still present, although perhaps slightly changed.
> Importing OFX now prompts me for the brokerage account, even when it does
> use
> the default name.  I will try with the attached sample files, but I'd love
> to
> know if I'm the only one seeing this issue.  (Happens with OFX file or
> direct
> connect.)
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 20 Jack 2019-03-06 17:40:03 UTC
Ciao-please provide some more information.
- Exactly which version are you using and from where did you download it.
- What do you mena by "not working?"  At what point in the process does it fail?
- Have you tried both direct connect and importing a manually downloaded file?
- Are you getting any error message?
Also, note that this bug is about the import not properly assigning the brokerage account for an investment transaction which needs one, it is not about ofx import failing.
Comment 21 Jack 2019-08-04 21:56:51 UTC
(In reply to Jack from comment #17)
Comment #17 still applies:  If I import ofx, even if the brokerage account has the default name, I am prompted for the name of the brokerage account every import.  And, without a status pop-up for every account, if you Update All Accounts, you don't know which account is being prompted for, making it useless to do that with multiple investment accounts.

Not sure if this needs to be renamed, or split into more than one bug.
Comment 22 Jack 2021-05-04 15:02:45 UTC
I don't know if this was explicitly addressed, or if it got fixed as part of some other commit, but I no longer seem to have this problem.  There are rare cases where I am still prompted for the name of the account being imported, but it is not related to investment/brokerage accounts.  If nobody else reports still seeing this issue, I'll close this as WORKSFORME in a week or two.
Comment 23 Dawid Wróbel 2021-05-04 22:08:09 UTC
Jack, I believe it could have been fixed by https://invent.kde.org/office/kmymoney/-/commit/dcdd81c2cbc1f1df94c34fb5e5944bb24be8a98b
Comment 24 Jack 2021-05-04 22:13:55 UTC
That looks right.  I'll close as fixed, using that commit, and 5.1.1 as version.