The Id Tool allows to generate many kinds of ids. It can be used in order to
generate several sequences of strings or numbers.
Table of Contents
First you must choose a id generator for your new sequence, this one is used to
generate and store the id of the sequence. The id generators are defined on
portal_ids in your instance erp5. By default you can use the id generator
"document" to store the id only in the ZODB otherwise the id generator
"uid" to store in MySQL and in the ZODB.
Second you must define a name for your new sequence, it can be any string.
Let's say you want a sequences for all your orders, you may decide to use
the name "order_reference" for your sequence.
By default the id tool can automatically generate simple sequence of integers
by increasing them one by one. The default value which will be used in order
to initialize your sequence is 0 but you can set a default value.
new_id = context.portal_ids.generateNewId(id_generator='document', id_group='order_reference', default=4)
You may call this method each time you need it, each time it will returns a number bigger and bigger :
first time : 4
second time : 5
third time : 6
and so on...
It is possible to clear an id generator to delete all the sequence ids defined
on the id generator given.
By example, it's use to call again the sequence with a new default value
context.portal_ids.generateNewId(id_generator='document', id_group='order_reference', default=8)