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

Module: Transport

Entity: tms.order

Compute Method: _compute_scheduled_duration

Inputs Method Outputs
for record in self:
            if (
                record.scheduled_date_end and record.scheduled_date_start
            ) and not record.route_id:
                difference = record.scheduled_date_end - record.scheduled_date_start
                record.scheduled_duration = difference.total_seconds() / 3600
            elif record.route_id:
                if (
                    record.route_id.estimated_time_uom.id
                    == self.env.ref("uom.product_uom_day").id
                ):
                    record.scheduled_duration = record.route_id.estimated_time * 24
                else:
                    record.scheduled_duration = record.route_id.estimated_time
            else:
                record.scheduled_duration = 0.0

Back to entity