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

Module: Product State

Entity: product.state

Compute Method: _compute_products_count

Inputs Method Outputs
data = dict(
            self.env["product.template"]._read_group(
                domain=Domain("product_state_id", "in", self.ids),
                groupby=["product_state_id"],
                aggregates=["__count"],
            )
        )
for state in self:
            state.products_count = data.get(state, 0)

Back to entity