📋 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.
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.
Step 2: Update Apps List
- Go to Apps menu in Odoo
- Click on Update Apps List
- Search for "Selective Product Variants"
- 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
-
Navigate to Product
Go to Sales → Products → Products and open the product you want to configure -
Go to Attributes & Variants Tab
Click on the "Attributes & Variants" tab -
Disable Auto Creation
Find the "Variant Creation Control" section and uncheck "Auto Create All Variants" -
Add Allowed Combinations
Click "Add a line" under "Allowed Variant Combinations" -
Select Attribute Values
For each combination, select ONE value from EACH attribute (e.g., Color: Red, Brand: Nike) -
Save
Click Save - the variants will be created automatically!
- 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.
- Small + Red
- Small + Blue
- Small + Black
- Medium + Red
- Medium + Blue
- Medium + Black
- XL + Black (only)
🔧 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
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
Solution: Click the "Update Variants" button or refresh the page (F5)
Solution: Make sure you select ONE value from EACH attribute. Don't leave any attribute empty.
Solution: This is expected behavior. Add all desired combinations to "Allowed Variant Combinations" before saving.
Solution: Make sure the product has attributes configured first in the "Attributes & Variants" tab.
Debug Mode
To see more technical details:
- Enable Developer Mode: Settings → Activate Developer Mode
- Check product_variant_ids field to see created variants
- 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
Uninstalling the Module
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:
- Go to Apps
- Search for "Selective Product Variants"
- Click Uninstall
- 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
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
Please log in to comment on this module