Crash in multi-currency transactions
Christian Stimming
stimming at tuhh.de
Thu Sep 4 15:34:20 CDT 2003
Tobias & Nicole Krais schrieb:
>>> GnuCash does not crash anymore. Good job! But: the amount isn't still
>>> set properly. When I import a multicurrency transaction via HBCI, the
>>> amount is only properly set in the account in which I use HBCI, the
>>> other account remains without a value.
>>>
>> The fix was a quick workaround to avoid the crash. The fundamental
>> problem is how do we tell what the amount is in a different currency?
>> Ask the user?
>> Look it up online? For what date?
>
> GnuCash knows when it is a multicurreny transaction. One account in
> GnuCash is in EUR (my German account) and one is in CHF (Swiss).
I think two different things get confused here with each other.
First, there was a bug in imported transactions where the other gnucash
account had a different currency. This bug used to cause a crash, which
has been fixed in 1.8.5. Nevertheless Tobias mentioned the amount in the
other account "remains without a value", which is still a bug -- the
amount in the other account *should* be set to the same amount as in the
originating account, i.e. with a hypothetical exchange rate of exactly
one point zero. This is our current workaround because the importer
isn't yet set up to retrieve the real exchange rate from anywhere.
Tobias, if there still is no amount in the other account (even after
including my patch last week) then please report so. There should be the
same amount as in the originating account.
> In case the importer imports a transaction which is a multicurreny
> transaction,
*Now* we are discussing how the actual implementation of multi-currency
transactions should be organized (which is a totally different issue
from the bug above). In this case I would like to mention that in
principle, the HBCI protocol gives gnucash the correct exchange rate and
foreign amount (and even additional charges) for *each* transaction that
involved foreign currencies. However, our current hbci library
(OpenHBCI) didn't yet implement this information (see
http://openhbci.sourceforge.net/doc/api/classHBCI_1_1Transaction.html
HBCI::Transaction::originalValue() ). This means the information is
probably already there, but it is not yet accessible by gnucash.
In the long term it means the HBCI module will provide the foreign
amount / exchange rate for each multi-currency transaction, and the only
extensions necessary in the importer is to accept this provided foreign
amount somewhere and store it in the gnucash transaction. In fact this
might already be possible today (implementation details follow): For a
transaction from (HBCI-enabled) EUR account to a CHF account, the HBCI
module can simply create a transaction with *transaction* currency CHF,
insert the first split into the EUR account with the *amount* set to the
EUR amount and the *value* set to the CHF value. Then, upon finishing
this transaction, the import-backend will automatically add a second
split with amount *and* value set to the CHF value. The import-backend
already does the RIGHT THING as long as the transaction's currency is
identical to the other account's currency, and this is absolutely
independent of whether the txn's currency is identical to the
originating account's currency or not.
Christian
More information about the gnucash-devel
mailing list