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

Module: Endpoint cache

Entity: endpoint.mixin

Compute Method: _compute_cache_att_count

Inputs Method Outputs
  • id
domain = [
            ("name", "like", "endpoint_cache%"),
            ("res_model", "=", self._name),
        ]
data = self.env["ir.attachment"].read_group(domain, ["res_id"], ["res_id"])
mapped_data = {m["res_id"]: m["res_id_count"] for m in data}
for rec in self:
            rec.cache_att_count = mapped_data.get(rec.id, 0)

Back to entity