Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
e41171d
[ADD] maintenance_plan module (#2)
grindtildeath Oct 2, 2017
d934e4f
[FIX] maintenance_plan: README try me on runbot link
pedrobaeza Nov 29, 2017
235b7bf
[MIG] maintenance_plan: Migration to 11.0
bestmazzo Oct 25, 2018
e2b7569
[FIX] maintenance_plan: prevent preventive request cron crashing when…
dalonsod Jul 1, 2019
21d118d
[MIG] maintenance_plan: Migration to 12.0
dalonsod Jul 8, 2019
6b81594
Added translation using Weblate (Spanish)
lromero-solvos Jul 26, 2019
5cc0bc0
Translated using Weblate (Spanish)
lromero-solvos Jul 26, 2019
056d529
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 18, 2019
4b888c8
[FIX] maintenance_plan: cron generated request should inherit equipme…
dalonsod Oct 15, 2019
f17c185
[FIX] maintenance_plan: next_maintenance_date should be stored
dalonsod Oct 28, 2019
cf4dcbc
[12.0][IMP] maintenance_plan
AdriaGForgeFlow Jul 19, 2019
656ae7b
[11.0][IMP] maintenance_plan: Return the created requests
etobella Dec 24, 2019
4bb10a1
[12.0][FIX] maintenance_project_plan
etobella Dec 24, 2019
c154d2d
[12.0][FIX] default equipment_id in plans
Dec 13, 2019
9b64346
[12.0][IMP] maintenance_plan: Add team on plans
etobella Dec 24, 2019
f846ddc
[FIX] maintenance_plan: prevent False as display name when name is empty
dalonsod Jan 2, 2020
18ac459
Translated using Weblate (Spanish)
dalonsod Jan 8, 2020
ec8eb56
[IMP] maintenance_plan: black, isort
NuriaXifre Jan 14, 2020
cb8e825
[13.0][MIG] maintenance_plan
NuriaXifre Jan 14, 2020
7156701
[12.0][IMP] maintenance_plan: no equipment
Jan 22, 2020
d0df8c1
[FIX]maintenance_plan migration scripts not applicable in v13
AaronHForgeFlow May 19, 2020
2ae3ed2
[13.0][IMP] maintenance_plan: make maintenance plan multi-company com…
LoisRForgeFlow Oct 29, 2020
74019b4
maintenance_plan: manual version bump
LoisRForgeFlow Oct 29, 2020
b472977
[IMP] maintenance_plan: black, isort, prettier
dalonsod Nov 15, 2020
e2fb260
[MIG] maintenance_plan: Migration to 14.0
dalonsod Nov 15, 2020
c7e405a
Added translation using Weblate (Italian)
mymage Jul 28, 2021
7a652ec
Translated using Weblate (Italian)
mymage Jul 28, 2021
5426cd4
[FIX] maintenance_plan: Remake the computation of next date
etobella Sep 29, 2021
e63a5ce
Translated using Weblate (Italian)
mymage Oct 2, 2021
6700fab
[IMP] maintenance_plan: next maintenance date tweaks
LoisRForgeFlow Oct 4, 2021
dd53127
Translated using Weblate (Italian)
mymage Oct 16, 2021
9202e68
[IMP] maintenance_plan: black, isort, prettier
BernatPForgeFlow Oct 22, 2021
45338c5
[MIG] maintenance_plan: Migration to 15.0
BernatPForgeFlow Oct 22, 2021
ca81702
[UPD] Update maintenance_plan.pot
Oct 27, 2021
83e1b40
[UPD] README.rst
OCA-git-bot Oct 27, 2021
c8af8b6
[FIX] maintenance_plan: fix new request date when plan start date is …
mariadforgeflow Jan 21, 2022
30dd680
maintenance_plan 15.0.1.0.1
OCA-git-bot Jan 26, 2022
dab9432
[FIX] maintenance_plan: avoid error if planning_step is not defined
MiquelRForgeFlow Jun 17, 2022
4da0000
[IMP] maintenance_plan: add chatter
mariadforgeflow Jul 19, 2022
c5512b3
[UPD] Update maintenance_plan.pot
Jul 25, 2022
c979d21
maintenance_plan 15.0.1.1.0
OCA-git-bot Jul 25, 2022
7e8d120
Update translation files
oca-transbot Jul 25, 2022
6ef528b
maintenance_plan 15.0.1.1.1
OCA-git-bot Jul 29, 2022
5cb9550
[15.0][FIX] maintenance_plan generate requests for inactive equipment
sergiocorato Oct 14, 2022
15bd77c
maintenance_plan 15.0.1.1.2
OCA-git-bot Oct 20, 2022
3f9cedf
Translated using Weblate (Italian)
mymage Oct 28, 2022
407b8f6
Translated using Weblate (Italian)
mymage Oct 31, 2022
5636d73
[REF] moving function get_relativedelta to method
mymage Nov 23, 2022
6d882a3
Added translation using Weblate (Portuguese)
pedrocs-exo Dec 3, 2022
685b2c7
Translated using Weblate (Portuguese)
pedrocs-exo Dec 3, 2022
8329fb4
Translated using Weblate (Portuguese)
pedrocs-exo Dec 3, 2022
7b85be4
[UPD] Update maintenance_plan.pot
Dec 22, 2022
ac20ed7
maintenance_plan 15.0.1.2.0
OCA-git-bot Dec 22, 2022
ecee917
Update translation files
weblate Dec 22, 2022
3a07805
Translated using Weblate (Italian)
mymage Dec 23, 2022
68b4796
Translated using Weblate (Italian)
mymage Dec 28, 2022
09a789c
Translated using Weblate (Italian)
francesco-ooops Dec 29, 2022
47c6720
Translated using Weblate (Italian)
francesco-ooops Dec 30, 2022
5d66911
Translated using Weblate (Italian)
francesco-ooops Jan 3, 2023
5be2e81
Translated using Weblate (Italian)
mymage Jan 11, 2023
494ddae
Translated using Weblate (Italian)
mymage Feb 14, 2023
0464af0
[FIX] maintenance_plan: fix maintence request form view
kluna1998 Jan 25, 2023
e9b18ad
[UPD] Update maintenance_plan.pot
Feb 20, 2023
12ee98a
maintenance_plan 15.0.1.3.0
OCA-git-bot Feb 20, 2023
46ecba3
Update translation files
weblate Feb 20, 2023
f72bf23
[IMP] maintenance_plan: Add instructions to request report.
victoralmau Feb 20, 2023
f65b294
[UPD] Update maintenance_plan.pot
Feb 21, 2023
f163ec7
maintenance_plan 15.0.1.4.0
OCA-git-bot Feb 21, 2023
7907b58
Update translation files
weblate Feb 21, 2023
e58954d
[IMP] maintenance_plan: Add Generate requests for current threshold b…
victoralmau Feb 17, 2023
f9c9f44
[UPD] Update maintenance_plan.pot
Feb 22, 2023
72db1b9
maintenance_plan 15.0.1.5.0
OCA-git-bot Feb 22, 2023
0abde4d
Update translation files
weblate Feb 22, 2023
f223a28
[IMP] maintenance_plan: Set planned_hours in request from plan if mai…
victoralmau Jan 13, 2023
e6baa23
maintenance_plan 15.0.1.5.1
OCA-git-bot Feb 24, 2023
0c11591
[IMP] maintenance_plan: Skip assigned mail + Activity mail of the req…
victoralmau Feb 27, 2023
03ae874
[UPD] Update maintenance_plan.pot
Mar 2, 2023
ddebdc4
maintenance_plan 15.0.1.6.0
OCA-git-bot Mar 2, 2023
b041017
Update translation files
weblate Mar 2, 2023
b48e782
[IMP] maintenance_plan: Change tests to allow inheritance
victoralmau Feb 24, 2023
708f9e5
maintenance_plan 15.0.1.6.1
OCA-git-bot Mar 3, 2023
cc3f11a
Translated using Weblate (Italian)
mymage Mar 8, 2023
c9c68a5
Translated using Weblate (Italian)
mymage Apr 4, 2023
7c50e0b
Translated using Weblate (Italian)
mymage Apr 12, 2023
3ca4ff3
[IMP] maintenance_plan: Add rules to maintenance.plan to view records…
victoralmau Apr 14, 2023
dac694b
maintenance_plan 15.0.1.7.0
OCA-git-bot Apr 19, 2023
2a20fc3
Translated using Weblate (Italian)
francesco-ooops Apr 26, 2023
6d44a5d
Translated using Weblate (Italian)
francesco-ooops May 12, 2023
5d06ff4
Translated using Weblate (Italian)
francesco-ooops May 17, 2023
3bc2ab7
Translated using Weblate (Spanish)
Ivorra78 Jun 30, 2023
b2455a3
Translated using Weblate (Spanish)
Ivorra78 Jul 6, 2023
19b8dde
Translated using Weblate (Italian)
francesco-ooops Jul 12, 2023
4a17ebc
Translated using Weblate (Italian)
mymage Aug 22, 2023
73aac16
[UPD] README.rst
OCA-git-bot Sep 3, 2023
a4ca03f
Translated using Weblate (Spanish)
Ivorra78 Sep 20, 2023
8f552cb
[UPD] Update maintenance_plan.pot
Oct 28, 2023
1f24838
Update translation files
weblate Oct 29, 2023
baee14e
[IMP] maintenance_plan: Add freeze_time to prevent errors in tests
victoralmau Oct 31, 2023
f70a57b
[BOT] post-merge updates
OCA-git-bot Oct 31, 2023
c396b2a
[IMP] maintenance_plan: Allow to generate generic plans for multiple …
etobella Sep 6, 2023
50c7115
[FIX] maintenance_plan: The search must work with newIds
etobella Oct 24, 2023
0cd04e7
[IMP] maintenance_plan: Add Team filter
etobella Oct 25, 2023
2234661
[FIX] maintenance_plan: adapt tests
etobella Dec 11, 2023
6f9ff10
[UPD] Update maintenance_plan.pot
Dec 11, 2023
f420cbb
[BOT] post-merge updates
OCA-git-bot Dec 11, 2023
84bb4aa
Update translation files
weblate Dec 11, 2023
616a607
Translated using Weblate (Italian)
mymage Dec 19, 2023
32eb629
[MIG] maintenance_plan: Migration to 16.0
alexeirivera87 Feb 1, 2024
0aa0d38
[UPD] Update maintenance_plan.pot
Feb 2, 2024
d0ab8d7
Translated using Weblate (Spanish)
Ivorra78 Feb 3, 2024
495ad5c
[IMP] maintenance_plan: pre-commit auto fixes
FernandoRomera Jul 23, 2024
fd77435
[MIG] maintenance_plan: Migration to 17.0
FernandoRomera Jul 23, 2024
4662792
[UPD] Update maintenance_plan.pot
Aug 8, 2024
f6a0326
[BOT] post-merge updates
OCA-git-bot Aug 8, 2024
0161c72
[UPD] Update maintenance_plan.pot
Aug 20, 2024
6d9923f
Update translation files
weblate Aug 20, 2024
fbfaac9
Translated using Weblate (Italian)
mymage Aug 20, 2024
c75c72b
[FIX] maintenance_plan: fix the use of id in act_window
vincent-hatakeyama Nov 28, 2024
a876388
Translated using Weblate (Italian)
mymage Dec 17, 2024
ce68c15
Translated using Weblate (Italian)
mymage Dec 31, 2024
6c0061c
[IMP] base_maintenance: Fine-tuning of the form view
carlos-lopez-tecnativa Jan 14, 2025
fe46b4d
[UPD] Update maintenance_plan.pot
Jan 15, 2025
2839a2e
[BOT] post-merge updates
OCA-git-bot Jan 15, 2025
a8bef51
Update translation files
weblate Jan 15, 2025
1efb282
[BOT] post-merge updates
OCA-git-bot Jan 15, 2025
6a4a658
[IMP] maintenance_plan: Define module as deprecated in readme
victoralmau Feb 20, 2025
8e01d3d
[BOT] post-merge updates
OCA-git-bot Mar 13, 2025
3d556f9
[IMP] maintenance_plan: pre-commit auto fixes
gbrito Oct 3, 2025
f6bfb4e
[MIG] maintenance_plan: Migration to 18.0
gbrito Oct 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions maintenance_plan/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
================
Maintenance Plan
================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cd21f05e56ccccd12e88d22a3009fd970401a379a695813d5815b03ed56303a2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github
:target: https://github.com/OCA/maintenance/tree/17.0/maintenance_plan
:alt: OCA/maintenance
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/maintenance-17-0/maintenance-17-0-maintenance_plan
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the functionality of Odoo Maintenance module by
allowing an equipment to have different preventive maintenance kinds.

**Table of contents**

.. contents::
:local:

Installation
============

Install the module.

Should you already use the maintenance module and have equipments with
field 'Preventive Maintenance Frequency' defined, a new maintenance plan
will be automatically created on these equipments with maintenance kind
'Install'.

Moreover if a Request of type 'preventive' exists, whose stage isn't
marked as 'Request done', and has a Request Date matching the
equipment's 'Next Preventive Maintenance', the request will be updated
with the 'Install' maintenance kind.

Make sure you don't have multiple 'preventive' requests at a stage which
isn't marked as 'Request done' and on the same 'Request date' as the
equipment or the module installation will fail with a User Error.

Usage
=====

Instead of defining a period and duration for only one preventive
maintenance per equipment, you can define multiple preventive
maintenance kind for each equipment.

Maintenance Kinds have to be defined through the configuration menu.
Their name have to be unique and can be set as active or inactive,
should these not be used anymore.

On any equipment over the maintenance tab, the maintenance plan be
accessible, allowing to add different maintenance kind with their own
frequency and duration. The next maintenance date will then be computed
automatically according to the start's date and the frequency defined,
but the maintenance request won't be created automatically as is the
case in Odoo's Maintenance module. In the plan there's also a field
allowing the user to set the maintenance horizon, insert the
instructions to follow on the maintenance that will be forwarded to the
maintenance request generated from the plan.

This module uses the original Cron job of Odoo's Maintenance module to
generate maintenance requests. To do so, it takes into account the
planning horizon and generates all maintenance requests whose schedule
date would fall inside that planning horizon. Therefore, the maintenance
manager can have a proper planning of how many maintenance requests are
programming for the future. Leaving planning horizon to 0 will only
create those maintenance request that are scheduled for today.

We can also create maintenance requests from a plan using a domain for
selecting the equipments. This way, we might have a single plan that
will generate all the requests. In order to use it, we need to mark the
Generate with Domain field.

Known issues / Roadmap
======================

This module is considered deprecated already in 17.0 because the
recurrence functionality is already included in core in the requests
themselves.
https://github.com/OCA/maintenance/pull/414#issuecomment-2668929617

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/maintenance/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_plan%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp SA
* ForgeFlow

Contributors
------------

- Akim Juillerat <akim.juillerat@camptocamp.com>
- Matteo Mazzoni <matteo@appcademy.tech>
- David Alonso <david.alonso@solvos.es>
- Adrià Gil Sorribes <adria.gil@forgeflow.com>
- Jordi Ballester Alomar <jordi.ballester@forgeflow.com>
- Lois Rilo <lois.rilo@forgeflow.com>
- Enric Tobella <enric.tobella@dixmit.com>
- Alexei Rivera <arivera@archeti.com>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/17.0/maintenance_plan>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions maintenance_plan/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook
26 changes: 26 additions & 0 deletions maintenance_plan/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Maintenance Plan",
"summary": "Extends preventive maintenance planning",
"version": "18.0.1.0.0",
"author": "Camptocamp SA, ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Maintenance",
"website": "https://github.com/OCA/maintenance",
"images": [],
"depends": ["base_maintenance"],
"data": [
"security/ir.model.access.csv",
"security/maintenance_security.xml",
"data/ir_cron.xml",
"views/maintenance_kind_views.xml",
"views/maintenance_plan_views.xml",
"views/maintenance_equipment_views.xml",
"views/report_maintenance_request.xml",
],
"external_dependencies": {"python": ["python-dateutil"]},
"demo": ["demo/demo_maintenance_plan.xml"],
"post_init_hook": "post_init_hook",
"installable": True,
}
11 changes: 11 additions & 0 deletions maintenance_plan/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding='UTF-8' ?>
<odoo>
<record id="maintenance_requests_cron" model="ir.cron">
<field name="name">Maintenance: generate preventive maintenance requests</field>
<field name="model_id" ref="model_maintenance_equipment" />
<field name="state">code</field>
<field name="code">model._cron_generate_requests()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
</record>
</odoo>
57 changes: 57 additions & 0 deletions maintenance_plan/demo/demo_maintenance_plan.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- Maintenance kinds -->
<record id="maintenance_kind_monthly" model="maintenance.kind">
<field name="name">Monthly</field>
<field name="active" eval="True" />
</record>
<record id="maintenance_kind_weekly" model="maintenance.kind">
<field name="name">Weekly</field>
<field name="active" eval="True" />
</record>
<!-- Maintenance plans -->
<record id="maintenance_plan_monthly_monitor1" model="maintenance.plan">
<field name="equipment_id" ref="maintenance.equipment_monitor1" />
<field name="maintenance_kind_id" ref="maintenance_kind_monthly" />
<field name="interval">1</field>
<field name="interval_step">month</field>
<field name="duration">2</field>
<field name="maintenance_plan_horizon">2</field>
<field name="planning_step">month</field>
</record>
<record id="maintenance_plan_monthly_monitor4" model="maintenance.plan">
<field name="equipment_id" ref="maintenance.equipment_monitor4" />
<field name="maintenance_kind_id" ref="maintenance_kind_monthly" />
<field name="interval">1</field>
<field name="interval_step">month</field>
<field name="duration">2</field>
<field name="maintenance_plan_horizon">2</field>
<field name="planning_step">month</field>
</record>
<record id="maintenance_plan_monthly_monitor6" model="maintenance.plan">
<field name="equipment_id" ref="maintenance.equipment_monitor6" />
<field name="maintenance_kind_id" ref="maintenance_kind_monthly" />
<field name="interval">1</field>
<field name="interval_step">month</field>
<field name="duration">2</field>
<field name="maintenance_plan_horizon">1</field>
<field name="planning_step">month</field>
</record>
<record id="maintenance_plan_monthly_printer1" model="maintenance.plan">
<field name="equipment_id" ref="maintenance.equipment_printer1" />
<field name="maintenance_kind_id" ref="maintenance_kind_monthly" />
<field name="interval">1</field>
<field name="interval_step">month</field>
<field name="duration">4</field>
<field name="maintenance_plan_horizon">3</field>
<field name="planning_step">month</field>
</record>
<record id="maintenance_plan_weekly_printer1" model="maintenance.plan">
<field name="equipment_id" ref="maintenance.equipment_printer1" />
<field name="maintenance_kind_id" ref="maintenance_kind_weekly" />
<field name="interval">7</field>
<field name="duration">2</field>
<field name="maintenance_plan_horizon">1</field>
<field name="planning_step">month</field>
</record>
</odoo>
48 changes: 48 additions & 0 deletions maintenance_plan/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

from odoo import _
from odoo.exceptions import UserError


def post_init_hook(env):
logging.getLogger("odoo.addons.maintenance_plan").info(
"Migrating existing preventive maintenance"
)

equipments = env["maintenance.equipment"].search([("expected_mtbf", "!=", False)])

if equipments:
maintenance_kind = env["maintenance.kind"].create(
{"name": "Install", "active": True}
)

for equipment in equipments:
request = equipment.maintenance_ids.filtered(
lambda r, equipment=equipment: r.maintenance_type == "preventive"
and not r.stage_id.done
and r.request_date == equipment.next_action_date
)
if len(request) > 1:
raise UserError(
_(
"You have multiple preventive maintenance requests on "
"equipment %(name)s next action date (%(date)s). "
"Please leave only one preventive request on the "
"date of equipment's next action to install the module.",
name=equipment.name,
date=equipment.next_action_date,
)
)
elif len(request) == 1:
request.write({"maintenance_kind_id": maintenance_kind.id})
env["maintenance.plan"].create(
{
"equipment_id": equipment.id,
"maintenance_kind_id": maintenance_kind.id,
"duration": equipment.mtbf,
"interval": equipment.expected_mtbf,
}
)
Loading