[Kmymoney-devel] A bug in Git master

Allan agander93 at gmail.com
Thu Dec 12 13:45:14 UTC 2013

>> On 08/12/13 17:39, Chris Tucker wrote:
>>> During the OFX import when direct downloading from a bank, the user is not prompted for anything and likely shouldn't be anyway.  The OFX import for an account should have all the information it needs to do the import correctly.  The trouble here is that statementTransactionUnderImport doesn't know the account that is getting the import and so cannot determine the brokerage account.  If we ask m_account (thisaccount from line 556) then we can get the correct brokerage and everything works.
>>> The code at line 1086 suffers the same problem since it asks statementTransactionUnderimport for the brokerage and comes up empty again.  So this section doesn't work either during the OFX import and might even be a bug somewhere else during the import process.
>> Yes, I found both areas had the same difficulty.  I won't commit just
>> yet, because it might be that we're fixing the result of the problem
>> rather than the cause.  I'll see if I can see first why the two existing
>> tests fail.

As far as I can see/find, the reason this test fails -
{in mymoneystatementreader.cpp}
"if (thisaccount.accountType() == MyMoneyAccount::Investment) {
     // determine the brokerage account
     brokerageactid = m_account.value("kmm-brokerage-account").toUtf8();
     if (brokerageactid.isEmpty())" -

is because "kmm-brokerage-account" doesn't get set anywhere.  A similar 
key -
"brokerageaccount" - does get set, but apparently only on direct 
connects, not on local file import.  I have only a cobbled together .ofx 
investment file, and no direct connect capability, so cannot progress 
this aspect further.

There is reference to 'brokerage account' in the code and the OFX spec, 
but, eventually I came to the conclusion that this refers to the 
brokerage from which the data is being downloaded, rather than a KMM 
brokerage account to handle any monetary amounts.

When you said initially "...This is likely because the transaction 
doesn't know the account name, but m_account does.", that isn't quite 
the case.  m_account knows the investment account to receive the import 
because you select the account.  In the absence of brokerageactid, the 
investment account name is by used by 
file->nameToAccount(thisaccount.brokerageName()) to produce a brokerage 
account name by adding the suffix "(Brokerage)".  So, that's where the 
cash sits.

As you know, KMM does not handle cash in investment accounts.  Whilst 
you may view this as 'incorrect', that's how it was written.  If you do 
not like this, then perhaps you should submit a wish-list item. 
However, it would involve a major re-write, I think, and developer time 
is in short supply at the moment, and that's if the change is felt to be 

For now, I'll do a commit of your patches with my minor additions.

Again, though, thanks.


>>> Also, I don't see how you can use an investment account without the corresponding brokerage.  I would prefer not to have two accounts for every investment I have as this makes my account list unnecessarily long (I have 20 investment accounts and so get 40 accounts in the list with brokerage accounts added).  It is also more difficult to work with two accounts rather than having the cash included in the investment account.  But it doesn't look like the investment accounts can handle cash at all so it cannot work properly without the corresponding brokerage account.  I also read that reports won't work properly without the brokerage so I am unsure how you are setup such that you don't need the accounts.
>> There was a bug a while ago that resulted in the premature creation of
>> brokerage accounts, but I fixed that, I think.  I don't use brokerage
>> accounts at all.  I never did, because I never used a broker.  When I
>> create a new investment account, I do not click the box to create one.
>> Instead, when importing, I specify the checking account to use, so the
>> funds end up in a real account, and no extra transfer is needed.
>> I haven't used OFX for a long while and I can't remember the setup
>> process, and Help doesn't help much, either.  But, I did use it without
>> brokerage accounts, so there must be a way.  Oh, wait, I didn't use it
>> for investments, only for checking accounts.  It may be that for you it
>> is using a brokerage account because in the dim and distant past, you
>> told it to.  Perhaps you could set up a new account for the import,
>> without a brokerage account, and perhaps it will now ask which checking
>> account to use, and remember that for next time.  I saw a suggestion to
>> copy your existing file to a new account, which will have a new id,
>> delete the old, then do the import and then rename the account.
>> Allan

On 08/12/13 21:08, Chris Tucker wrote:> I tried playing with the 
brokerage account to get rid of it but since cash is always stored in 
the brokerage for all my investment accounts, there isn't any other way 
to manage it properly.  The best way to handle this would be to have 
cash stored in the investment account so my investment account would 
have a cash balance along with current value of all securities.  But KMM 
doesn't do this and picking a checking account will only move the cash 
to a different account without the brokerage name.  This isn't correct 

More information about the KMyMoney-devel mailing list