Skip to content

Commit

Permalink
[ADD] helpdesk_mgmt_maintenance
Browse files Browse the repository at this point in the history
This module links helpdesk tickets with maintenance equipments.

Co-Authored-By: David Alonso <[email protected]>
  • Loading branch information
Anxo82 and dalonsod committed Oct 28, 2024
1 parent c86425a commit 743aefd
Show file tree
Hide file tree
Showing 18 changed files with 898 additions and 0 deletions.
77 changes: 77 additions & 0 deletions helpdesk_mgmt_maintenance/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
============================
Helpdesk Tickets Maintenance
============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9ceb7a8c5c306f0dbd5f186fd5baa72a7ea4af363442ad13b7ea3c263acca8b7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fhelpdesk-lightgray.png?logo=github
:target: https://github.com/OCA/helpdesk/tree/15.0/helpdesk_mgmt_maintenance
:alt: OCA/helpdesk
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/helpdesk-15-0/helpdesk-15-0-helpdesk_mgmt_maintenance
: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/helpdesk&target_branch=15.0
:alt: Try me on Runboat

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

This module links helpdesk tickets with maintenance equipments.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/helpdesk/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/helpdesk/issues/new?body=module:%20helpdesk_mgmt_maintenance%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
~~~~~~~

* Solvos

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

* Ángel Rivas <[email protected]>
* David Alonso <[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/helpdesk <https://github.com/OCA/helpdesk/tree/15.0/helpdesk_mgmt_maintenance>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions helpdesk_mgmt_maintenance/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions helpdesk_mgmt_maintenance/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Helpdesk Tickets Maintenance",
"summary": "Links helpdesk tickets with maintenance equipments",
"version": "15.0.1.0.0",
"category": "After-Sales",
"website": "https://github.com/OCA/helpdesk",
"author": "Solvos, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["helpdesk_mgmt", "maintenance"],
"data": [
"views/maintenance_equipment_views.xml",
"views/helpdesk_ticket_views.xml",
],
}
58 changes: 58 additions & 0 deletions helpdesk_mgmt_maintenance/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_mgmt_maintenance
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-27 10:11+0000\n"
"PO-Revision-Date: 2024-10-27 10:11+0000\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: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__allow_ticket
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_form
msgid "Allow Tickets"
msgstr "Permite Solicitudes"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_helpdesk_ticket__equipment_ids
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_form
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_search
msgid "Equipments"
msgstr "Equipos"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_helpdesk_ticket__has_equipments
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_search
msgid "Has Equipments"
msgstr "Tiene equipos"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model,name:helpdesk_mgmt_maintenance.model_helpdesk_ticket
msgid "Helpdesk Ticket"
msgstr "Solicitud del Servicio de Asistencia"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model,name:helpdesk_mgmt_maintenance.model_maintenance_equipment
msgid "Maintenance Equipment"
msgstr "Equipos de mantenimiento"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__ticket_count
msgid "Number Tickets"
msgstr "Número de solicitudes"

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__ticket_ids
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_form
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_kanban
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_tree
msgid "Tickets"
msgstr "Solicitudes"
58 changes: 58 additions & 0 deletions helpdesk_mgmt_maintenance/i18n/helpdesk_mgmt_maintenance.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_mgmt_maintenance
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-27 10:11+0000\n"
"PO-Revision-Date: 2024-10-27 10:11+0000\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: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__allow_ticket
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_form
msgid "Allow Tickets"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_helpdesk_ticket__equipment_ids
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_form
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_search
msgid "Equipments"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_helpdesk_ticket__has_equipments
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_helpdesk_ticket_search
msgid "Has Equipments"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model,name:helpdesk_mgmt_maintenance.model_helpdesk_ticket
msgid "Helpdesk Ticket"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model,name:helpdesk_mgmt_maintenance.model_maintenance_equipment
msgid "Maintenance Equipment"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__ticket_count
msgid "Number Tickets"
msgstr ""

#. module: helpdesk_mgmt_maintenance
#: model:ir.model.fields,field_description:helpdesk_mgmt_maintenance.field_maintenance_equipment__ticket_ids
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_form
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_kanban
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_maintenance.view_maintenance_equipment_tree
msgid "Tickets"
msgstr ""
1 change: 1 addition & 0 deletions helpdesk_mgmt_maintenance/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import maintenance_equipment, helpdesk_ticket
24 changes: 24 additions & 0 deletions helpdesk_mgmt_maintenance/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, fields, models


class HelpdeskTicket(models.Model):
_inherit = "helpdesk.ticket"

equipment_ids = fields.Many2many(
"maintenance.equipment",
string="Equipments",
relation="helpdesk_ticket_maintenance_equipment_rel",
column1="helpdesk_ticket_id",
column2="maintenance_equipment_id",
copy=False,
)

has_equipments = fields.Boolean(store=True, compute="_compute_has_equipments")

@api.depends("equipment_ids")
def _compute_has_equipments(self):
for ticket in self:
ticket.has_equipments = bool(ticket.equipment_ids)
48 changes: 48 additions & 0 deletions helpdesk_mgmt_maintenance/models/maintenance_equipment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# © 2024 Solvos Consultoría Informática (<http://www.solvos.es>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class MaintenanceEquipment(models.Model):
_inherit = "maintenance.equipment"

ticket_ids = fields.Many2many(
"helpdesk.ticket",
string="Tickets",
relation="helpdesk_ticket_maintenance_equipment_rel",
column1="maintenance_equipment_id",
column2="helpdesk_ticket_id",
copy=False,
)

allow_ticket = fields.Boolean(string="Allow Tickets", default=False)

# NUMBERS TICKETS COMPUTE NO STORE

ticket_count = fields.Integer(
string="Number Tickets", compute="_compute_ticket_count"
)

def _compute_ticket_count(self):
number_tickets = self.env["helpdesk.ticket"].read_group(
[("equipment_ids", "in", self.ids)], ["equipment_ids"], ["equipment_ids"]
)
result = {
data["equipment_ids"][0]: data["equipment_ids_count"]
for data in number_tickets
}
for equipment in self:
equipment.ticket_count = result.get(equipment.id, 0)

def action_view_tickets_equipment(self):
return {
"name": ("Tickets"),
"res_model": "helpdesk.ticket",
"view_mode": "tree,kanban,form",
"type": "ir.actions.act_window",
"domain": [("id", "in", self.ticket_ids.ids)],
"context": {
"default_equipment_ids": [(4, self.id)],
},
}
2 changes: 2 additions & 0 deletions helpdesk_mgmt_maintenance/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Ángel Rivas <[email protected]>
* David Alonso <[email protected]>
1 change: 1 addition & 0 deletions helpdesk_mgmt_maintenance/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module links helpdesk tickets with maintenance equipments.
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 743aefd

Please sign in to comment.