Skip to content

Commit

Permalink
Merge PR #323 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by etobella
  • Loading branch information
OCA-git-bot committed Jul 6, 2023
2 parents 4ce0a69 + c6fb5ab commit d0f5a44
Show file tree
Hide file tree
Showing 20 changed files with 1,023 additions and 0 deletions.
91 changes: 91 additions & 0 deletions maintenance_request_repair/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
==========================
Maintenance Request Repair
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/15.0/maintenance_request_repair
:alt: OCA/maintenance
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/maintenance-15-0/maintenance-15-0-maintenance_request_repair
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/240/15.0
:alt: Try me on Runbot

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

This is a bridge module between Maintenance and Repair

This module contains some new features for Maintenance modules.

Maintenance Request

- Repair Order: add a field to link a specific repair order.

**Table of contents**

.. contents::
:local:

Usage
=====

Maintenance Request Repair

* Go to Repair → create a new one
* Go to Maintenance → Maintenance Requests
* Edit a Maintenance Request
* Select a Repair Order on the list

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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_request_repair%0Aversion:%2015.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
~~~~~~~

* Escodoo

Contributors
~~~~~~~~~~~~

* `Escodoo <https://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>

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/15.0/maintenance_request_repair>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions maintenance_request_repair/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions maintenance_request_repair/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 - TODAY, Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Maintenance Request Repair",
"summary": """
This is a bridge module between Maintenance and Repair""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"category": "Maintenance",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/maintenance",
"depends": [
"maintenance",
"repair",
],
"data": [
"views/maintenance_request.xml",
"views/repair_order.xml",
],
}
43 changes: 43 additions & 0 deletions maintenance_request_repair/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * maintenance_request_repair
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-07-23 15:49+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_count
msgid "# Maintenances"
msgstr "N° manutenzioni"

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_maintenance_request
msgid "Maintenance Request"
msgstr "Richiesta manutenzione"

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_ids
msgid "Maintenance Requests"
msgstr "Richieste manutenzione"

#. module: maintenance_request_repair
#: model_terms:ir.ui.view,arch_db:maintenance_request_repair.repair_order_form_view
msgid "Maintenances"
msgstr "Manutenzioni"

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_repair_order
#: model:ir.model.fields,field_description:maintenance_request_repair.field_maintenance_request__repair_order_id
msgid "Repair Order"
msgstr "Oridine di riparazione"
40 changes: 40 additions & 0 deletions maintenance_request_repair/i18n/maintenance_request_repair.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * maintenance_request_repair
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_count
msgid "# Maintenances"
msgstr ""

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_maintenance_request
msgid "Maintenance Request"
msgstr ""

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_ids
msgid "Maintenance Requests"
msgstr ""

#. module: maintenance_request_repair
#: model_terms:ir.ui.view,arch_db:maintenance_request_repair.repair_order_form_view
msgid "Maintenances"
msgstr ""

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_repair_order
#: model:ir.model.fields,field_description:maintenance_request_repair.field_maintenance_request__repair_order_id
msgid "Repair Order"
msgstr ""
44 changes: 44 additions & 0 deletions maintenance_request_repair/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * maintenance_request_repair
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-07 22:44+0000\n"
"PO-Revision-Date: 2021-03-15 06:45+0000\n"
"Last-Translator: Marcel Savegnago <[email protected]>\n"
"Language-Team: \n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_count
msgid "# Maintenances"
msgstr "# Manutenções"

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_maintenance_request
msgid "Maintenance Request"
msgstr "Solicitação de Manutenção"

#. module: maintenance_request_repair
#: model:ir.model.fields,field_description:maintenance_request_repair.field_repair_order__maintenance_request_ids
msgid "Maintenance Requests"
msgstr "Solicitações de Manutenção"

#. module: maintenance_request_repair
#: model_terms:ir.ui.view,arch_db:maintenance_request_repair.repair_order_form_view
msgid "Maintenances"
msgstr "Manutenções"

#. module: maintenance_request_repair
#: model:ir.model,name:maintenance_request_repair.model_repair_order
#: model:ir.model.fields,field_description:maintenance_request_repair.field_maintenance_request__repair_order_id
msgid "Repair Order"
msgstr "Ordem de Reparo"
2 changes: 2 additions & 0 deletions maintenance_request_repair/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import maintenance_request
from . import repair_order
11 changes: 11 additions & 0 deletions maintenance_request_repair/models/maintenance_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class MaintenanceRequest(models.Model):

_inherit = "maintenance.request"

repair_order_id = fields.Many2one("repair.order", "Repair Order")
47 changes: 47 additions & 0 deletions maintenance_request_repair/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2020 - TODAY, Marcel Savegnago - Escodoo
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class RepairOrder(models.Model):

_inherit = "repair.order"

maintenance_request_ids = fields.One2many(
"maintenance.request", "repair_order_id", string="Maintenance Requests"
)

maintenance_request_count = fields.Integer(
compute="_compute_maintenance_request_count", string="# Maintenances"
)

@api.depends("maintenance_request_ids")
def _compute_maintenance_request_count(self):
for repair in self:
repair.maintenance_request_count = len(repair.maintenance_request_ids)

def action_view_maintenance_request(self):
"""This function returns an action that display existing maintenance requests
of given repair order ids. When only one found, show the maintenance request
immediately.
"""
action = self.env.ref("maintenance.hr_equipment_request_action")
result = action.read()[0]
# override the context to get rid of the default filtering on repair order
result["context"] = {"default_repair_order_id": self.id}
maintenance_request_ids = self.mapped("maintenance_request_ids")
# choose the view_mode accordingly
if not maintenance_request_ids or len(maintenance_request_ids) > 1:
result["domain"] = "[('id','in',%s)]" % (maintenance_request_ids.ids)
elif len(maintenance_request_ids) == 1:
res = self.env.ref("maintenance.hr_equipment_request_view_form", False)
form_view = [(res and res.id or False, "form")]
if "views" in result:
result["views"] = form_view + [
(state, view) for state, view in result["views"] if view != "form"
]
else:
result["views"] = form_view
result["res_id"] = maintenance_request_ids.id
return result
4 changes: 4 additions & 0 deletions maintenance_request_repair/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Escodoo <https://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>
* Kaynnan Lemes <[email protected]>
7 changes: 7 additions & 0 deletions maintenance_request_repair/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is a bridge module between Maintenance and Repair

This module contains some new features for Maintenance modules.

Maintenance Request

- Repair Order: add a field to link a specific repair order.
6 changes: 6 additions & 0 deletions maintenance_request_repair/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Maintenance Request Repair

* Go to Repair → create a new one
* Go to Maintenance → Maintenance Requests
* Edit a Maintenance Request
* Select a Repair Order on the list
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d0f5a44

Please sign in to comment.