Skip to content

Commit 06ecbeb

Browse files
cramos84manuelregidor
authored andcommitted
[ADD] New module helpdesk.project
1 parent c812812 commit 06ecbeb

14 files changed

+349
-0
lines changed

helpdesk_mgmt_project/README.rst

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
===================
2+
Helpdesk Project
3+
===================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Alpha
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github
17+
:target: https://github.com/OCA/helpdesk/tree/12.0/helpdesk_project
18+
:alt: OCA/helpdesk
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/helpdesk-12-0/helpdesk-12-0-helpdesk_project
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/282/12.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module adds Project in Helpdesk.
29+
30+
.. IMPORTANT::
31+
This is an alpha version, the data model and design can change at any time without warning.
32+
Only for development or testing purpose, do not use in production.
33+
`More details on development status <https://odoo-community.org/page/development-status>`_
34+
35+
**Table of contents**
36+
37+
.. contents::
38+
:local:
39+
40+
Configuration
41+
=============
42+
43+
44+
Bug Tracker
45+
===========
46+
47+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/helpdesk/issues>`_.
48+
In case of trouble, please check there if your issue has already been reported.
49+
If you spotted it first, help us smashing it by providing a detailed and welcomed
50+
`feedback <https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_project%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
51+
52+
Do not contact contributors directly about support or help with technical issues.
53+
54+
Credits
55+
=======
56+
57+
Authors
58+
~~~~~~~
59+
60+
* PuntSistemes S.L.U.
61+
62+
Contributors
63+
~~~~~~~~~~~~
64+
65+
* `PuntSistemes S.L.U. <https://www.puntsistemes.es>`_:
66+
67+
* Carlos Ramos
68+
69+
Maintainers
70+
~~~~~~~~~~~
71+
72+
This module is maintained by the OCA.
73+
74+
.. image:: https://odoo-community.org/logo.png
75+
:alt: Odoo Community Association
76+
:target: https://odoo-community.org
77+
78+
OCA, or the Odoo Community Association, is a nonprofit organization whose
79+
mission is to support the collaborative development of Odoo features and
80+
promote its widespread use.
81+
82+
This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/12.0/helpdesk_project>`_ project on GitHub.
83+
84+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

helpdesk_mgmt_project/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

helpdesk_mgmt_project/__manifest__.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
2+
3+
{
4+
'name': 'Helpdesk Project',
5+
'summary': """
6+
Helpdesk""",
7+
'version': '12.0.1.0.0',
8+
'license': 'AGPL-3',
9+
'category': 'After-Sales',
10+
'author': 'PuntSistemes S.L.U., '
11+
'Odoo Community Association (OCA)',
12+
'website': 'https://github.com/OCA/helpdesk',
13+
'depends': [
14+
'helpdesk_mgmt',
15+
'project',
16+
],
17+
'data': [
18+
'views/helpdesk_ticket_view.xml',
19+
'views/project_view.xml',
20+
'views/project_task_view.xml',
21+
],
22+
'demo': [
23+
],
24+
'development_status': 'Alpha',
25+
'application': False,
26+
'installable': True,
27+
'auto_install': True,
28+
}

helpdesk_mgmt_project/i18n/es.po

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * helpdesk_mgmt_project
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 12.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2020-05-19 08:40+0000\n"
10+
"PO-Revision-Date: 2020-05-19 10:41+0200\n"
11+
"Last-Translator: <>\n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: 8bit\n"
16+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
17+
"Language: es\n"
18+
"X-Generator: Poedit 2.3.1\n"
19+
20+
#. module: helpdesk_mgmt_project
21+
#: model:ir.model.fields,help:helpdesk_mgmt_project.field_project_project__label_tickets
22+
msgid "Gives label to tickets on project's kanban view."
23+
msgstr "Da etiqueta a las entradas en la vista kanban del proyecto."
24+
25+
#. module: helpdesk_mgmt_project
26+
#: model:ir.model,name:helpdesk_mgmt_project.model_helpdesk_ticket
27+
msgid "Helpdesk Ticket"
28+
msgstr "Ticket Helpdesk"
29+
30+
#. module: helpdesk_mgmt_project
31+
#: model:ir.model,name:helpdesk_mgmt_project.model_project_project
32+
#: model:ir.model.fields,field_description:helpdesk_mgmt_project.field_helpdesk_ticket__project_id
33+
msgid "Project"
34+
msgstr "Proyecto"
35+
36+
#. module: helpdesk_mgmt_project
37+
#: model:ir.model,name:helpdesk_mgmt_project.model_project_task
38+
#: model:ir.model.fields,field_description:helpdesk_mgmt_project.field_helpdesk_ticket__task_id
39+
msgid "Task"
40+
msgstr "Tarea"
41+
42+
#. module: helpdesk_mgmt_project
43+
#: model:ir.model.fields,field_description:helpdesk_mgmt_project.field_project_project__ticket_count
44+
#: model:ir.model.fields,field_description:helpdesk_mgmt_project.field_project_task__ticket_count
45+
msgid "Ticket Count"
46+
msgstr "Contador Tickets"
47+
48+
#. module: helpdesk_mgmt_project
49+
#: code:addons/helpdesk_mgmt_project/models/project.py:12
50+
#: model:ir.actions.act_window,name:helpdesk_mgmt_project.ticket_action_from_project
51+
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_project.edit_project
52+
#: model_terms:ir.ui.view,arch_db:helpdesk_mgmt_project.view_task_form2
53+
#, python-format
54+
msgid "Tickets"
55+
msgstr "Tickets"
56+
57+
#. module: helpdesk_mgmt_project
58+
#: model:ir.model.fields,field_description:helpdesk_mgmt_project.field_project_project__label_tickets
59+
msgid "Use Tickets as"
60+
msgstr "Usar tickets como"
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import helpdesk_ticket
2+
from . import project
3+
from . import project_task
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from odoo import fields, models, api
2+
3+
4+
class HelpdeskTicket(models.Model):
5+
6+
_inherit = "helpdesk.ticket"
7+
8+
project_id = fields.Many2one(
9+
string='Project',
10+
comodel_name='project.project'
11+
)
12+
task_id = fields.Many2one(
13+
string='Task',
14+
comodel_name='project.task'
15+
)
16+
17+
@api.onchange('project_id')
18+
def _onchange_project(self):
19+
self.task_id = False
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from odoo import fields, models, _
2+
3+
4+
class ProjectProject(models.Model):
5+
_inherit = 'project.project'
6+
7+
ticket_count = fields.Integer(
8+
compute='_compute_ticket_count',
9+
string="Ticket Count")
10+
label_tickets = fields.Char(
11+
string='Use Tickets as',
12+
default=lambda s: _('Tickets'),
13+
translate=True,
14+
help="Gives label to tickets on project's kanban view.")
15+
16+
def _compute_ticket_count(self):
17+
ticket_data = self.env['helpdesk.ticket'].read_group(
18+
[('project_id', 'in', self.ids)], ['project_id'], ['project_id']
19+
)
20+
result = dict((data['project_id'][0], data['project_id_count'])
21+
for data in ticket_data)
22+
for project in self:
23+
project.ticket_count = result.get(project.id, 0)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from odoo import fields, models
2+
3+
4+
class ProjectTask(models.Model):
5+
_inherit = 'project.task'
6+
7+
ticket_count = fields.Integer(
8+
compute='_compute_ticket_count',
9+
string="Ticket Count")
10+
11+
def _compute_ticket_count(self):
12+
ticket_data = self.env['helpdesk.ticket'].read_group(
13+
[('task_id', 'in', self.ids)], ['task_id'], ['task_id']
14+
)
15+
result = dict((data['task_id'][0], data['task_id_count'])
16+
for data in ticket_data)
17+
for task in self:
18+
task.ticket_count = result.get(task.id, 0)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
* `Puntsistemes <https://www.puntsistemes.es>`_:
2+
3+
* Carlos Ramos Hernández
4+
5+
* `Tecnativa <https://www.tecnativa.com>`_:
6+
7+
* Pedro M. Baeza
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module adds Project in Helpdesk.
2+
We add to the project form view a ticket counter that redirects you to the helpdesk
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<record id="ticket_action_from_project" model="ir.actions.act_window">
4+
<field name="name">Tickets</field>
5+
<field name="res_model">helpdesk.ticket</field>
6+
<field name="view_mode">kanban,tree,form</field>
7+
<field name="search_view_id" ref="helpdesk_mgmt.helpdesk_ticket_view_search"/>
8+
</record>
9+
10+
<!-- TREE TICKET HELP DESK -->
11+
<record id="ticket_view_tree" model="ir.ui.view">
12+
<field name="model">helpdesk.ticket</field>
13+
<field name="inherit_id" ref="helpdesk_mgmt.ticket_view_tree"/>
14+
<field name="arch" type="xml">
15+
<field name="user_id" position="after">
16+
<field name="project_id"/>
17+
</field>
18+
</field>
19+
</record>
20+
21+
<!-- SEARCH TICKET HELP DESK -->
22+
<record id="helpdesk_ticket_view_search" model="ir.ui.view">
23+
<field name="model">helpdesk.ticket</field>
24+
<field name="inherit_id" ref="helpdesk_mgmt.helpdesk_ticket_view_search"/>
25+
<field name="arch" type="xml">
26+
<field name="user_id" position="after">
27+
<field name="project_id"/>
28+
<field name="task_id"/>
29+
</field>
30+
</field>
31+
</record>
32+
33+
<!-- View Form Ticket -->
34+
<record id="ticket_view_form" model="ir.ui.view">
35+
<field name="model">helpdesk.ticket</field>
36+
<field name="inherit_id" ref="helpdesk_mgmt.ticket_view_form"/>
37+
<field name="arch" type="xml">
38+
<xpath expr="//field[@name='partner_email']" position="after">
39+
<field name="project_id"/>
40+
<field name="task_id" domain="[('project_id', '=', project_id)]"
41+
attrs="{'invisible':[('project_id', '=', False)]}"/>
42+
</xpath>
43+
</field>
44+
</record>
45+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<!-- View Form Task -->
4+
<record id="view_task_form2" model="ir.ui.view">
5+
<field name="model">project.task</field>
6+
<field name="inherit_id" ref="project.view_task_form2"/>
7+
<field name="arch" type="xml">
8+
<xpath expr="//button[@name='toggle_active']" position="before">
9+
<button class="oe_stat_button" type="action"
10+
icon="fa-file" name="%(ticket_action_from_project)d"
11+
context="{'search_default_task_id': id, 'default_task_id': id}">
12+
<field string="Tickets" name="ticket_count" widget="statinfo"/>
13+
</button>
14+
</xpath>
15+
</field>
16+
</record>
17+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<odoo>
3+
<!-- View Form Project -->
4+
<record id="edit_project" model="ir.ui.view">
5+
<field name="model">project.project</field>
6+
<field name="inherit_id" ref="project.edit_project"/>
7+
<field name="arch" type="xml">
8+
<xpath expr="//button[@name='toggle_active']" position="before">
9+
<button class="oe_stat_button" type="action"
10+
icon="fa-file" name="%(ticket_action_from_project)d"
11+
context="{'search_default_project_id': active_id, 'default_project_id': active_id}">
12+
<field string="Tickets" name="ticket_count" widget="statinfo"/>
13+
</button>
14+
</xpath>
15+
</field>
16+
</record>
17+
<!-- View Kanban Project -->
18+
<record id="view_project_kanban" model="ir.ui.view">
19+
<field name="model">project.project</field>
20+
<field name="inherit_id" ref="project.view_project_kanban"/>
21+
<field name="arch" type="xml">
22+
<xpath expr="//field[@name='task_count']" position="after">
23+
<field name="ticket_count"/>
24+
<field name="label_tickets"/>
25+
</xpath>
26+
<xpath expr="//a[hasclass('o_project_kanban_box')]" position="after">
27+
<a class="o_project_kanban_box"
28+
name="%(ticket_action_from_project)d"
29+
type="action"
30+
context="{'search_default_project_id': active_id, 'default_project_id': active_id}">
31+
<span class="o_value">
32+
<t t-esc="record.ticket_count.value"/>
33+
</span>
34+
<span class="o_label">
35+
<t t-esc="record.label_tickets.value"/>
36+
</span>
37+
</a>
38+
</xpath>
39+
</field>
40+
</record>
41+
</odoo>
42+

0 commit comments

Comments
 (0)