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

Module: Donation Mass

Entity: mass.request.transfer

Compute Method: _compute_transfer_totals

View 18.0
Inputs Method Outputs
  • id
- rg_res = self.env["mass.request"]._read_group(
-             [("transfer_id", "in", self.ids)],
-             groupby=["transfer_id"],
-             aggregates=["mass_quantity:sum", "offering:sum"],
-         )
- mapped_data = {
-             trf.id: {
-                 "mass_quantity": mass_qty_total,
-                 "offering": offering_total,
-             }
-             for (trf, mass_qty_total, offering_total) in rg_res
-         }
- for trf in self:
-             trf.amount_total = mapped_data.get(trf.id, {"offering": 0}).get("offering")
-             trf.mass_total = mapped_data.get(trf.id, {"mass_quantity": 0}).get(
-                 "mass_quantity"
-             )
  • amount_total
  • mass_total

Back to entity