Skip to Content
Menu
This question has been flagged
3 Replies
226 Views

Hello Everyone! I would like to understand how MTTR (Mean Time To Repair) is calculated in the Odoo 18 Entrprise Maintenance module. I input the repair duration in hours within the Maintenance Request, but MTTR appears to be calculated in days. This has caused me some confusion. Could someone kindly explain the calculation method with an example? Thank you very much for your help.

Avatar
Discard
Best Answer

Hi,

The amount of time (in days) it takes to repair this equipment upon failure. This value updates once a maintenance request is completed for this equipment.


for record in self:

    maintenance_requests = record.maintenance_ids.filtered(lambda mr: mr.maintenance_type == 'corrective' and mr.stage_id.done)

    record.mttr = len(maintenance_requests) and (sum(int((request.close_date - request.request_date).days) for request in maintenance_requests) / len(maintenance_requests)) or 0



The _compute_maintenance_request method calculates the Mean Time To Repair (MTTR) for each record (typically equipment) by averaging the duration of completed corrective maintenance requests. It first filters the related maintenance requests to include only those with maintenance_type = 'corrective' and in a stage marked as done. For each of these filtered requests, it calculates the time taken to resolve the issue by subtracting the request_date from the close_date, taking only the number of full days (.days) between them. These durations are summed and divided by the total number of such requests to get the average downtime in days. If there are no matching requests, the MTTR is set to 0. Note that this method uses integer days, so any partial days are ignored in the calculation.


Hope it helps.

Avatar
Discard
Best Answer

MTTR (Mean Time to Repair) = Total Downtime / Number of Repairs

Steps to Calculate MTTR:

  1. Go to: Maintenance → Reporting → Maintenance Requests.
  2. Ensure each request has:
    • A “Request Date”
    • A “Repair Done Date” (you can use close_date or date_done fields).
  3. Calculate Downtime per request:
    downtime = date_done - request_date
  4. Sum all downtime durations, divide by number of requests to get MTTR.
Avatar
Discard
Best Answer

You can search the Forum before asking - in case there is already a relevant question matching yours - see https://www.odoo.com/forum/help-1/mean-time-to-repair-190280

Avatar
Discard