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

Module: Payment Engine

Entity: payment.provider

Compute Method: _compute_token_count

Inputs Method Outputs
  • id
token_data = self.env["payment.token"]._read_group(
            [("provider_id", "in", self.ids)], ["provider_id"], ["__count"]
        )
provider_data = {provider.id: count for provider, count in token_data}
for provider in self:
            provider.token_count = provider_data.get(provider.id, 0)

Back to entity