For any business whose operations involve machines and other equipment, machine failures can lead to huge losses in time, inefficiency, and dissatisfied customers. However, most companies continue using manual approaches to maintaining equipment where records are kept in spreadsheets or calendars.
However, with automatic maintenance in Odoo 18, companies can be more proactive by connecting their service contracts to equipment and creating service tickets before maintenance is needed.
Key Benefits
- Cut downtime by detecting potential problems before they turn into major breakdowns.
- Increase efficiency through automated scheduling and ticket generation.
- Make sure to stay compliant with contracts by conducting timely maintenance.
- Better plan your resources with insight into future service activities.
- Reduce maintenance expenses with preventive servicing.
For instance, a fleet management firm can schedule its vehicle services and inspections at regular intervals to ensure that its vehicles are functioning properly and will not break down unexpectedly.
Odoo uses models and scheduling to monitor the service dates and create requests for maintenance to facilitate a better preventive maintenance process.
We have used two models to maintain our schedule. We have used preventive.maintainence as the primary model, which is connected to our machine and preventive.maintainence.dates as the secondary one.
from odoo import models, fields, api, _
import datetime
class PreventiveMaintainence(models.Model):
_name = 'preventive.maintainence'
_inherit = 'mail.thread'
sn = fields.Char(string="Serial Number", required=True)
interval = fields.Selection([
("3","3 Months"), ("6","6 Months"),
("9","9 Months"), ("12","12 Months")
], string="Interval", default="3")
pm_date_lines = fields.One2many("preventive.maintainence.dates", "pm_id")
status = fields.Selection([("draft","Draft"),("active","Active")], default="draft")
def _pm_watch(self):
# This is the "brain" that runs every night to check for upcoming work
dates = self.env["preventive.maintainence.dates"].search([("is_done","=",False)])
for item in dates:
if item.date == datetime.date.today():
# Create the helpdesk ticket automatically!
self.env["helpdesk.ticket"].create({"sn_search": item.pm_id.sn})
item.is_done = True
class PreventiveMaintainenceDates(models.Model):
_name = 'preventive.maintainence.dates'
pm_id = fields.Many2one("preventive.maintainence")
date = fields.Date(string="Date")
is_done = fields.Boolean(string="Done")
Our design ensured that it only took the click of one button to create an entire year’s worth of maintenance appointments.
<!-- A simplified look at the maintenance form -->
<record id="preventive_maintainence_form" model="ir.ui.view">
<field name="model">preventive.maintainence</field>
<field name="arch" type="xml">
<form>
<header>
<button name="generate_dates_table" string="Generate Schedule" type="object" invisible="status != 'draft'"/>
<button name="set_active" string="Activate" type="object" invisible="status == 'active'"/>
</header>
<sheet>
<group>
<field name="sn"/>
<field name="interval"/>
</group>
<field name="pm_date_lines">
<list>
<field name="date"/>
<field name="is_done"/>
</list>
</field>
</sheet>
</form>
</field>
</record>
Odoo 18 makes it possible for companies to go beyond manual maintenance management by automating the scheduling, requests, and preventive maintenance. This will ensure the equipment is maintained at the right time.
To read more about An Overview to Maintenance Module in Odoo 18, refer to our blog An Overview to Maintenance Module in Odoo 18.