Sequence Number Creation in Odoo 16

TEAM-BASSAM
April 7, 2023

It is possible to create our own sequence for naming records in Odoo. A proper naming scheme will assist us in distinguishing similar records from one another just by looking at them, enabling us to neatly manage the storing process of our records.

In Odoo 16 you can create a sequence number by following the steps:

  1. Go to “Settings” and select “Technical”
  2. Select “Sequence” and click the “New” Button to create a new sequence
  • Enter a name for the sequence such as “Material Transfer”
  1. Enter a code for the sequence, such as “material. transfer”
  2. Then inside the sequence tab, we can give Prefixes, Suffix
  3. We can give the Sequence size
  • Set the “Next Number” field to the starting number of the sequence
  • Select the “Implementation” option for the sequence
  1. Save the sequence
  2. Your Odoo application can use the sequence by referencing it in code or using it in forms and reports.

In Odoo 16, you create a sequence number by defining the sequence in an XML file and loading the file into your module. Using the below steps.

->In your Odoo module, create a new XML file. You can create a file called “transfer. sequence” in your module’s “data” folder.

-> Define the sequence using “ir. sequence” tag.

odoo-sequence-tagHere we define a Sequence Called Material Transfer Sequence with the code “material. transfer” & set prefix as “MT” and padding as  5.

If we want to ensure that the sequence is not modified when we update the module, we can write <data noupdate=”1″> in the XML file.

Include this XML file in your module’s manifest file.

In order to load the sequence into Odoo, install or upgrade your module. So, by referencing its code you can use it in your module.

Request Your Free Quote

generate-a-new-sequence-numberIn this example, we generate a new sequence number for our record using the next_by_code() method of theirs. sequence model. The method accepts a parameter called the sequence code.

"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 *