request for comments on inventory experiment
lianto.ruyang at gmail.com
Sun Dec 30 08:11:31 EST 2007
After months of experiments and reading the source code, i've finally have
some fixed idea on how to implement inventory system on gnucash.
I am gonna use "lots" to implement the inventory, it's been said in
lots.txtin the source code about how "lots" is needed to implement
correctly, but not until recently the idea on "how to do it" came to my
My idea is:
there's an "Inventory" object per book, this object will hold merchandise
objects which i call "Goods" (if someone has better idea in those names
please tell me :).
A "Goods" will keep a list of "lots" which record the buying & selling
(going in the inventory & going out the inventory)
of the merchandise. We can compute the value and amount of a "goods" at a
time from those lots.
We also gonna need a "asset" account to record the value of inventory all
the time, so i add a new account type: an "Inventory Account". There's no
limitation on how many kind of goods an "Inventory Account" can record and
we can have as many "Inventory Account" as we want. The only rule is a
"goods" must be recorded in only one "Inventory Account".
|--- Inventory (goodsA, goodsB, goodsC)
|---Inventory Account 1
| |---lots (goodsA's lots + goodsC's lots)
|---Inventory Account 2
| |---lots (goodsB's lots)
The only difference of an "Inventory Account" with other type of accounts
is: the lots in "Inventory Account" will have a path "goods-guid" in its
slot, pointing to a goods' GUID.
So in the above example some of "Inventory Account 1" lots will have a path
"goods-guid" pointing to goodsA's GUID, an the rest will be pointing to
Currently i have written the core code for this "Inventory system" and now
working on the GUI codes. The next step which i'm still completely clueless
is how to integrate this idea to the current code, such as how to make the
engine code to put "lots" into the "Goods", how to recompute the amount and
value of goods if the Account change its lots, etc
If i understand the code correctly, the lots supposed to be created when a
transaction is entered, after the transaction's splits is created, i'm
guessing that's "where" i should put my modification so the lots not only
saved into an "Account" but also to a "Goods".
I hope my description is quite clear and understandable. I need inputs from
all of you whether this idea is good enough for an inventory system in
gnucash and can be developed for future needs, any ideas, any directions
will be greatly appreciated.
Wish you all a happy new year.
"Whatever the mind can conceive and believe, the mind can achieve."
Dr. Napoleon Hill
More information about the gnucash-devel