Product Code RegEx Validation
This module allows configuring a regular expression on Product Categories in order to validate that product codes inside the category follow a specific format.
auto_awesome What this module does
AI-generated from the code · Odoo 16.0Lets you set a regular expression on a product category so that product codes in that category must match a specific format. Odoo blocks saving products whose code does not follow the pattern.
This module adds a new field called "Product Code RegEx Validation" on product categories. You can find it on the product category form, right after the parent category field.
When you enter a regular expression there, Odoo checks that it is a valid pattern. If the expression is invalid, you get an error and cannot save the category.
Once a category has a pattern, Odoo checks every product code (the internal reference) in that category. If a product code does not fully match the pattern, Odoo shows an error and prevents saving. This applies when you create or edit a product, and also when you change a product's category.
Products without a code, or archived products, are ignored by the check. The validation also runs when you change the pattern on the category itself, so existing products in that category must already comply.
The module touches the product, product variant and product category screens. It does not add new menus or reports; it only adds the extra field and the automatic checks.
Depends on
Models and fields (3)
- product.product · extends an existing model
- product.category · extends an existing modelproduct_code_regex_validation (Product Code RegEx Validation)
- product.template · 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-03Confirmation status: 1 confirmed, 8 with no information of 9 versions.
Sources · Odoo 16.0
Confirmed on 2026-11-03 in branch 16.0 of OCA/product-attribute.
terminal Installation and usage
OCA documentation · Odoo 16.0Usage
Source · Odoo 16.0On each Product Category you can set the desired regular expression. The validation will be done when:
- Creating a new product.
- Modifying the default code of a product.
- Modifying the Product Category of a product.
- Unarchiving a product.
Moreover, the regular expression on the Product Category will only be able to be changed if all products in the category have a valid code format.
No verified information in OCA: Installation, Configuration.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
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.