OdooWiki OCA HUB

Sequence custom data

sequence_custom_data folder_open OCA/server-tools open_in_new
Generic Modules License: AGPL-3

This is a technical module. The goal is to allow others module to define new variables/codes to use during the sequence generation.

So this module is not useful alone. You have to create your own module to add some values into your sequences.

auto_awesome What this module does

AI-generated from the code · Odoo 13.0

Technical add-on that lets other modules insert their own custom codes into sequence prefixes and suffixes. It is not useful on its own; developers must extend it to supply the values.

This module does not add any screen, menu or button. It changes how Odoo builds the prefix and suffix of sequence numbers (the text placed before or after the running number, for example on invoices, sales orders or any other document that uses a sequence).

Normally Odoo only understands a fixed set of placeholders such as the year or the month. This module opens the door for other modules to provide extra placeholders, written between curly brackets, for example {company_code} or Sequence-{variable1}. When a sequence is generated, the module replaces those placeholders with the values supplied by the installed extension modules.

  • It extends the ir.sequence model, the model that stores numbering rules.
  • It adds a hook that other modules can fill in with their own values.
  • It applies the replacement to both the prefix and the suffix of the generated number.
  • If a placeholder has no matching value, the numbering is stopped and the user sees an error message asking to check the prefix and suffix against the available values.

Because the module alone provides no values, nothing changes in Odoo until a companion module is installed. The error message is shown as a user-facing warning, and the problem is also written to the server log for administrators.

Depends on

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

Text generated by AI (DeepSeek) from reading the Odoo 13.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: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 13.0

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

terminal Installation and usage

OCA documentation · Odoo 13.0

To use this module, you need to:

  • depend on this module
  • Inherit the ir.sequence to fill your custom values

Example:

class IrSequence(models.Model):
    _inherit = "ir.sequence"

    def _get_special_values(self, date=None, date_range=None):
        values = super()._get_special_values(date=date, date_range=date_range)
        company_code = self.env.company.special_code
        values.update({"company_code": company_code or ""})
        return values`

You can also update the documentation (on the bottom of ir.sequence form view) to describe variables that your add and the purpose of them.

Example:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <record model="ir.ui.view" id="ir_sequence_form_view">
        <field name="name">ir.sequence.form (in custom_module)</field>
        <field name="model">ir.sequence</field>
        <field name="inherit_id" ref="base.sequence_view"/>
        <field name="priority" eval="90"/>
        <field name="arch" type="xml">
            <xpath expr="//page[1]" position="inside">
                <group col="3" name="custom_legend">
                    <group string="Company" name="custom_legend_company">
                        <span colspan="2">Specific company code: {company_code}</span>
                    </group>
                </group>
            </xpath>
        </field>
    </record>
</odoo>

No verified information in OCA: Installation, Configuration.

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.