[Kmymoney-devel] Fwd: Re: A bug in Git master

Allan agander93 at gmail.com
Thu Dec 5 11:54:55 UTC 2013

Hi Chris

Just wondering if you've been able to do any tests for my query, below.

> Another bug found  when importing from OFX direct connect.  The reader trying to create splits cannot find the brokerage account for a split using statementTransactionUnderImport so all the imported transactions are broken.  This is likely because the transaction doesn't know the account name, but m_account does.  A patch:
> *** mymoneystatementreader.cpp.orig     2013-11-24 17:27:39.959812598 -0800
> --- mymoneystatementreader.cpp  2013-11-24 20:01:40.339204121 -0800
> ***************
> *** 565,570 ****
> --- 565,573 ----
>        if (brokerageactid.isEmpty()) {
>          brokerageactid = file->nameToAccount(statementTransactionUnderImport.m_strBrokerageAccount);
>        }
> +     if (brokerageactid.isEmpty()) {
> +       brokerageactid = file->nameToAccount(thisaccount.brokerageName());
> +     }
>        // find the security transacted, UNLESS this transaction didn't
>        // involve any security.

> --
> Chris
Hi Chris

Thanks for this patch, too.  I've found here, though, that
brokerageactid gets over-written a bit later, circa line 1086 in
mymoneystatementreader.cpp -

   // Add the 'account' split if it's needed
   if (! transfervalue.isZero()) {
     // in case the transaction has a reference to the brokerage
account, we use it
>>>    if (!statementTransactionUnderImport.m_strBrokerageAccount.isEmpty() && brokerageactid.isEmpty()) {<<<
       brokerageactid =
     if (brokerageactid.isEmpty()) {
       brokerageactid =
//  There is no BrokerageAccount so have to nowhere to put this split.
     if (!brokerageactid.isEmpty()) {

and I needed to make the change on the line indicated by >>>....<<<, to
avoid that happening.

I'm importing via CSV and there is no mapping of OFX source to an
account for the brokerage/checking account so the user gets asked to
enter this.  If he specifies an existing account, all is well.  If,
however, because he makes a mistake or abbreviates a long name, the
transfer will go to the investment account's associated brokerage
account.  Generally, personally, I don't use these brokerage accounts
because for me, they are not real and I would then have to make a manual

It might be interesting to know what happens with your OFX transfers
if/when they reach this code.


More information about the KMyMoney-devel mailing list