Commodities questions/issues
Phil Longstaff
plongstaff at rogers.com
Sun Nov 5 11:30:57 EST 2006
Some questions about how commodities are handled.
1) I create a new account with a currency as its commodity. There is a
commit for the commodity (actually, there are 2 - once because of
gnc_commodity_set_quote_flag and once because of
gnc_commodity_set_quote_source - both called from
xaccAccountSetCommodity - could they be combined?). I will need a
unique key for the commodity, so I am using the guid. However, if I
shut down and restart GC, the currencies are recreated in GC with
different guids, so if I create another account with the same currency
guid, that currency exists twice in the same db. I need to use the guid
for any commodity other than currencies, because there is nothing else
to tie the db entity to the GC entity. I notice that the XML backend
doesn't store the guids for commodities, but stores namespace/mnemonic
pairs. This won't work for the gda backend because as I said, there is
no tie between the db entity and the GC entity.
Solutions:
a) load the currencies on startup and have GC automatically create the
ones which weren't in the db.
2) If I use the security editor to create a commodity, that commodity is
committed OK. If I then remove the commodity, there is no commit to
delete it. I imagine this works fine with the XML backend but it
doesn't for the gda backend.
Phil
More information about the gnucash-devel
mailing list