Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries ⟶
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    • Affiliate Program
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Sales
  3. Alternative Product Codes v 20.0
  4. Sales Conditions FAQ

Alternative Product Codes

by Terrabit https://www.terrabit.ro , Dorin Hongu https://www.terrabit.ro
Odoo
v 20.0 Third Party 1049
Download for v 20.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Versions 17.0 18.0 19.0 20.0
You bought this module and need support? Click here!
Versions 17.0 18.0 19.0 20.0
  • Description
  • Manifest
  • License
Alternative Product Codes

Alternative Product Codes

Extra codes & smarter product search

Odoo 20.0 Sales Odoo.sh • On-premise OPL-1
✓ 32 automated tests
89% code coverage
★ Did this module help you? It is free, built and maintained by the Terrabit developers. If it saved you time, a rating on this page is the best way to say thanks — and it helps other Odoo users find it too. Thank you for your support!
★ Leave a rating ↓
  • Overview
  • Configuration
  • Usage
Overview
Animated demo of the module

Manage multiple alternative codes per product and find any item by any of its codes. This module is useful when the same product is known under different references — supplier codes, manufacturer part numbers, legacy codes, or customer-specific identifiers — and your team needs to locate it regardless of which code they have at hand.

✨ Key features:

  • Adds a dedicated Alternative tab on the product form where you can record any number of extra codes, reorder them, and optionally hide individual codes from the combined display.
  • Exposes a computed Alternative Code field (visible in the product list and on order and transfer lines) that concatenates all visible codes for quick reference.
  • Extends product search so that typing an alternative code returns the matching product, on both product templates and their variants. The search is opt-in and tunable (result limit, minimum length) from the Inventory settings.
  • Surfaces the alternative code column on Sales Order, Purchase Order, and Stock Move lines, keeping the code visible throughout the order-to-delivery flow.
  • Adds a free-text Used For field on the product to note what the item can be used for, aiding identification and cross-selling.
  • A daily scheduled action (inactive by default) splits codes entered on one line and separated by ; or , into one alternative record per code, without creating codes the product already has. Spaces are kept as part of the code (OEM numbers such as 366 200 05 01). Activate it in Settings > Technical > Automation > Scheduled Actions when needed.
Configuration

Alternative Search Settings

Navigate to Inventory > Configuration > Settings, section Products (the settings are added after Units of Measure & Packagings), to configure the alternative-code search and the product selection list:

Setting System Parameter Default Effect
Alternative Search (checkbox) alternative.search_name disabled When enabled, product name-search queries also scan alternative codes.
Alternative Limit (shown when Alternative Search is ticked) alternative.limit 10 Maximum number of products added to a selection list by alternative code; 0 means no limit.
Minimum Length (shown when Alternative Search is ticked) alternative.length_min 3 Minimum number of characters typed before the alternative codes are searched. A shorter text cannot use the trigram index and would scan the whole table.
Code Before Name alternative.dropdown_code_first disabled The product selection list shows [code] name instead of the name with the code muted on the right.
Show Stock in Dropdown alternative.dropdown_show_qty disabled The product selection list shows, muted on the right, the quantity on hand of storable products.

These values are stored as ir.config_parameter system parameters and can also be set directly via Settings > Technical > Parameters > System Parameters if needed.

Large Databases (Index on Alternative Codes)

Alternative codes (product.alternative.name) use a trigram (GIN) index, so a search such as ilike '%4561%' does not scan the whole table.

  • The PostgreSQL extension pg_trgm must be available. Without it Odoo creates no index on the column.
  • Odoo adds unaccent to the index only when public.unaccent(text) is IMMUTABLE. Otherwise the index is created without it and the search, which calls unaccent(name) ILIKE unaccent(...), cannot use it. Odoo logs PostgreSQL function 'unaccent' is present but not immutable in that case.

Checking unaccent

