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

Module: Subscription management

Entity: res.partner

Compute Method: _compute_subscription_count

Inputs Method Outputs
  • id
data = self.env["sale.subscription"].read_group(
            domain=[("partner_id", "in", self.ids)],
            fields=["partner_id"],
            groupby=["partner_id"],
        )
count_dict = {item["partner_id"][0]: item["partner_id_count"] for item in data}
for record in self:
            record.subscription_count = count_dict.get(record.id, 0)

Back to entity