How to Create Sequence Numbers in Odoo 18
One of these functionalities includes generating sequence numbers automatically, which is essential for tasks like invoice creation, order processing.
Odoo 18 offers a powerful suite of tools for managing various business processes. Whether you’re managing inventory, sales, or finance, Odoo simplifies many tasks for you. For small businesses, having the ability to manage different workflows in an organized and streamlined manner is crucial. One of these functionalities includes generating sequence numbers automatically, which is essential for tasks like invoice creation, order processing, and document management. In this article, we’ll explore how to create sequence numbers in Odoo 18 to ensure your processes remain well-ordered and efficient.
What are Sequence Numbers in Odoo?
Sequence numbers are unique identifiers automatically generated by Odoo when performing specific actions, such as creating a sales order, generating invoices, or issuing delivery slips. These numbers help in keeping records organized and ensure easy tracking of documents.
In Odoo 18, sequence numbers are typically defined for documents like:
- Sales Orders
- Purchase Orders
- Invoices
- Delivery Orders
- Manufacturing Orders
With Odoo for Small Business, having well-organized and trackable sequences is vital for small businesses that handle a variety of operations and paperwork. These sequences can be customized to meet your specific needs, such as including prefixes, suffixes, or specific formats.
Steps to Create Sequence Numbers in Odoo 18
1. Navigate to Sequence Configuration
To start creating sequence numbers in Odoo 18, follow these steps:
- Go to the Settings menu.
- Under the Technical section, select Sequences & Identifiers.
- Choose Sequences.
This will display a list of all the predefined sequences in Odoo. You can modify existing sequences or create new ones depending on your needs.
2. Creating a New Sequence
To create a new sequence, follow these steps:
- Click the Create button in the upper-left corner of the sequence window.
- You’ll be prompted to fill in a few details:
- Sequence Name: This is the name of the sequence, such as "Invoice Sequence" or "Sales Order Sequence."
- Prefix: If you want to add a prefix (like INV- for invoices or SO- for sales orders), enter it here.
- Suffix: If you prefer adding a suffix (like -2025 for invoices in the year 2025), enter it here.
- Next Number: This defines the starting number for the sequence. For instance, if your first invoice will be numbered 1001, set the next number to 1001.
- Padding: The padding ensures that the number is always the same length. For example, setting the padding to 4 means that the number will always have four digits (e.g., 0010, 0011).
- Date Range: Optionally, you can set the sequence to reset based on a specific date range.
Once you’ve filled in the relevant details, click Save to store the sequence.
3. Configuring Sequence for a Document Type
Once you’ve created a sequence, it needs to be linked to a specific document type (such as sales orders or invoices):
- Go to the Sales module (or another relevant module).
- In the settings, locate the section related to sequence configuration (for sales orders, this will be under Sales Settings).
- Find the Document Sequence dropdown menu, and select the sequence you just created.
- Save the settings.
This ensures that every new document of the specified type will automatically use the sequence you’ve defined.
4. Using the Sequence Numbers
After setting up the sequence, Odoo will automatically generate sequence numbers for the relevant documents as soon as they are created. For example, when creating a sales order, the sequence number will be auto-assigned based on the rules you configured earlier.
5. Advanced Customization (Custom Code Example)
In some cases, businesses may need more advanced features, such as generating unique sequence numbers based on specific conditions or creating more complex patterns. Here’s an example of custom code to create a sequence number format that includes the company name as part of the sequence.
from odoo import models, fields, api
class CustomSequence(models.Model):
_inherit = 'ir.sequence'
@api.model
def get_custom_sequence(self, model_name):
# Check if the sequence already exists for the model
sequence = self.search([('name', '=', model_name)], limit=1)
if not sequence:
# Create a new sequence with a custom format
sequence = self.create({
'name': model_name,
'code': model_name,
'prefix': 'COMPANY-' + model_name[:3].upper() + '-',
'padding': 4,
'number_next': 1,
})
return sequence
This custom code ensures that each sequence created for a model includes the company name as a prefix. For example, a sales order might be numbered as “COMPANY-SO-0001.”
Conclusion
Sequence numbers in Odoo 18 play a crucial role in maintaining organized business processes, especially for small businesses that require efficient document and order tracking. By creating customized sequence numbers for your documents, you ensure that your records are always clear, consistent, and easy to trace. If you want to take full advantage of Odoo's capabilities, including its sequence features, consider hiring an Odoo consultant to guide you through the setup and integration process. Get in touch with an Odoo expert today to streamline your business operations!