[BUG] Editing in Register of Currency accounts

Christian Stimming stimming@uclink.berkeley.edu
Wed, 06 Sep 2000 13:52:50 -0700


Hi,

There's a bug in the current gnucash version (both 1.4.5 and current
1.5.x) concerning the editing of transactions in the register of
Currency accounts. 

For example, you have accounts "USD Cash" and "DEM Cash" of currency USD
and DEM, respectively, and want to buy DEM with your USD. You then
create an account "Trading" accout of currency USD with security DEM.
You buy DEM 100 for the price of 0.5 which transfers USD 50 from your
"USD Cash" to "Trading" account. 

The bug is the following: If you want to *edit* that transaction and
transfer DEM 100 to your "DEM Cash" account instead of buying them from
the "USD Cash" account, gnucash will complain: "You cannot transfer
funds from the DEM Cash account. It does not have a matching currency."
And the transfer field will remain on "USD Cash". It is not possible to
change the "destination currency" of a transaction; the only way to do
this is by deleting the old transaction and creating a new one.

The annoying point is that this also occurs through the auto-completion
feature. If you try to enter a transaction with the same comment as one
before, you cannot transfer the money to an account with another
destination currency.

Ok. How can this be fixed? I need some conceptual comments. The failed
test for the (otherwise accepted) currency is called from
SplitLedger.c:{2559,2563,2633,2637} (v 1.4.5) or
SplitLedger.c:{2599,2603,2672,2676} (v 1.5.x) with the call
xaccTransIsCommonCurrency(trans, currency) . If this is done while
*editing* a transaction (e.g. "USD Cash"->"Trading") or, more precisely,
editing one split of a transaction, then the old split is still a valid
entry in the splits-List! That means, the function
xaccTransIsCommonCurrency looks whether "DEM Cash" has a common currency
with "Trading", which is true, *and* "USD Cash", which is false and
causes the error message. 

Fixing this would mean that xaccTransIsCommonCurrency should exclude the
old split when looking for a common currency. Either this function
should be extended like "exclude this or this split when comparing
currencies" or the old split should be deleted before the function is
called. What do you suggest?

Christian Stimming