Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Product Allergen

Entity: product.template

Compute Method: _compute_allergen_ids

Inputs Method Outputs
  • product_variant_ids
"""Compute allergens from variants.

        Shows the union of allergens from all variants.
        """
for template in self:
            if template.product_variant_ids:
                # Get all unique allergens from all variants
                all_allergens = template.product_variant_ids.mapped("allergen_ids")
                template.allergen_ids = all_allergens
            else:
                template.allergen_ids = False

Back to entity