Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] helpdesk_ticket_type_team #572

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 32 additions & 0 deletions helpdesk_ticket_type_team/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

========
Overview
========

This module restricts the visibility of helpdesk ticket types based on the teams assigned to them.

Every ticket type can only have a single team assigned to it.

Configuration
=============

* Go to Helpdesk/Configuration/Types to assign a team to the ticket types
* Alternatively, you can go Helpdesk/Configuration/Teams, and inside the form view you can assign the ticket types to the team

Usage
=====

* Assign ticket types to teams
* When creating a new ticket, only the assigned ticket types will be visible when selecting the team

Credits
=======

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

Samuel Macias <smacias@opensourceintegrators.com>
Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
3 changes: 3 additions & 0 deletions helpdesk_ticket_type_team/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
22 changes: 22 additions & 0 deletions helpdesk_ticket_type_team/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2017 Open Source Integrators (https://www.opensourceintegrators.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Helpdesk ticket type team",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"summary": "Limits the selection of helpdesk ticket types based on the team",
"author": "Open Source Integrators",
"maintainer": "Open Source Integrators",
"website": "https://github.com/ursais/osi-addons",
"depends": [
# Odoo + Enterprise
"helpdesk",
# OCA
# osi-addons
],
"data": [
"views/helpdesk_view.xml",
],
"application": False,
"maintainers": ["ursais"],
}
47 changes: 47 additions & 0 deletions helpdesk_ticket_type_team/i18n/es_MX.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_type_team
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e-20230816\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-23 18:26+0000\n"
"PO-Revision-Date: 2024-04-23 18:26+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_ticket_type_team
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_helpdesk_team__ticket_type_ids
msgid "Assigned ticket types"
msgstr "Tipos de ticket asignados"

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_helpdesk_team
msgid "Helpdesk Team"
msgstr "Equipo de Servicio de asistencia"

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_helpdesk_ticket
msgid "Helpdesk Ticket"
msgstr "Ticket de Servicio de asistencia"

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_helpdesk_ticket_type
msgid "Helpdesk Ticket Type"
msgstr "Tipo de ticket de Servicio de asistencia"

#. module: helpdesk_ticket_type_team
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_helpdesk_ticket_type__team_id
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_res_users__team_ids
msgid "Team"
msgstr "Equipo"

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_res_users
msgid "User"
msgstr "Usuario"
47 changes: 47 additions & 0 deletions helpdesk_ticket_type_team/i18n/helpdesk_ticket_type_team.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * helpdesk_ticket_type_team
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e-20230816\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-23 18:26+0000\n"
"PO-Revision-Date: 2024-04-23 18:26+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_ticket_type_team
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_helpdesk_team__ticket_type_ids
msgid "Assigned ticket types"
msgstr ""

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_helpdesk_team
msgid "Helpdesk Team"
msgstr ""

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

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_helpdesk_ticket_type
msgid "Helpdesk Ticket Type"
msgstr ""

#. module: helpdesk_ticket_type_team
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_helpdesk_ticket_type__team_id
#: model:ir.model.fields,field_description:helpdesk_ticket_type_team.field_res_users__team_ids
msgid "Team"
msgstr ""

#. module: helpdesk_ticket_type_team
#: model:ir.model,name:helpdesk_ticket_type_team.model_res_users
msgid "User"
msgstr ""
4 changes: 4 additions & 0 deletions helpdesk_ticket_type_team/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import helpdesk_ticket
from . import helpdesk_ticket_type
from . import helpdesk_team
from . import res_users
11 changes: 11 additions & 0 deletions helpdesk_ticket_type_team/models/helpdesk_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (C) 2023 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models


class HelpdeskTeam(models.Model):
_inherit = "helpdesk.team"

ticket_type_ids = fields.One2many(
"helpdesk.ticket.type", "team_id", string="Assigned ticket types"
)
21 changes: 21 additions & 0 deletions helpdesk_ticket_type_team/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2023 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models


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

@api.onchange("team_id")
def _onchange_team_id(self):
self.ticket_type_id = False
self.user_id = False
if not self.team_id or not self.team_id.ticket_type_ids:
return {"domain": {"ticket_type_id": [("team_id", "=", False)]}}
else:
return {
"domain": {
"ticket_type_id": [("team_id", "=", self.team_id.id)],
"user_id": [("team_ids", "=", self.team_id.id)],
}
}
9 changes: 9 additions & 0 deletions helpdesk_ticket_type_team/models/helpdesk_ticket_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (C) 2023 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models


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

team_id = fields.Many2one("helpdesk.team", string="Team")
7 changes: 7 additions & 0 deletions helpdesk_ticket_type_team/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class ResUsers(models.Model):
_inherit = "res.users"

team_ids = fields.Many2many("helpdesk.team")
25 changes: 25 additions & 0 deletions helpdesk_ticket_type_team/views/helpdesk_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<odoo>

<record id="view_helpdesk_ticket_type_tree_inherit_mppd" model="ir.ui.view">
<field name="name">helpdesk.ticket.type.tree.inherit.mppd</field>
<field name="model">helpdesk.ticket.type</field>
<field name="inherit_id" ref="helpdesk.helpdesk_ticket_type_view_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="team_id" />
</xpath>
</field>
</record>

<record id="view_helpdesk_team_form_inherit_mppd" model="ir.ui.view">
<field name="name">helpdesk.team.form.inherit.mppd</field>
<field name="model">helpdesk.team</field>
<field name="inherit_id" ref="helpdesk.helpdesk_team_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='description']" position="after">
<field name="ticket_type_ids" />
</xpath>
</field>
</record>

</odoo>
6 changes: 6 additions & 0 deletions setup/helpdesk_ticket_type_team/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading