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.transaction

Compute Method: _compute_refunds_count

Inputs Method Outputs
  • id
rg_data = self.env["payment.transaction"]._read_group(
            domain=[("source_transaction_id", "in", self.ids), ("operation", "=", "refund")],
            groupby=["source_transaction_id"],
            aggregates=["__count"],
        )
data = {source_transaction.id: count for source_transaction, count in rg_data}
for record in self:
            record.refunds_count = data.get(record.id, 0)

Back to entity