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

Module: Products & Pricelists

Entity: product.attribute

Compute Method: _compute_products

View 17.0 View 20.0
Inputs Method Outputs
  • attribute_line_ids
  • attribute_line_ids.product_tmpl_id
  • id
+ templates_by_attribute = {
+             attribute.id: templates
+             for attribute, templates in self.env['product.template.attribute.line']._read_group(
+                 domain=[('attribute_id', 'in', self.ids)],
+                 groupby=['attribute_id'],
+                 aggregates=['product_tmpl_id:recordset']
+             )
+         }
for pa in self:
-             pa.with_context(active_test=False).product_tmpl_ids = pa.attribute_line_ids.product_tmpl_id
+             pa.with_context(active_test=False).product_tmpl_ids = templates_by_attribute.get(pa.id, False)

Back to entity