In Odoo, the standard document numbering system (e.g. for sales orders, invoices) is perfectly good for most organizations, but it’s quite simple to configure it to work differently.
Start by enabling developer mode and navigating to Settings / Technical / Sequences
Here’s an example of invoice numbering
- Name is for information only
- Sequence Code is optional. If you create a new Sequence Code to use in an Automated Action you should give it a code.
- Implementation is “Standard” or “No Gap”. As invoices are financial documents, it’s important not to have gaps in the numbering, so the latter option is selected.
- Company can be left blank if you want numbering to be common across all companies, or you can specify different numbering for each company. In this example the company name (not shown) starts with “T” so that is used in the prefix.
- Prefix and Suffix can be a combination of fixed elements and variables (year, month, day, time). See below for more information
- Odoo allows sub-sequences by date range (see below)
- Sequence size needs to be large enough to cover the expected number of documents (3 = 1-999, 4 = 1-9,999, 5 = 1 – 99,999, etc.)
- Normally the step will be 1
- Next Number defaults to 1
- It could be set to something else if you already have documents from an old system and don’t want to re-use those numbers.
- It is automatically updated as documents are created
- Sequence ranges can be setup if required, which would allow you to restart numbering each month, week or year. See below for more information.
- If you don’t set them up, Odoo will automatically create them for the year (but not for other periods).
Prefix and Suffix
The document number will be
- Prefix (if defined)
- Sequence Number
- Suffix (if defined)
Typically in Odoo, only the prefix is used, so you have an invoice number like T/INV/2020/0005
- the prefix is T/INV/2020/
- sequence number is 0005
- there is no suffix (but this can be defined if needed)
The prefix in this example is defined as T/INV/%(range_year)s/: and this can be broken down to three elements:
- T/INV is hard-coded. All invoices (in this company) will start with this. Obviously you can change this to whatever you want!
%(range_year)sis where we specify that the year will be used. There are many other options, as explained below.
- /: simply adds the ‘/’ before the sequence number
Odoo has many different date / time options:
- Current Year with Century:
- Current Year without Century:
- Day of the Year:
- Week of the Year:
- Day of the Week:
- 0 = Monday, 1 = Tuesday…
- Hour 00->24:
- Hour 00->12:
In addition, all of these variables can be prefixed with range_ (e.g. range_year in the above example). In fact, this is the default in Odoo (so document numbers contain the year followed by a sequence number). This uses the number ranges:
It makes sense that if you include the year (or other date) in the prefix you also want to have numbering reset for each year rather than a continually increasing number.
To set this up:
- Tick the box: Use subsequences per date_range
- Enter periods and a starting number (optional if using year)
- Use range_year or range_month (etc.) in the prefix
If you don’t create a date range, Odoo will automatically create one for the calendar year (as per the above example), but you will have to create the monthly, weekly, and other ranges manually.
This is quite simple once you understand how it works!
Other documents in Odoo (e.g. Sales Orders and Purchase Orders) don’t include the date and simply have a running sequence number
The differences are:
- Implementation is “Standard” (it doesn’t matter if some numbers are missed)
- Sequence Size is 5 (allowing for 99,999 orders).
- No sub-sequences per date range
You could remove the year from invoice numbers (e.g. INV/00001, INV/00002…), in which case, it’s probably better to increase the sequence size.
Note that if you find that you are running out of numbers, it is possible to change the numbering system later, and there are several options
- Change the prefix
- Add a suffix
- Increase the sequence size
- Start using year with sub-sequences
In most cases that won’t create duplicate document numbers, but you should check