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

Compute Method: _compute_duration

Inputs Method Outputs
"""Compute duration for each booking."""
for record in self:
            # Special case when creating record from UI
            if not record.id:
                record.duration = self.default_get(["duration"]).get(
                    "duration", record.type_id.duration
                )
            # Get duration from type only when changing type or when creating from ORM
            elif not record.duration or record._origin.type_id != record.type_id:
                record.duration = record.type_id.duration
            # Get it from meeting only when available
            elif record.meeting_id:
                record.duration = record.meeting_id.duration

Back to entity