Automated SKU & Barcode Generator for Odoo 19 documentation
A guide to automatic SKUs and barcodes: how the codes are built, the settings, prefixes per category, variants, filling existing products, and the guarantees.
Documents version 1.0.1Updated Oct 23, 2026
Start here
In plain words: Every product needs a code: an SKU that people can read and say on the phone, and a barcode that scanners can read. Typing them by hand means gaps, duplicates and “which one did we use last?”. This module gives every new product both, automatically, the moment you save it.
| What you do | What the module does |
|---|---|
| Save a new product | Fills the Reference (SKU) with the category prefix and the next number, and the Barcode with a valid EAN-13. |
| Add variants (colour, size) | Every variant gets SKU-RED-M style code and its own barcode. |
| Already have thousands of products without codes | One click fills the missing ones. Codes that exist are never touched. |
Tip: Nothing you typed is ever overwritten, and the module never creates a duplicate: if a code is already taken, it takes the next free one.
What the codes look like
| Code | Example | Built from |
|---|---|---|
| SKU of a product | FUR-0042 | category prefix FUR + separator - + number 0042 |
| SKU of a variant | CLO-0001-RED-M | the product's SKU + the first 3 letters of each option (Red, M) |
| Barcode (EAN-13) | 2000000000015 | your prefix 200 + a counter 000000001 + the check digit 5 |
| Barcode (same as SKU) | FUR-0042 | the SKU itself, as a Code 128 barcode |
In plain words: The prefix, the separator, the number of digits and the barcode type are all settings. The check digit is calculated for you, so every EAN-13 is valid and scans first time.
Tip: 200 to 299 are the numbers GS1 reserves for internal use, so they never clash with barcodes that suppliers print on their goods. You can choose any prefix of 2 to 8 digits.
Requirements
| Item | Details |
|---|---|
| Odoo | 19.0 (Community or Enterprise) |
| Apps needed | Only the base Products app (product), which every Sales, Inventory, Purchase or Point of Sale database has |
| License | OPL-1 (Odoo Proprietary License v1.0) |
Install
- Unzip the package. Inside is
taqnix_sku_barcode_generator.zip; unzip it to get the foldertaqnix_sku_barcode_generator. - Copy the folder into one of the
addons_pathfolders of your Odoo server and restart Odoo. - Log in as an administrator, activate Developer mode, open Apps and press Update Apps List.
- Remove the “Apps” filter, search SKU and press Install.
# or from the command line ./odoo-bin -c odoo.conf -d YOUR_DATABASE -i taqnix_sku_barcode_generator --stop-after-init
Tip: Installing changes nothing on your existing products. From then on, new products get codes. Use chapter 9 to fill the old ones.
Settings
In plain words: Open Settings → Product Codes. The settings belong to each company.
| Setting | What it does |
|---|---|
| Generate the SKU for new products | Switch the automatic SKU on or off. |
| Default prefix | Used for products whose category (and its parents) has no prefix. Default PRD. |
| Separator | Put between prefix, number and variant options. Default -. |
| Digits in the number | 4 gives 0001 to 9999; 6 gives 000001. Default 4. |
| Generate the barcode for new products | Switch the automatic barcode on or off. |
| Barcode type | EAN-13 with your own prefix, or the SKU as the barcode. |
| EAN-13 prefix | 2 to 8 digits at the start of every barcode. Default 200. |
Prefix per category
In plain words: The SKU starts with the prefix of the product's category. Open Inventory → Configuration → Product Categories (or Sales or Invoicing, wherever you keep categories) and fill SKU prefix.
| Rule | Example |
|---|---|
| A category with a prefix uses it | Furniture: FUR → FUR-0001, FUR-0002… |
| A sub-category without a prefix uses its parent's, and shares its counter | Furniture / Office → FUR-0003 |
| Only letters and digits, up to 12, always capital | off is saved as OFF |
| No prefix anywhere up the tree | The default prefix: PRD-0001 |
| Two categories with the same prefix | They share one counter: no clash |
In plain words: Next number shows the number the next product will get. You can change it, for example to continue after an old system: write 5000 and the next product is FUR-5000.
New products
In plain words: Create a product as usual and save it. If the Reference or the Barcode is empty, the module fills it. That is all.
| Situation | Result |
|---|---|
| You typed a Reference | It is kept. Only the barcode (if empty) is generated. |
| You typed a Barcode | It is kept. Only the Reference (if empty) is generated. |
| You duplicate a product | The copy gets new codes (Odoo does not copy them). |
| The product is created by an import, the website or another app | Same: empty codes are filled, existing ones kept. |
| The number you would get is already used by another product | The module takes the next free one. |
| The barcode is already used by another product or packaging | The module takes the next free one. |
In plain words: The product title shows the code in brackets, [FUR-0001] Ergonomic Standing Desk, in orders, deliveries and invoices.
Variants
In plain words: Products with options (colour, size…) have one variant per combination. Each variant gets its own SKU and its own barcode, because that is what you scan and ship.
| Option | In the SKU |
|---|---|
| Red | RED |
| Blue | BLU |
| M | M |
| Large | LAR |
In plain words: The product's own SKU (here
CLO-0001) is the base, and each option adds its first 3 letters. If two variants would get the same code, the second gets -2.Tip: A product with variants shows no Reference on its own form: the codes live on the variants. Open the Variants button, or the Product Variants list.
In plain words: If you add a new colour later, the new variants get their codes automatically; the existing ones keep theirs.
Products that already exist
In plain words: Products created before you installed the module, or created with the automatic mode switched off, have no codes. Fill them in one go.
- In the product list, tick the products you want (or none).
- Open Actions → Generate missing codes.
- Choose the scope: the selected products, a category (with its sub-categories) or all products.
- Check the counts under What will happen, tick SKU and/or barcode, and press Generate.
In plain words: For a single product use the Generate Codes button on its form. It is visible only while the Reference or the Barcode is empty.
Rules and guarantees
| Guarantee | How |
|---|---|
| Never overwrites | Only empty Reference and Barcode fields are filled. |
| No duplicate SKU | The number is skipped if any product (archived ones included) already has that SKU. |
| No duplicate barcode | Skipped if any product or packaging already has it. |
| Valid EAN-13 | 13 digits, check digit calculated, 12-digit base made of your prefix and a counter. |
| Counters never go backwards | They are database sequences, safe when several users save at the same moment. |
| Numbers are not reused | A deleted or cancelled product leaves a gap. That is normal and keeps codes unique. |
| Several companies | Settings are per company; SKU counters are shared by prefix, barcode counters are per company. |
Important: Changing a category's prefix does not rename the SKUs that already exist. Old products keep their old code; new ones use the new prefix.
For developers
In plain words: Skip this chapter if you only use the module.
| Item | Details |
|---|---|
product.product._tx_assign_codes(force=False) | Fills the missing codes of the products. force ignores the automatic switches. Returns (SKUs made, barcodes made). |
_tx_make_sku(company) / _tx_make_barcode(company) | Return the next free code. Override them to change the format. |
Context tx_skip_codes | Set it to True to create products without generating codes (for example in a migration). |
Context install_mode | Data loaded by modules is never given codes. |
taqnix.sku.tools | ean13_check_digit() and is_valid_ean13(). |
# create products without codes, then fill them later
products = env['product.product'].with_context(tx_skip_codes=True).create(vals_list)
products._tx_assign_codes(force=True)
# your own format: PREFIX/YEAR/NUMBER
class ProductProduct(models.Model):
_inherit = 'product.product'
def _tx_make_sku(self, company):
sku = super()._tx_make_sku(company)
return sku.replace('-', '/', 1)Troubleshooting
| Problem | What to do |
|---|---|
| A new product has no code | The automatic switch is off in Settings → Product Codes, or the product was created with tx_skip_codes. Use the Generate Codes button. |
| The product list shows no Reference for a product with variants | That is how Odoo works: the codes are on the variants. |
| “The EAN-13 prefix must be 2 to 8 digits” | Use digits only, between 2 and 8 of them. |
| “The SKU prefix can only contain letters and digits” | Remove spaces, dashes and symbols from the category prefix. |
| The numbers jump | A number is skipped when a product already uses that SKU, and a deleted product leaves a gap. Both are normal. |
| I want the SKU to restart at 1 | Open the category and set Next number to 1, but only if no product has such an SKU: the module skips used ones. |
Updating and removing
Replace the folder with the new version, restart Odoo and run -u taqnix_sku_barcode_generator. To remove it, uninstall it from Apps. The codes already given stay on your products, as ordinary Reference and Barcode values. The prefixes, counters and settings are removed.
Support
Installation help and bug fixes are included for 6 months, with lifetime updates. Contact us through the marketplace page where you bought the module or write to support@taqnix.com with your Odoo version and a screenshot.