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

Module: Account Payment Batch OCA

Entity: account.payment.order

Compute Method: _compute_payment_count

Inputs Method Outputs
  • id
rg_res = self.env["account.payment"]._read_group(
            [("payment_order_id", "in", self.ids)],
            groupby=["payment_order_id"],
            aggregates=["__count"],
        )
mapped_data = {order.id: pay_count for (order, pay_count) in rg_res}
for order in self:
            order.payment_count = mapped_data.get(order.id, 0)

Back to entity