OdooWiki OCA HUB

Default Fields with Sequence

base_sequence_default folder_open OCA/server-tools open_in_new
Tools License: AGPL-3

This module extends the use of sequences. It will allow you to use them in any text field.

If configured correctly, new records will have a default incremental value in the field of your choice.

auto_awesome What this module does

AI-generated from the code · Odoo 16.0

Lets you give any text field on any record a default value taken from an Odoo sequence, so new records automatically get an incremental reference. You set it up by creating a sequence whose code follows a special naming pattern.

This module extends how sequences can be used in Odoo. Normally sequences fill in fields like invoice numbers, but here they can be used as the default value of any field on any model.

How it works for the user:

  • You create a sequence in Odoo with a code that starts with base_sequence_default, followed by the technical name of the model and the technical name of the field, separated by dots.
  • When a new record of that model is created, the module looks for sequences matching that model and the current company (or sequences shared across companies).
  • If the chosen field on the new record is empty or contains just a dash, the next sequence number is written into it automatically.
  • If the field already has a value, it is left untouched.
  • If a sequence points to a field that does not exist on the model, it is ignored and a warning is logged instead of breaking the creation.

The module touches the base model base, so the behaviour applies to every model in Odoo. It also ships a demo sequence that fills the ref field of res.partner with values like AUTOREF/001, which shows how the configuration is meant to look. No new menus or screens are added; configuration happens through the standard sequence records.

Depends on

base
Models and fields (1)
  • base · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 16.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 14.0

Confirmed on 2026-11-03 in branch 14.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 16.0

To configure this module, you need to:

  • Enable developer mode.
  • Go to the form view of the model to which you want to add the new sequential default value.
  • Hover over the field to which you want to add the sequential default value. A tooltip with more info will appear.
  • Make sure the tooltip says Type: char. Only those fields will work.
  • Take note of the Object and Field.
  • Go to Settings \> Technical \> Sequences & Identifiers \> Sequences.
  • Create one sequence with code named after this pattern: base_sequence_default.{object}.fields.{field}. E.g.: base_sequence_default.res.partner.fields.name to add a default sequenced name for new partners. Do not use {} when adding the model and field name to the pattern.
  • Configure the sequence at will.

To use this module, it is necessary to:

  • Follow the configuration instructions.
  • Create a record of the model you configured.
  • Leave empty the fields where you configured a sequence. If they are required fields, set value to "-" to trigger the automatic sequence on creation.
  • Check that the field defined in the sequence is set to the next value in the sequence.

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.