SELECT oid::regprocedure, provolatile FROM pg_proc WHERE proname = 'unaccent';
  • odoo.sh needs nothing: the extension lives in unaccent_schema and the platform adds an IMMUTABLE wrapper public.unaccent(text) (provolatile = i).
  • Self-hosted, with the extension installed in public, unaccent(text) is STABLE (s). Do not use ALTER FUNCTION public.unaccent(text) IMMUTABLE, and do not replace the extension's function: the change is part of the extension, pg_dump does not keep it, and restoring the database fails on every index that uses unaccent (functions in index expression must be marked IMMUTABLE). The Odoo database manager then reports Couldn't restore database.

Setting up unaccent like odoo.sh (self-hosted)

Run as a superuser, then restart Odoo (it reads the function status at startup). The script moves the extension to its own schema, adds the IMMUTABLE wrapper and rebuilds the indexes that used the extension's function. Rebuilding blocks writes on those tables, so run it in a maintenance window.

BEGIN;
CREATE SCHEMA IF NOT EXISTS unaccent_schema;
ALTER EXTENSION unaccent SET SCHEMA unaccent_schema;
CREATE FUNCTION public.unaccent(text) RETURNS text
    LANGUAGE sql IMMUTABLE PARALLEL SAFE STRICT
    AS $$ SELECT unaccent_schema.unaccent('unaccent_schema.unaccent'::regdictionary, $1) $$;
DO $$
DECLARE r record;
BEGIN
    FOR r IN
        SELECT DISTINCT i.indexrelid::regclass AS idx, pg_get_indexdef(i.indexrelid) AS def
        FROM pg_index i
        JOIN pg_depend d ON d.classid = 'pg_class'::regclass AND d.objid = i.indexrelid
        WHERE d.refclassid = 'pg_proc'::regclass
          AND d.refobjid = 'unaccent_schema.unaccent(text)'::regprocedure
    LOOP
        EXECUTE format('DROP INDEX %s', r.idx);
        EXECUTE replace(r.def, 'unaccent_schema.unaccent(', 'public.unaccent(');
    END LOOP;
END $$;
COMMIT;

The dictionary is schema-qualified on purpose. With a bare 'unaccent', PostgreSQL 17 cannot build the index (index builds run with a restricted search_path) and older versions fail on restore.

Trigram indexes created while unaccent was STABLE do not contain unaccent. Odoo compares only the access method (gin), not the expression, so it keeps them although the search cannot use them. Drop them after the change and update the modules that declare them (-u).

Creating the index on a large table

With millions of codes, create the index before updating the module, so writes are not blocked while it is built:

DROP INDEX IF EXISTS product_alternative__name_index;
CREATE INDEX CONCURRENTLY product_alternative__name_index
    ON product_alternative USING gin (unaccent(name) gin_trgm_ops);

Leave out unaccent(...) if public.unaccent(text) is not IMMUTABLE. Odoo finds an index with the expected name and access method and does not rebuild it.

Databases migrated from 18.0 already have the same index under another name (product_alternative_name_unaccent_gin, created by the 18.0 module). Rename it instead of building a new one:

DROP INDEX IF EXISTS product_alternative__name_index;
ALTER INDEX product_alternative_name_unaccent_gin RENAME TO product_alternative__name_index;
Usage

Search and Display Options

  1. Go to Inventory > Configuration > Settings and scroll to the Products section.
  2. Tick Alternative Search so that typing an alternative code in a product field finds the product. Below it, Alternative Limit caps the products added by alternative code (0 = no cap) and Minimum Length is the number of characters from which the alternative codes are searched.
  3. Optionally tick Code Before Name (the product selection list shows [code] name) and Show Stock in Dropdown (the list shows the quantity on hand of storable products).
  4. Click Save.
Inventory settings, Products section: Alternative Search ticked with Alternative Limit 10 and Minimum Length 3, Code Before Name and Show Stock in Dropdown ticked, all highlighted
1 Inventory settings, Products section: Alternative Search ticked with Alternative Limit 10 and Minimum Length 3, Code Before Name and Show Stock in Dropdown ticked, all highlighted

