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

Compute Method: _compute_payment_lot

Inputs Method Outputs
  • id
rg_res = self.env["account.payment"]._read_group(
            [("payment_lot_id", "in", self.ids)],
            groupby=["payment_lot_id"],
            aggregates=["__count", "amount:sum"],
        )
mapped_data = {
            lot.id: {"count": count, "total": total} for (lot, count, total) in rg_res
        }
for lot in self:
            lot.payment_count = mapped_data.get(lot.id, {}).get("count")
            lot.amount = mapped_data.get(lot.id, {}).get("total", 0)

Back to entity