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

Module: EDI endpoint

Entity: edi.backend

Compute Method: _compute_endpoints_count

View 17.0 View 19.0
Inputs Method Outputs
  • id
- data = self.env["edi.endpoint"].read_group(
-             [("backend_id", "in", self.ids), ("active", "=", True)],
-             ["backend_id"],
-             ["backend_id"],
+ data = self.env["edi.endpoint"]._read_group(
+             domain=Domain("backend_id", "in", self.ids) & Domain("active", "=", True),
+             groupby=["backend_id"],
+             aggregates=["__count"],
        )
- by_backend_id = {x["backend_id"][0]: x["backend_id_count"] for x in data}
+ by_backend_id = {backend.id: count for backend, count in data}
for record in self:
-             record.endpoints_count = by_backend_id.get(record.id)
+             record.endpoints_count = by_backend_id.get(record.id, 0)
  • endpoints_count

Back to entity