How to Create Sequence Numbers in Odoo 18
In this blog post, we’ll dive deep into how you can create and customize sequence numbers in Odoo 18, ensuring your business processes are as efficient and organized as possible.

If you’re using Odoo Open ERP to manage your business operations, you already know how versatile and powerful this platform can be. From streamlining workflows to automating repetitive tasks, Odoo is designed to make your life easier. One of its most useful features is the ability to generate sequence numbers—unique identifiers for invoices, sales orders, purchase orders, and more. In this blog post, we’ll dive deep into how you can create and customize sequence numbers in Odoo 18, ensuring your business processes are as efficient and organized as possible.
Why Are Sequence Numbers Important?
Sequence numbers are the backbone of organized business operations. They provide a unique identifier for every transaction, making it easier to track, search, and analyze data. Imagine trying to manage hundreds of invoices without a proper numbering system—chaos, right? Sequence numbers eliminate this chaos by ensuring every document is uniquely identifiable and follows a logical order.
In Odoo, sequence numbers are not just limited to invoices. You can use them for sales orders, purchase orders, delivery orders, and even custom models. The best part? Odoo allows you to fully customize these sequences to fit your business needs. Additionally, if you're looking to enhance your workflow even further, exploring the 20 Best Odoo Community Apps for Creators can provide you with innovative tools that integrate seamlessly with your existing systems.
In Odoo, sequence numbers are not just limited to invoices. You can use them for sales orders, purchase orders, delivery orders, and even custom models. The best part? Odoo allows you to fully customize these sequences to fit your business needs.
Steps to Create Sequence Numbers in Odoo 18
Creating sequence numbers in Odoo 18 is a straightforward process. Let’s break it down step by step.
1. Access the Sequence Configuration
To get started, log in to your Odoo instance and navigate to the Settings menu. From there, go to Technical > Sequences & Identifiers > Sequences. This is where you’ll find all the existing sequences and create new ones.
2. Create a New Sequence
Click on the Create button to set up a new sequence. Here’s what you need to fill out:
- Name: Give your sequence a descriptive name. For example, if you’re creating a sequence for invoices, you might name it “Invoice Sequence.”
- Prefix: This is the text that appears before the number. For invoices, you might use “INV/” or “INV-”.
- Padding: This defines the number of digits in the sequence. For example, if you set the padding to 5, your sequence numbers will look like 00001, 00002, and so on.
- Next Number: This is the starting point for your sequence. If you want your first invoice to be numbered 1000, set this to 1000.
- Increment: This specifies how much the sequence should increase by. Typically, this is set to 1.
3. Assign the Sequence to a Model
Once your sequence is created, you need to assign it to the relevant model. For example, if you’re creating an invoice sequence, go to the Accounting module, open the Journal settings, and assign the sequence to the appropriate journal.
4. Test the Sequence
After setting up the sequence, it’s time to test it. Create a new record (e.g., an invoice) and check if the sequence number is generated correctly. If everything is configured properly, you should see the sequence number in the desired format.
Custom Code: Advanced Sequence Configuration
While Odoo’s default sequence configuration is powerful, there may be times when you need more control over how your sequence numbers are generated. This is where custom code comes in. Below is an example of how you can override the _get_last_sequence method to create a custom sequence logic:
python
Copy
from odoo import models, fields, api
class CustomSequence(models.Model):
_inherit = 'ir.sequence'
@api.model
def _get_last_sequence(self, sequence):
# Call the original method to get the last sequence
last_sequence = super(CustomSequence, self)._get_last_sequence(sequence)
# Add custom logic: Append the current year to the sequence
current_year = fields.Date.today().year
return f"{last_sequence}-{current_year}"
In this example, the custom code appends the current year to the sequence number. This can be particularly useful if you want your sequence numbers to include the year for better organization and tracking.
Tips for Using Sequence Numbers Effectively
- Keep It Simple: While it’s tempting to create complex sequences, simplicity is key. Avoid using too many prefixes or suffixes, as this can make the sequence harder to read.
- Plan Ahead: Think about your future needs when creating sequences. For example, if you expect to have thousands of invoices, set your padding to at least 5 digits.
- Test Thoroughly: Always test your sequences before using them in a live environment. This will help you catch any issues early on.
- Document Your Sequences: Keep a record of all your sequences and their configurations. This will make it easier to troubleshoot issues or make changes in the future.
Common Use Cases for Sequence Numbers
- Invoices: Generate unique invoice numbers for accounting and compliance purposes.
- Sales Orders: Track sales orders with unique identifiers for better order management.
- Purchase Orders: Assign sequence numbers to purchase orders for easier tracking and reconciliation.
- Delivery Orders: Use sequence numbers to manage and track shipments.
- Custom Models: Create sequences for custom models to ensure every record is uniquely identifiable.
Conclusion
Creating and customizing sequence numbers in Odoo 18 is a powerful way to streamline your business operations. Whether you’re managing invoices, orders, or custom models, sequence numbers ensure that every transaction is uniquely identifiable and easy to track.
If you’re new to Odoo or need help setting up advanced configurations, consider hiring an Odoo Implementation Consultant. They can help you tailor the platform to your specific needs and ensure a smooth implementation process. Ready to take your Odoo experience to the next level? Contact us today to get started!
By following this guide, you’ll be able to create and customize sequence numbers in Odoo 18 like a pro. Don’t forget to experiment with the custom code section to make your sequences even more powerful! Whether you’re a small business or a large enterprise, mastering sequence numbers in Odoo will help you stay organized and efficient.
What's Your Reaction?






