Odoo18 Sequence Number Creation Guide

ADARSH
May 2, 2025
sequence-numbers-in-odoo18

Odoo18 uses sequence numbers to generate unique identifiers for records and these sequece number help to maintain the structured data, improve traceability, and also authorize for custom numbering patterns. the sequence numbers are commonly used in invoices, sales orders, inventory, and custom modules. In This Developer guide you will learn the two primary methods for creating sequence numbers in Odoo18.

Via Code (ideal for developers)
Via Odoo Settings Interface (for functional users)

We’ll demonstrate both approaches by creating a custom module, where receives a unique reference number.

Sequence numbers ensure consistency, uniqueness, and traceability. They’re essential for:

  • Data Integrity: Prevent duplicate or missing records.
  • Audit Compliance: Offer a transparent tracking mechanism.
  • Operational Clarity: Streamline search, reporting, and integration processes.

Define the Model

This step involves creating a new model in your custom Odoo module, which will represent the records you want to assign unique sequence numbers to. In this example, we’re creating a model called custom.document.

Model Structure

This Python code defines custom.document.
In Odoo, when a new record is created, your custom create() method checks whether the name is still New. If it is, the system knows it’s time to fetch the next number from the defined sequence.

create-sequence-numbers-odoo-18

Creating a Sequence in the Backend (XML)

Let’s say we’re building a custom module and want to generate a unique number for a model called custom.document.

creating-sequence-in-backend-xml

Field Descriptions

  1. code: Must match the code used in next_by_code().
  2. prefix: E.g., “CUST” for library.
  3. padding: Number of digits (e.g., CUST/00001).
  4. number_next: Start value.
  5. number_increment: Step size.

Test the Sequence

After installing your module:

  • Navigate to the Custom Document menu.
  • Create a book record.
  • The NAME will auto-populate (e.g., CUST/00001, CUST/000012…).

Then add this file to your module’s manifest:

module-manifest

Creating a Sequence via the Odoo UI

This method is ideal for non-technical users.

Access the Sequence Menu

  • Go to Settings > Technical > Sequences & Identifiers > Sequences

(Developer Mode must be enabled.)\

Create a New Sequence

Click Create and fill in the details:

  • Name: e.g., Custom Dcoument
  • Code: Must match your model’s sequence code (custom.document)
  • Prefix: e.g., “CUST/”
  • Padding: e.g., 5
  • Number Next: Starting value (e.g., 1)
  • Number Increment: Usually 1

Save and Apply

Once saved, any record created in custom.document will automatically receive a formatted reference number.

save-apply

Advanced Sequence Options

Odoo can be customized for your UAE business.

Date-based Sub-sequences

You can enable date ranges so that sequences reset monthly or yearly.

  • Use subsequences per date range (sequence).
  • Choose “Date Range” (e.g., monthly/yearly)

Standard vs No Gap Modes

  • Standard: Gaps are allowed if numbers are skipped (common in accounting).
  • No Gap: Ensures a strict sequence without missing numbers.

With Odoo18, defining sequence numbers can be done effortlessly—either programmatically or through the UI. Sequences bring structure, prevent errors, and improve data management across all models. Whether you’re creating a Library System or a complex ERP module, this feature is essential for reliable and traceable operations.

Understanding the Odoo18 sequence numbers (code or UI) is essential for data integrity and efficient operations, will ensure unique and traceable records across all modules. Implement this key feature for reliable business solutions. Contact us to learn more about Odoo18 development and implementation today.

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *