Automatic Numbering
Automatic Numbering

Automatic Numbering

Juni 02, 2024
Odoo Automatic Numbering

Automatic numbering is an essential feature in Odoo that simplifies data management by providing unique identifiers for each document, such as invoices, purchase orders, and shipments. To create automatic numbering in Odoo, you can utilize the Sequences feature. Here are the steps to create automatic numbering:

Creating a New Sequence:

  • Open the Settings menu.
  • Navigate to Technical > Sequences & Identifiers > Sequences.
  • Click the Create button to create a new sequence.
  • Set the numbering pattern as needed, for example:
    • Prefix: INV/
    • Suffix: /
    • Number Increment: 1
  • Click Save to save the new sequence.
Linking the Sequence to a Document Model:
  • Open the appropriate document model, such as account.move for invoices.
  • Edit the form model and set the sequence in the sequence_id field.
  • Save the changes.

Dengan Automation Rules:

  • Open Automation Rules dan Choose Model e.g : account.move for invoices.
  • Choose for the Triger On Creation.
  • Add ACTION dan input Execute Code

Kode Pyhton

record.update({'x_name':env['ir.sequence'].next_by_code('nama_sequence')})

By following these steps, Odoo will automatically generate invoice numbers based on the defined sequence every time a new invoice is created. This feature not only enhances efficiency but also reduces manual errors in document numbering, ensuring each document has a unique and easily trackable number.