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

Module: eCommerce

Entity: product.product

Compute Method: _compute_variant_image_ids

Inputs Method Outputs
for product in self:
            variant_ptavs = product.product_template_attribute_value_ids
            product.variant_image_ids = product.product_template_image_ids.filtered(
                lambda image: (
                    image.has_attribute_value
                    and all(
                        variant_ptavs.filtered(lambda v: v.attribute_line_id == attribute_line)
                        & image.attribute_value_ids.filtered(
                            lambda v: v.attribute_line_id == attribute_line
                        )
                        for attribute_line in image.attribute_value_ids.attribute_line_id
                    )
                )
            )

Back to entity