support Click to see our new support page.
support For sales enquiry!

How to create and modify Sequence in Odoo 18?

How to create and modify Sequence in Odoo 18? - Banner Image

AjazFeb. 27, 2025

In Odoo 18, sequences play a vital role in generating unique identifiers for various records, such as sales orders, invoices, and purchase orders. Proper configuration of these sequences ensures organized record-keeping and smooth business operations. This guide provides a comprehensive walkthrough on creating and modifying sequences in Odoo 18, enabling you to tailor them to your specific business requirements.

Understanding Sequences in Odoo 18

Sequences in Odoo are systematically incremented identifiers assigned to records upon their creation. They help maintain order and provide an easy reference for documents. For instance, a sales order might have a sequence like SO2025/0001, where SO is the prefix, 2025 denotes the year, and 0001 is the incrementing number.

Accessing and Modifying Existing Sequences

To modify existing sequences in Odoo 18, follow these steps:

  1. Activate Developer Mode:
    • Navigate to the Settings app.
    • Scroll down to the Developer Tools section.
    • Click on Activate the developer mode.
       
  2. Navigate to Sequences:
    • In the Settings app, go to Technical > Sequences & Identifiers > Sequences.
       
  3. Select and Edit a Sequence:
    • From the list, choose the sequence you wish to modify (e.g., Sales Order for sales orders).
    • Click on the sequence to open its configuration form.
       
  4. Configure Sequence Parameters:
    • Prefix: Set a prefix to appear before the sequence number (e.g., SO).
    • Suffix: Add a suffix if needed.
    • Sequence Size: Determine the number of digits in the sequence (e.g., 4 for 0001).
    • Next Number: Specify the starting number for the sequence.
       
  5. Save Changes:
    • After configuring, click Save to apply the modifications.
       

Creating a New Sequence

If you need to create a new sequence for a custom model or document type, follow these steps:

  1. Activate Developer Mode:
    • As previously mentioned, ensure that the developer mode is active.
       
  2. Navigate to Sequences:
    • Go to Settings > Technical > Sequences & Identifiers > Sequences.
       
  3. Create a New Sequence:
    • Click on the Create button.
    • Fill in the necessary details:
      • Name: Enter a descriptive name for the sequence.
      • Code: Assign a unique code (e.g., custom.model).
      • Prefix/Suffix: Define as needed.
      • Sequence Size: Set the desired number of digits.
      • Next Number: Indicate the starting point.
         
  4. Save and Implement:
    • Click Save.
    • Integrate the sequence with the desired model by setting the sequence code appropriately.
       

Utilizing Sub-Sequences for Date Ranges

Odoo 18 allows the creation of sub-sequences that reset based on specific time frames, such as daily, monthly, or yearly. This feature is particularly useful for businesses that prefer their document numbers to restart periodically.

To set up sub-sequences:

  1. Enable Sub-Sequences:
    • Within the sequence configuration, check the box labeled Use subsequences per date_range.
       
  2. Define Date Variables in Prefix/Suffix:
    • Incorporate date variables into the prefix or suffix fields.
    • For example, setting the prefix as INV/%(range_year)s/%(range_month)s/ will produce sequences like INV/2025/02/0001 for invoices created in February 2025.
       
  3. Save and Test:
    • After configuring, click Save.
    • Create a new record to ensure the sequence behaves as expected.
       

Best Practices for Managing Sequences

  • Backup Before Changes: Always backup your database before making significant changes to sequences.
  • Test in a Development Environment: Implement and test sequence modifications in a development or staging environment prior to applying them in production.
  • Document Changes: Keep a record of any changes made to sequences for future reference and troubleshooting.

By understanding and effectively managing sequences in Odoo 18, you can ensure that your business documents are systematically organized and easily traceable, leading to improved operational efficiency

0

Leave a Comment