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: sale.subscription

Compute Method: _compute_sale_order_ids_count

Inputs Method Outputs
  • id
data = self.env["sale.order"]._read_group(
            domain=[("order_subscription_id", "in", self.ids)],
            groupby=["order_subscription_id"],
            aggregates=["__count"],
        )
count_dict = {
            subscription.id: count for subscription, count in data if subscription
        }
for record in self:
            record.sale_order_ids_count = count_dict.get(record.id, 0)

Back to entity