Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Restaurant
Entity: pos.order
Compute Method: _compute_duration
| Inputs | Method | Outputs |
|---|---|---|
|
+ current_time = fields.Datetime.now() + for order in self: + if not order.table_id: + order.duration = "" + continue + start_time = order.create_date + end_time = current_time if order.state == "draft" else order.date_order + duration_minutes = int((end_time - start_time).total_seconds() // 60) + if duration_minutes <= 0: + order.duration = "" + continue + hours, minutes = divmod(duration_minutes, 60) + if hours: + order.duration = f"{hours}h{minutes}'" if minutes else f"{hours}h" + else: + order.duration = f"{minutes}'" |
|