Adding Alternative Codes to a Product

  1. Open Inventory > Products > Products (or Sales > Products > Products) and select the product.
  2. Go to the Alternative tab and click Add a line. Enter one code per line in the Code column.
  3. Drag the handle to reorder the codes.
  4. Tick Hide on a code you do not want displayed (for example an old code). A hidden code is still searchable.
  5. Save.
Product form, Alternative tab: four codes, the last one hidden
2 Product form, Alternative tab: four codes, the last one hidden

On the General Information tab, Alternative Code shows the visible codes joined with ;. Used For is a free text field, for example the compatible machines.

Product form, General Information tab: Alternative Code and Used For highlighted
3 Product form, General Information tab: Alternative Code and Used For highlighted

Searching by Alternative Code

In the product list, the Alternative Code column shows the codes of each product. Type a code in the search bar and choose Search Alternatives for: …. The search bar also searches Used For and Vendor Code (the vendor's product code).

Product list with the Alternative Code column and the search options for W 712
4 Product list with the Alternative Code column and the search options for W 712

With Alternative Search enabled, type an alternative code in the product field of a sales order, a purchase order, a transfer or any other product field: the product with that code is proposed together with the products found by name and internal reference. The field's own restrictions still apply (for example, a product that cannot be sold is not proposed on a sales order).

Request for quotation: OC 90 typed on a new line finds [FU-1001] Filtru ulei motor, with its stock
5 Request for quotation: OC 90 typed on a new line finds [FU-1001] Filtru ulei motor, with its stock

Alternative Code on Orders and Transfers

The Alternative Code column is available, hidden by default, on sales order lines, purchase order lines and transfer operations. To show it, click the optional columns button on the right of the column headers and tick Alternative Code. The column is read-only and shows the visible codes of the product.

Sales order with the Alternative Code column shown on the lines
6 Sales order with the Alternative Code column shown on the lines
Receipt, Operations tab, with the Alternative Code column shown
7 Receipt, Operations tab, with the Alternative Code column shown

Splitting Codes Entered on One Line

Codes imported on one line and separated by ; or , (for example GDB1330; 0 986 424 795, 8DB 355 019-311) are split into one line per code by the scheduled action Alternative: Split multi-code records. It is inactive after installation.

  1. Activate the developer mode and go to Settings > Technical > Automation > Scheduled Actions.
  2. Open Alternative: Split multi-code records and switch on Active, or click Run Manually for a single run.
Scheduled action Alternative: Split multi-code records, with Active and Run Manually highlighted
8 Scheduled action Alternative: Split multi-code records, with Active and Run Manually highlighted

The first code stays on the original line; the others become new lines with the same sequence and Hide flag. Spaces inside a code are kept, and a code the product already has is not created again.

Product Alternative tab after the split: three separate codes
9 Product Alternative tab after the split: three separate codes
800+
Modules published on Odoo Apps
Odoo
Silver PartnerImplementation & Support

Need help getting started?

Our 800+ apps on the Odoo Apps Store are used in Odoo implementations across Europe, the Americas, Asia and Africa — by companies we have never even met. That is the advantage of building modules that simply work.

Questions about this module? Write to us — the developers who build it will answer.

Terrabit support →

More apps by Terrabit

Other modules from the same publisher, built to work together. All apps →

CI Custom Invoice Exchange Rate Sales

Edit the currency rate on the invoice

DP Discount Policy Sales

Bring back Odoo 17 discount policy

DW Document Weight Sales

Net and gross weight and volume per line and in total on quotations and invoices

FS Fast Sale Sales

Confirm, deliver and invoice a sale order in one click

IP Invoice Pickings Sales

Create invoices directly from stock pickings or batch transfers

AI Auto-Invoice from Delivery Sales

Generate invoice automatically from picking after validation

PC Price Change Labels Sales

Print product labels for the products of a price change document

PC Pricelist Currency Extension Sales

Keep product sales prices in a company-wide currency other than the accounting currency

Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies • Inventory (stock)
• Purchase (purchase)
• Discuss (mail)
• Invoicing (account)
Lines of code 426
Technical Name deltatech_alternative
LicenseOPL-1
Websitehttps://www.terrabit.ro
Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with