Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by etobella
- Loading branch information
Showing
23 changed files
with
1,040 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
====================== | ||
Maintenance Inspection | ||
====================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:36f12f29772c69279f92e5439bd43d832a9632f9e8fbf968399855598da14453 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.0/maintenance_inspection | ||
:alt: OCA/maintenance | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/maintenance-14-0/maintenance-14-0-maintenance_inspection | ||
: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=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Add the concept of inspection items inside Maintenance requests. | ||
|
||
Will only be usable insidea preventive requests. | ||
|
||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
On Preventive requests, we will be able to set an inspection and check some items. | ||
|
||
Once we close the inspection it will be no longer editable. | ||
|
||
|
||
On Plans | ||
~~~~~~~~ | ||
|
||
When using Maintenance Plans, we can define items to evaluate in order to generate | ||
them automatically on maintenance creation | ||
|
||
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_inspection%0Aversion:%2014.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 | ||
~~~~~~~ | ||
|
||
* Dixmit | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Enric Tobella | ||
|
||
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/14.0/maintenance_inspection>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Maintenance Inspection", | ||
"summary": """ | ||
Allow to manage inspections inside Preventive requests""", | ||
"version": "14.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Dixmit,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/maintenance", | ||
"depends": ["maintenance_plan", "base_maintenance"], | ||
"data": [ | ||
"views/maintenance_plan.xml", | ||
"security/ir.model.access.csv", | ||
"views/maintenance_inspection_line.xml", | ||
"views/maintenance_inspection_item.xml", | ||
"views/maintenance_request.xml", | ||
], | ||
"demo": [], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from . import maintenance_request | ||
from . import maintenance_inspection_item | ||
from . import maintenance_inspection_line | ||
from . import maintenance_plan | ||
from . import maintenance_equipment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class MaintenanceEquipment(models.Model): | ||
|
||
_inherit = "maintenance.equipment" | ||
|
||
def _prepare_request_from_plan(self, maintenance_plan, next_maintenance_date): | ||
result = super()._prepare_request_from_plan( | ||
maintenance_plan, next_maintenance_date | ||
) | ||
if maintenance_plan.inspection_item_ids: | ||
result.update( | ||
{ | ||
"has_inspection": True, | ||
"inspection_line_ids": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"item_id": item.id, | ||
}, | ||
) | ||
for item in maintenance_plan.inspection_item_ids | ||
], | ||
} | ||
) | ||
return result |
14 changes: 14 additions & 0 deletions
14
maintenance_inspection/models/maintenance_inspection_item.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MaintenanceInspectionItem(models.Model): | ||
|
||
_name = "maintenance.inspection.item" | ||
_description = "Item of evaluation" | ||
|
||
name = fields.Char(required=True) | ||
instruction = fields.Text() | ||
active = fields.Boolean(default=True) |
32 changes: 32 additions & 0 deletions
32
maintenance_inspection/models/maintenance_inspection_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MaintenanceInspectionLine(models.Model): | ||
|
||
_name = "maintenance.inspection.line" | ||
_description = "Maintenance Inspection Line" | ||
|
||
request_id = fields.Many2one( | ||
"maintenance.request", required=True, ondelete="cascade" | ||
) | ||
item_id = fields.Many2one("maintenance.inspection.item", required=True) | ||
instruction = fields.Text(related="item_id.instruction") | ||
result = fields.Selection( | ||
[("todo", "Todo"), ("success", "Success"), ("failure", "Failure")], | ||
"Result", | ||
default="todo", | ||
readonly=True, | ||
required=True, | ||
copy=False, | ||
) | ||
result_description = fields.Char() | ||
inspection_closed_at = fields.Datetime(related="request_id.inspection_closed_at") | ||
|
||
def action_success(self): | ||
self.write({"result": "success"}) | ||
|
||
def action_failure(self): | ||
self.write({"result": "failure"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MaintenancePlan(models.Model): | ||
|
||
_inherit = "maintenance.plan" | ||
|
||
inspection_item_ids = fields.Many2many("maintenance.inspection.item") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Dixmit | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MaintenanceRequest(models.Model): | ||
|
||
_inherit = "maintenance.request" | ||
|
||
has_inspection = fields.Boolean() | ||
inspection_line_ids = fields.One2many( | ||
"maintenance.inspection.line", inverse_name="request_id" | ||
) | ||
inspection_closed_at = fields.Datetime(readonly=True, copy=False) | ||
inspection_closed_by = fields.Many2one("res.users", readonly=True, copy=False) | ||
|
||
def set_inspection(self): | ||
self.write({"has_inspection": True}) | ||
|
||
def finish_inspection(self): | ||
self.write( | ||
{ | ||
"inspection_closed_at": fields.Datetime.now(), | ||
"inspection_closed_by": self.env.user.id, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Enric Tobella |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Add the concept of inspection items inside Maintenance requests. | ||
|
||
Will only be usable insidea preventive requests. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
On Preventive requests, we will be able to set an inspection and check some items. | ||
|
||
Once we close the inspection it will be no longer editable. | ||
|
||
|
||
On Plans | ||
~~~~~~~~ | ||
|
||
When using Maintenance Plans, we can define items to evaluate in order to generate | ||
them automatically on maintenance creation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_maintenance_inspection_item_user,access_maintenance_inspection_item_user,model_maintenance_inspection_item,base.group_user,1,0,0,0 | ||
access_maintenance_inspection_line_user,access_maintenance_inspection_line_user,model_maintenance_inspection_line,base.group_user,1,0,0,0 | ||
access_maintenance_inspection_item_manager,access_maintenance_inspection_item_manager,model_maintenance_inspection_item,maintenance.group_equipment_manager,1,1,1,0 | ||
access_maintenance_inspection_line_manager,access_maintenance_inspection_line_manager,model_maintenance_inspection_line,maintenance.group_equipment_manager,1,1,1,1 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.