[GNC-dev] Auto-incrementing global transaction numbers
Thomas A
thomasa88 at gmail.com
Sat Aug 28 08:10:43 EDT 2021
Hi,
I just started using Gnucash. It works very good!
I need to write a unique number (or ID) on all my receipts, bank
statements, etc. that correspond to a transaction in Gnucash. I found that
I can use the "Num" field in the ledgers for this and also that there is a
shortcut ("+") for incrementing the number. However, the number has a
counter for each account, whereas I need a globally unique number for the
whole book.
I googled a bit, but did not find any recent discussions on a global
automatic number increment for transactions, so I took a stab at the code:
https://github.com/thomasa88/gnucash/commits/transaction-counter
The change adds a counter to File -> Properties -> Counters, called
Transaction number. Every time a transaction with an empty number is saved,
the counter value is filled in into the number field.
Before I do anything more, Is there interest for adding this feature? Is my
solution orthogonal to the Gnucash code architecture?
I think the choice of ID might have to be changed (I used GNC_ID_TRANS for
the counter) and maybe the code is in the wrong place. It works very well
when using the ledger though :).
Things to add: unit test?, doc, enable/disable setting? more?
Future: Error on non-unique value.
BR,
Thomas
More information about the gnucash-devel
mailing list