OdooWiki OCA HUB

Unique Product Internal Reference

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

This module adds a constraint on the internal reference of the product to make it unique across the database.

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Makes the product Internal Reference unique across the whole database, so two products can no longer share the same reference.

This module enforces a single, database-wide rule: the Internal Reference (the default_code field) of a product must be unique. If a user tries to save a product with a reference that already exists on another product, Odoo blocks the save and shows the message "Internal Reference must be unique across the database!".

Because the rule is enforced at the database level, it applies everywhere products are created or edited, including the product form and any import or automated creation of products.

When the module is first installed, a one-time cleanup runs before the rule is activated. Products that have no reference, an empty reference, or a reference shared with other products are automatically given a new placeholder reference built from the word DEFAULT followed by a number. This prevents the installation from failing on existing duplicate data.

The module only touches the product variant model product.product; it does not add menus, buttons, reports, or scheduled jobs.

Depends on

product

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

Sources · Odoo 19.0

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

terminal Installation and usage

OCA documentation · Odoo 19.0
  • Unable to save a product when a new internal reference or default_code value is the same with an existing record.
  • 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.

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.