Arunima PMay 22, 2019
In Odoo, the system can automatically create sequence for each record when it create. We can configure the sequence number as our wish. For example, in sales order or invoices each records are distinguished by their sequence number. This blog explains how to add or modify a sequence for records in Odoo in a simple way.
Activate Developer Mode
Technical --> Sequences
Create or Modify Sequence
Click on create button and then fill the record.
You can enter a prefix or suffix and the sequence size as you like.
Note that sequence code is an important field. Because, the sequence will created on the corresponding sequence code. Here the sequence code I enter is 'sale.order' . Sequence code for sale order is 'sale.order'.(sequence code may be same as class name).
Test your sequence by creating corresponding record, Here I create a new sale order.( because I create sequence for sale order).
Check your sequence, next number will be changed.
Sub sequences
You can create sub sequence per month , month, day, week etc.
Check Use sub sequences per date range.
When sun sequences per date range are used, you can prefix variables with 'range_' to use the beginning of the range.
eg:-
Here I set Prefix as ST/%(range_year)s/%(range_month)s/
Then the corresponding record sequence will be like this
After creating corresponding record , system will fill the date range line.
Here the sequence ST/2019/04/0002 is in April 2019, which is in the date range January 2019 - December 2019 .
So the date range will fill from 01/01/2019 to 12/31/2019.
In such a way create sequence in odoo is very simple.
0