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

Module: Resource booking

Entity: resource.booking.combination

Compute Method: _compute_booking_count

Inputs Method Outputs
  • id
data = self.env["resource.booking"].read_group(
            [("combination_id", "in", self.ids)], ["combination_id"], ["combination_id"]
        )
mapping = {x["combination_id"][0]: x["combination_id_count"] for x in data}
for one in self:
            one.booking_count = mapping.get(one.id, 0)

Back to entity