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

Module: Partnership / Membership

Entity: product.pricelist

Compute Method: _compute_partners_count

Inputs Method Outputs
  • id
partners_data = self.env['res.partner']._read_group(
            domain=[('specific_property_product_pricelist', 'in', self.ids)],
            groupby=['specific_property_product_pricelist'],
            aggregates=['__count'],
        )
mapped_data = {pricelist.id: count for pricelist, count in partners_data}
for pricelist in self:
            pricelist.partners_count = mapped_data.get(pricelist.id, 0)

Back to entity