OdooWiki OCA HUB

Product Code Mandatory

product_code_mandatory folder_open OCA/product-attribute open_in_new
Product License: AGPL-3

This module sets the field internal reference (default_code) of the product as required.

auto_awesome What this module does

AI-generated from the code · Odoo 20.0

Makes the product Internal Reference (default_code) a required field, and automatically fills it with a generated sequence number (DEFAULT-0001, DEFAULT-0002, ...) when a new product is created.

This module changes how product references work in Odoo. The Internal Reference field on products becomes mandatory, so users can no longer save a product without a code.

Where it appears: - On the standard product form, the Internal Reference field is now required. - On the product template form, the field is required only when the product has a single variant; when a product has several variants, the field is hidden there and the code is managed on each variant instead. - On the product variant form, the Internal Reference is always required.

Automatic behaviour: - When a new product is created, the Internal Reference is pre-filled with a number taken from a dedicated sequence, with the prefix DEFAULT- followed by four digits (for example DEFAULT-0001). Users can overwrite it with their own code. - The sequence is defined once at installation and is shared across companies.

Business effect: every product ends up with a unique internal reference, which helps with identification, searching and reporting. The module only touches the product models (product.product and the product template form) and does not add new menus or screens of its own.

Depends on

product
Models and fields (1)
  • product.product · extends an existing modeldefault_code

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

Sources · Odoo 20.0

Confirmed on 2026-11-03 in branch 20.0 of OCA/product-attribute.

terminal Installation and usage

OCA documentation · Odoo 20.0
  • Unable to save a product with an empty or blank internal reference.
  • When creating more than one product variant from the template, a variant will be created with a default value for default_code field.
  • A pre_init_hook process is initiated when there exist records without an internal reference(default_code). A default value is generated to populate empty field as a temporary value.

[](https://runbot.odoo-community.org/runbot/135/12.0)

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.