Skip to content

Commit 87884a3

Browse files
committed
Merge PR #379 into 14.0
Signed-off-by etobella
2 parents 9c24b12 + 3c82fb4 commit 87884a3

23 files changed

+1040
-0
lines changed

maintenance_inspection/README.rst

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
======================
2+
Maintenance Inspection
3+
======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:36f12f29772c69279f92e5439bd43d832a9632f9e8fbf968399855598da14453
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github
20+
:target: https://github.com/OCA/maintenance/tree/14.0/maintenance_inspection
21+
:alt: OCA/maintenance
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/maintenance-14-0/maintenance-14-0-maintenance_inspection
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
Add the concept of inspection items inside Maintenance requests.
32+
33+
Will only be usable insidea preventive requests.
34+
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Usage
42+
=====
43+
44+
On Preventive requests, we will be able to set an inspection and check some items.
45+
46+
Once we close the inspection it will be no longer editable.
47+
48+
49+
On Plans
50+
~~~~~~~~
51+
52+
When using Maintenance Plans, we can define items to evaluate in order to generate
53+
them automatically on maintenance creation
54+
55+
Bug Tracker
56+
===========
57+
58+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/maintenance/issues>`_.
59+
In case of trouble, please check there if your issue has already been reported.
60+
If you spotted it first, help us to smash it by providing a detailed and welcomed
61+
`feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_inspection%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62+
63+
Do not contact contributors directly about support or help with technical issues.
64+
65+
Credits
66+
=======
67+
68+
Authors
69+
~~~~~~~
70+
71+
* Dixmit
72+
73+
Contributors
74+
~~~~~~~~~~~~
75+
76+
* Enric Tobella
77+
78+
Maintainers
79+
~~~~~~~~~~~
80+
81+
This module is maintained by the OCA.
82+
83+
.. image:: https://odoo-community.org/logo.png
84+
:alt: Odoo Community Association
85+
:target: https://odoo-community.org
86+
87+
OCA, or the Odoo Community Association, is a nonprofit organization whose
88+
mission is to support the collaborative development of Odoo features and
89+
promote its widespread use.
90+
91+
This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/14.0/maintenance_inspection>`_ project on GitHub.
92+
93+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

maintenance_inspection/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Maintenance Inspection",
6+
"summary": """
7+
Allow to manage inspections inside Preventive requests""",
8+
"version": "14.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "Dixmit,Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/maintenance",
12+
"depends": ["maintenance_plan", "base_maintenance"],
13+
"data": [
14+
"views/maintenance_plan.xml",
15+
"security/ir.model.access.csv",
16+
"views/maintenance_inspection_line.xml",
17+
"views/maintenance_inspection_item.xml",
18+
"views/maintenance_request.xml",
19+
],
20+
"demo": [],
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from . import maintenance_request
2+
from . import maintenance_inspection_item
3+
from . import maintenance_inspection_line
4+
from . import maintenance_plan
5+
from . import maintenance_equipment
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class MaintenanceEquipment(models.Model):
8+
9+
_inherit = "maintenance.equipment"
10+
11+
def _prepare_request_from_plan(self, maintenance_plan, next_maintenance_date):
12+
result = super()._prepare_request_from_plan(
13+
maintenance_plan, next_maintenance_date
14+
)
15+
if maintenance_plan.inspection_item_ids:
16+
result.update(
17+
{
18+
"has_inspection": True,
19+
"inspection_line_ids": [
20+
(
21+
0,
22+
0,
23+
{
24+
"item_id": item.id,
25+
},
26+
)
27+
for item in maintenance_plan.inspection_item_ids
28+
],
29+
}
30+
)
31+
return result
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class MaintenanceInspectionItem(models.Model):
8+
9+
_name = "maintenance.inspection.item"
10+
_description = "Item of evaluation"
11+
12+
name = fields.Char(required=True)
13+
instruction = fields.Text()
14+
active = fields.Boolean(default=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class MaintenanceInspectionLine(models.Model):
8+
9+
_name = "maintenance.inspection.line"
10+
_description = "Maintenance Inspection Line"
11+
12+
request_id = fields.Many2one(
13+
"maintenance.request", required=True, ondelete="cascade"
14+
)
15+
item_id = fields.Many2one("maintenance.inspection.item", required=True)
16+
instruction = fields.Text(related="item_id.instruction")
17+
result = fields.Selection(
18+
[("todo", "Todo"), ("success", "Success"), ("failure", "Failure")],
19+
"Result",
20+
default="todo",
21+
readonly=True,
22+
required=True,
23+
copy=False,
24+
)
25+
result_description = fields.Char()
26+
inspection_closed_at = fields.Datetime(related="request_id.inspection_closed_at")
27+
28+
def action_success(self):
29+
self.write({"result": "success"})
30+
31+
def action_failure(self):
32+
self.write({"result": "failure"})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class MaintenancePlan(models.Model):
8+
9+
_inherit = "maintenance.plan"
10+
11+
inspection_item_ids = fields.Many2many("maintenance.inspection.item")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright 2023 Dixmit
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class MaintenanceRequest(models.Model):
8+
9+
_inherit = "maintenance.request"
10+
11+
has_inspection = fields.Boolean()
12+
inspection_line_ids = fields.One2many(
13+
"maintenance.inspection.line", inverse_name="request_id"
14+
)
15+
inspection_closed_at = fields.Datetime(readonly=True, copy=False)
16+
inspection_closed_by = fields.Many2one("res.users", readonly=True, copy=False)
17+
18+
def set_inspection(self):
19+
self.write({"has_inspection": True})
20+
21+
def finish_inspection(self):
22+
self.write(
23+
{
24+
"inspection_closed_at": fields.Datetime.now(),
25+
"inspection_closed_by": self.env.user.id,
26+
}
27+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Enric Tobella
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Add the concept of inspection items inside Maintenance requests.
2+
3+
Will only be usable insidea preventive requests.
4+
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
On Preventive requests, we will be able to set an inspection and check some items.
2+
3+
Once we close the inspection it will be no longer editable.
4+
5+
6+
On Plans
7+
~~~~~~~~
8+
9+
When using Maintenance Plans, we can define items to evaluate in order to generate
10+
them automatically on maintenance creation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
access_maintenance_inspection_item_user,access_maintenance_inspection_item_user,model_maintenance_inspection_item,base.group_user,1,0,0,0
3+
access_maintenance_inspection_line_user,access_maintenance_inspection_line_user,model_maintenance_inspection_line,base.group_user,1,0,0,0
4+
access_maintenance_inspection_item_manager,access_maintenance_inspection_item_manager,model_maintenance_inspection_item,maintenance.group_equipment_manager,1,1,1,0
5+
access_maintenance_inspection_line_manager,access_maintenance_inspection_line_manager,model_maintenance_inspection_line,maintenance.group_equipment_manager,1,1,1,1
Loading

0 commit comments

Comments
 (0)