OdooWiki OCA HUB

Product Attribute Variant Rules

product_attribute_variant_rules folder_open OCA/product-attribute open_in_new
Uncategorised License: AGPL-3

This module adds a more powerful way to describe your product attributes combinations than the default exclusions.

It allows to write rules like:

  • All products with blue or green color in XL size will appear only with a V neck collar and a short sleeve.
  • All L size products will never appear with a sailor collar.

The rules are split between a precondition a type and a postcondition.

Different attributes are ANDed and same attributes are ORed.

For instance the rule:

All products with blue or green color in XL size will appear only with a V neck collar and a short sleeve.

Will be written as:

Precondition: (color: blue), (color: green), (size: XL) Type: Only With Postcondition: (collar: V neck), (sleeve: short)

auto_awesome What this module does

AI-generated from the code · Odoo 14.0

Define rules on a product template to control which attribute combinations (variants) are allowed. Rules use preconditions and postconditions to say which variants should exist or never exist.

This module adds a new way to control how product variants are generated from attributes. On a product template, in the Variants tab, you can tick "Use Attribute Rules" and then define rules in a table.

Each rule has three parts: - Preconditions: the attribute values that trigger the rule. If left empty, the rule always applies. - Type: either "Only With" or "Never With". - Postconditions: the attribute values that must (or must not) be present.

For example, you can say that all products with blue or green color in size XL will only appear with a V-neck collar and short sleeve, or that all size L products will never appear with a sailor collar. Values from different attributes are combined with AND, while values from the same attribute are combined with OR.

The module checks these rules when Odoo decides whether a combination of attributes is possible. If a combination violates a rule, that variant is not created. When you change the rules or the "Use Attribute Rules" setting, variants are regenerated automatically.

The rules are stored on product.template and the rule model is product.attribute.rule. Only system administrators can create, edit or delete rules; regular users can only read them.

Depends on

product
Models and fields (2)
  • product.template · extends an existing modeluse_attribute_rules (Use Attribute Rules), product_attribute_rule_ids (Product Attribute Rules), product_attribute_value_ids (Technical Attributes)
  • product.attribute.rule · new modelrule_type (Type), product_tmpl_id (Product Template), available_precondition_attribute_ids (Available preconditions), available_postcondition_attribute_ids (Available postconditions), product_attribute_value_precondition_ids (Rule preconditions), product_attribute_value_postcondition_ids (Rule postconditions)

Text generated by AI (DeepSeek) from reading the Odoo 14.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-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 1 confirmed, 8 with no information of 9 versions.

Sources · Odoo 14.0

Confirmed on 2026-11-03 in branch 14.0 of OCA/product-attribute.

terminal Installation and usage

OCA documentation · Odoo 14.0

After saving your product click on the Use Attribute Rules checkbox in the product variants tab.

Then add your different rules, specifying optionally some rule preconditions, a type of inclusion/exclusion and the rule postconditions.

When you save your product the variant will be recomputed.

No verified information in OCA: Installation, Configuration.

info

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.