tutorial on multi-currency accounting
mta at umich.edu
Tue Mar 6 23:06:46 EST 2007
--On March 6, 2007 4:10:33 PM -0500 Chris Shoemaker
<c.shoemaker at cox.net> wrote:
>> Here's a brief summary of what I've done so far (all of these
>> changes are under control of a new preference and things work as
>> before if it is off):
>> - Changed xaccTransGetImbalance to return a list of all the
>> imbalances in the transaction. The list will contain an entry for
>> each commodity that is not balanced or for the transaction value if
>> the new preference is off and it is unbalanced. This required
>> adding a new data type (or at least I couldn't find an existing
>> data type for it) similar to the commodity-collector used in Scheme
>> code. The old version is now called xaccTransGetImbalanceValue and
>> is still used in a few places.
>> - xaccTransScrubImbalance now scrubs the transaction two ways. It
>> makes sure the value is balanced, and it makes sure that the amounts
>> balance separately for each commodity in the transaction. This
>> makes capital gain splits as created by scrubbing lots unnecessary,
>> although existing capital gains splits won't hurt anything.
> I assume this is done by auto-creating currency-accounts?
You mean the old 1.8 currency accounts? No, I don't use them. I don't
recall what they were like and I'm not sure if it's a good idea to
recycle them for this purpose or not. Right now it creates top level
Imbalance-xxx accounts for this just like it does for value imbalances.
I will probably change this to look for a Currency place-holder account
and find (or create) an income account below this as suggested in
Peter's document. This creates Income accounts which have a
non-currency commodity (which works fine), so I probably should make it
possible to create them manually too. Or maybe I'll look into using
currency accounts if I can do that in a way that won't break backwards
compatibility with 1.8 (at least not too badly). This is something
that can fairly easily be changed, of course.
>> - gnc_split_register_get_debcred_entry shows the split amount
>> instead of the split value. It also shows the commodity symbol
>> unless the commodity is the register's commodity or the split has
>> the focus.
> I think it's likely that users will want to see both in some cases.
> This is one of the things that is much easier with the register
Yes, I agree, but that's more than I wanted to do now, especially with
the rewrite under way.
>> - The balance sheet report (as patched for bug 131623) is changed to
>> not compute unrealized gains if the new preference is on since they
>> will already be accounted for if all transactions are balanced.
> I don't know if this will work as a preference in the long-term.
> Being a preference means you might have some transactions created
> while it's on and some while it's off. Unless that preference is
> recorded in each Transaction, it might be better to leave the
> calculation of unrealized gains in the report. (Of course, it would
> still need to be fixed up in that case.)
I agree that having it as a preference feels wrong. Perhaps we should
make it an attribute of the book. I don't think it should be an
attribute of the transaction since it only matters if all transactions
are balanced for commodities. Having some balanced and some not is no
better than having none balanced as far as computing unrealized gains.
>> The main thing I haven't done yet (other than more testing) is to
>> change gnc_split_register_save_amount_values to be compatible with
>> the change to gnc_split_register_get_debcred_entry.
> Brave, brave man. Good luck.
Thanks, we'll see how it goes.
More information about the gnucash-devel