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
    • Approvals
    • 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
    • Estate 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
    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. Selective Product Variants v 19.0
  4. Sales Conditions FAQ

Selective Product Variants

by Mo. Sarmout
Odoo
v 19.0 Third Party 8
Download for v 19.0 Deploy on Odoo.sh
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 170
Technical Name selective_product_template
LicenseLGPL-3
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 170
Technical Name selective_product_template
LicenseLGPL-3

🎯 Selective Product Variants

Version 19.0.1.0.0
Take Full Control Over Your Product Variant Creation
Odoo 19 Sales Inventory

📋 Overview

Selective Product Variants is a powerful Odoo 19 module that gives you complete control over which product variants are created. By default, Odoo automatically creates ALL possible combinations of product attributes, which can lead to hundreds of unnecessary variants. This module allows you to specify exactly which combinations you want, saving time and keeping your product catalog clean and manageable.

💡 Use Case Example

You sell shoes with attributes "Brand" (Nike, Adidas, Reebok) and "Color" (Red, Blue, Black). You only want to sell Nike shoes in Red and Blue, but not Adidas Red or Reebok Red. With this module, you can create ONLY the exact combinations you need instead of all 9 possible combinations.

✨ Key Features

🎯 Selective Variant Creation

Choose exactly which attribute combinations to create as product variants.

🚫 Prevent Auto-Creation

Disable automatic creation of all possible variant combinations.

✅ Smart Validation

Built-in validation ensures each combination has values for ALL attributes.

🔄 Real-Time Updates

Variants are created/deleted automatically when you modify combinations.

🎨 Clean Interface

User-friendly interface integrated seamlessly into Odoo's product form.

⚡ Performance Optimized

Reduces database bloat by creating only necessary variants.

📦 Installation

Step 1: Download the Module

Download or clone the module files into your Odoo addons directory.

# Module Structure selective_product_variants/ ├── __init__.py ├── __manifest__.py ├── models/ │ ├── __init__.py │ ├── product_template.py │ └── product_template_attribute_value.py ├── security/ │ └── ir.model.access.csv └── views/ └── product_template_views.xml

Step 2: Update Apps List

  1. Go to Apps menu in Odoo
  2. Click on Update Apps List
  3. Search for "Selective Product Variants"
  4. Click Install

Step 3: Verify Installation

After installation, go to any product with variants. You should see a new section called "Variant Creation Control" in the Attributes & Variants tab.

⚙️ Configuration

Enabling Selective Variant Control

  1. Navigate to Product
    Go to Sales → Products → Products and open the product you want to configure
  2. Go to Attributes & Variants Tab
    Click on the "Attributes & Variants" tab
  3. Disable Auto Creation
    Find the "Variant Creation Control" section and uncheck "Auto Create All Variants"
  4. Add Allowed Combinations
    Click "Add a line" under "Allowed Variant Combinations"
  5. Select Attribute Values
    For each combination, select ONE value from EACH attribute (e.g., Color: Red, Brand: Nike)
  6. Save
    Click Save - the variants will be created automatically!
⚠️ Important Notes
  • Each combination MUST have exactly ONE value from EACH attribute
  • You cannot select multiple values from the same attribute (e.g., Nike + Adidas)
  • Existing variants will be deleted if they're not in your allowed combinations
  • Make sure to backup your database before enabling this feature on products with existing variants

💼 Usage Examples

Example 1: Shoes with Limited Colors per Brand

Scenario: You sell shoes from Nike, Adidas, and Reebok. Each brand only comes in specific colors.

Combination Color Brand Create?
1 Red Nike ✅ Yes
2 Blue Nike ✅ Yes
3 Black Adidas ✅ Yes
4 Purple Adidas ✅ Yes
- Red Adidas ❌ No (not created)
- Purple Nike ❌ No (not created)

Example 2: T-Shirts with Size-Color Restrictions

Scenario: XL size is only available in Black, while S and M are available in all colors.

✅ Allowed Combinations:
  • Small + Red
  • Small + Blue
  • Small + Black
  • Medium + Red
  • Medium + Blue
  • Medium + Black
  • XL + Black (only)
📸 Screenshot: Product form showing Allowed Variant Combinations

🔧 Technical Details

Module Structure

Component Description
product.template Extends product template with selective variant creation logic
product.allowed.variant.combination New model to store allowed variant combinations
Views Custom form view additions for variant control interface
Security Access rights for the new combination model

Key Methods

# Override variant creation def _create_variant_ids(self): """Control variant creation based on allowed combinations""" if self.auto_create_variants: return super()._create_variant_ids() else: return self._create_selective_variants() # Create only selected variants def _create_selective_variants(self): """Create only the variants specified in allowed combinations""" # Creates variants based on allowed_variant_combination_ids # Deletes variants not in allowed combinations

Database Schema

New Table: product_allowed_variant_combination

Field Type Description
product_tmpl_id Many2one Link to product template
value_ids Many2many Selected attribute values for this combination
name Char (computed) Display name of the combination

Validation Rules

  • ✅ Each combination must have exactly one value per attribute
  • ✅ Cannot select multiple values from the same attribute
  • ✅ All values must belong to the product's attributes
  • ✅ Validates on create and write operations

🔍 Troubleshooting

Common Issues

Issue: Smart button not updating

Solution: Click the "Update Variants" button or refresh the page (F5)

Issue: Cannot add combination - validation error

Solution: Make sure you select ONE value from EACH attribute. Don't leave any attribute empty.

Issue: Existing variants deleted after enabling

Solution: This is expected behavior. Add all desired combinations to "Allowed Variant Combinations" before saving.

Issue: Attribute values not showing in dropdown

Solution: Make sure the product has attributes configured first in the "Attributes & Variants" tab.

Debug Mode

To see more technical details:

  1. Enable Developer Mode: Settings → Activate Developer Mode
  2. Check product_variant_ids field to see created variants
  3. Check logs for any error messages during variant creation

❓ Frequently Asked Questions

Q: Will this affect my existing products?

A: No, by default "Auto Create All Variants" is enabled for all products. You need to manually disable it for each product you want to control.

Q: Can I enable this for some products and not others?

A: Yes! Each product has its own "Auto Create All Variants" setting. You can mix and match.

Q: What happens if I add a new attribute value later?

A: You need to manually add new combinations that include the new value. They won't be created automatically.

Q: Can I import combinations from CSV?

A: Not in the current version, but this feature can be added as an enhancement.

Q: Does this work with eCommerce / Website?

A: Yes! Only the allowed variants will be visible and selectable on your website.

Q: Will this slow down my system?

A: No, actually it can improve performance by reducing the number of variants in your database.

Q: Can I bulk-edit combinations?

A: Currently, you need to add them one by one. Bulk operations can be added in future versions.

🔄 Upgrade & Uninstall

Upgrading the Module

# Command line upgrade odoo-bin -u selective_product_variants -d your_database_name # Or from UI Apps → Search module → Upgrade

Uninstalling the Module

⚠️ Warning: Data Loss

Uninstalling this module will:

  • Delete all saved allowed combinations
  • Re-enable automatic variant creation for all products
  • May recreate all possible variant combinations

Backup your database before uninstalling!

To uninstall:

  1. Go to Apps
  2. Search for "Selective Product Variants"
  3. Click Uninstall
  4. Confirm the action

📝 Version History

Version 19.0.1.0.0 (Current)

  • ✅ Initial release for Odoo 18
  • ✅ Selective variant creation functionality
  • ✅ Smart validation system
  • ✅ Real-time variant updates
  • ✅ User-friendly interface
  • ✅ Manual "Update Variants" button

📞 Support & Contact

Need Help?

If you encounter any issues or have questions:

  • 📧 Email: mohamad.sarmout.coder@gmail.com

Feature Requests

Have an idea for a new feature? We'd love to hear from you! Send your suggestions to: mohamad.sarmout.coder@gmail.com

Bug Reports

Found a bug? Please report it with:

  • Odoo version
  • Module version
  • Steps to reproduce
  • Error message (if any)
  • Screenshots (if applicable)

📄 License

This module is licensed under LGPL-3 (GNU Lesser General Public License v3.0)

You are free to use, modify, and distribute this module according to the terms of the LGPL-3 license.

👏 Credits

Author: Mo. Sarmout

Contributors:

  • Development Team
  • QA Team
  • Community Contributors

Special Thanks: Odoo Community for their continuous support and feedback

© 2025 Mo. Sarmout. All rights reserved.

Made with ❤️ for the Odoo Community

Back to Top ↑

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.
Please choose a rating from 1 to 5 for this module.
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