Skip to content

Commit

Permalink
Merge PR #425 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 25, 2023
2 parents 4cd31a7 + 644a3f2 commit bc79d82
Show file tree
Hide file tree
Showing 35 changed files with 2,637 additions and 24 deletions.
2 changes: 1 addition & 1 deletion helpdesk_mgmt/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _prepare_submit_ticket_vals(self, **kw):
.with_company(company.id)
.default_get(["stage_id"])["stage_id"],
}
if company.helpdesk_mgmt_portal_select_team:
if company.helpdesk_mgmt_portal_select_team and kw.get("team"):
team = (
http.request.env["helpdesk.ticket.team"]
.sudo()
Expand Down
48 changes: 25 additions & 23 deletions helpdesk_mgmt/tests/test_helpdesk_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from odoo.addons.base.tests.common import HttpCaseWithUserPortal


class TestHelpdeskPortal(HttpCaseWithUserPortal):
class TestHelpdeskPortalBase(HttpCaseWithUserPortal):
"""Test controllers defined for portal mode.
This is mostly for basic coverage; we don't go as far as fully validating
HTML produced by our routes.
Expand Down Expand Up @@ -39,18 +39,32 @@ def setUp(self):
def get_new_tickets(self, user):
return self.env["helpdesk.ticket"].with_user(user).search([])

def _submit_ticket(self):
resp = self.url_open(
"/submitted/ticket",
data={
"category": self.env.ref("helpdesk_mgmt.helpdesk_category_1").id,
"csrf_token": http.WebRequest.csrf_token(self),
"subject": self.new_ticket_title,
"description": "\n".join(self.new_ticket_desc_lines),
},
)
def _create_ticket(self, partner, ticket_title, **values):
"""Create a ticket submitted by the specified partner."""
data = {
"name": ticket_title,
"description": "test-description",
"partner_id": partner.id,
"partner_email": partner.email,
"partner_name": partner.name,
}
data.update(**values)
return self.env["helpdesk.ticket"].create(data)

def _submit_ticket(self, **values):
data = {
"category": self.env.ref("helpdesk_mgmt.helpdesk_category_1").id,
"csrf_token": http.WebRequest.csrf_token(self),
"subject": self.new_ticket_title,
"description": "\n".join(self.new_ticket_desc_lines),
}
data.update(**values)
resp = self.url_open("/submitted/ticket", data=data)

self.assertEqual(resp.status_code, 200)


class TestHelpdeskPortal(TestHelpdeskPortalBase):
def test_submit_ticket_01(self):
self.authenticate("test-basic-user", "test-basic-user")
self._submit_ticket()
Expand Down Expand Up @@ -192,15 +206,3 @@ def _call_close_ticket(self, ticket, stage):
self.assertTrue(resp.is_redirect) # http://127.0.0.1:8069/my/ticket/<ticket-id>
self.assertTrue(resp.headers["Location"].endswith(f"/my/ticket/{ticket.id}"))
return resp

def _create_ticket(self, partner, ticket_title):
"""Create a ticket submitted by the specified partner."""
return self.env["helpdesk.ticket"].create(
{
"name": ticket_title,
"description": "test-description",
"partner_id": partner.id,
"partner_email": partner.email,
"partner_name": partner.name,
}
)
118 changes: 118 additions & 0 deletions helpdesk_mgmt_timesheet/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
=========================
Helpdesk Ticket Timesheet
=========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fhelpdesk-lightgray.png?logo=github
:target: https://github.com/OCA/helpdesk/tree/14.0/helpdesk_mgmt_timesheet
:alt: OCA/helpdesk
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/helpdesk-14-0/helpdesk-14-0-helpdesk_mgmt_timesheet
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/282/14.0
:alt: Try me on Runbot

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

This module adds Timesheet funcionality in Helpdesk module.

**Table of contents**

.. contents::
:local:

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

To configure this module, you need to:

#. Allow Timesheet for a Helpdesk's Team
#. Set a Default Project (optional)

Allow Timesheet
~~~~~~~~~~~~~~~

#. Go to Helpdesk > Configuration > Teams.
#. Edit or create a new team.
#. Check Allow Timesheet option to allow timesheets for that team.
#. Select a Project for that team (optional).

Usage
=====

#. Go to *Helpdesk* or *Helpdesk > Dashboard* to see the tickets dashboard.
#. In the Kanban view, click in the kanban card of a team to see their tickets and create new ones.
#. If there is not a Default Project you will need select a Project for the Ticket to show the Timesheet Table.

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

* Aresoltec Canarias
* Punt Sistemes
* SDi Soluciones Digitales
* Solvos

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

* `Aresoltec Canarias, S.L <https://www.aresoltec.com>`_:

* Inma Sánchez

* `SDi Soluciones, S.L. <https://www.sdi.es>`_:

* Oscar Soto
* Jorge Luis Quinteros

* `Punt Sistemes, S.L. <https://www.puntsistemes.es/>`_:

* Carlos Ramos

* `Solvos Consultoría Informática, S.L. <https://www.solvos.es/>`_:

* David Alonso

* `Guadaltech Soluciones Tecnológicas, S.L. <https://www.guadaltech.es/>`_:

* Fernando La Chica <[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/14.0/helpdesk_mgmt_timesheet>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions helpdesk_mgmt_timesheet/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
###############################################################################
# For copyright and license notices, see __manifest__.py file in root directory
###############################################################################
from . import models
32 changes: 32 additions & 0 deletions helpdesk_mgmt_timesheet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (C) 2020 Aresoltec Canarias <www.aresoltec.com>
# Copyright (C) 2020 Punt Sistemes <www.puntsistemes.es.es>
# Copyright (C) 2020 SDi Soluciones Digitales <www.sdi.es>
# Copyright (C) 2020 Solvos Consultoría Informática <www.solvos.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Helpdesk Ticket Timesheet",
"summary": "Add HR Timesheet to the tickets for Helpdesk Management.",
"author": "Aresoltec Canarias, "
"Punt Sistemes, "
"SDi Soluciones Digitales, "
"Solvos, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/helpdesk",
"license": "AGPL-3",
"category": "After-Sales",
"version": "15.0.1.0.0",
"depends": [
"helpdesk_mgmt_project",
"hr_timesheet",
"project_timesheet_time_control",
],
"data": [
"views/helpdesk_team_view.xml",
"views/helpdesk_ticket_view.xml",
"views/hr_timesheet_view.xml",
"views/helpdesk_project_task_view.xml",
"report/report_timesheet_templates.xml",
],
"demo": ["demo/helpdesk_mgmt_timesheet_demo.xml"],
}
36 changes: 36 additions & 0 deletions helpdesk_mgmt_timesheet/demo/helpdesk_mgmt_timesheet_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="project_1" model="project.project">
<field name="name">Helpdesk general project</field>
</record>
<record id="project_task_1" model="project.task">
<field name="name">Helpdesk general task</field>
<field name="project_id" ref="project_1" />
</record>
<record id="helpdesk_mgmt.helpdesk_team_2" model="helpdesk.ticket.team">
<field name="allow_timesheet" eval="True" />
<field name="default_project_id" ref="project_1" />
</record>
<record id="helpdesk_mgmt.helpdesk_ticket_1" model="helpdesk.ticket">
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_2" />
<field name="project_id" ref="project_1" />
<field name="task_id" ref="project_task_1" />
<field name="planned_hours" eval="5" />
</record>
<record id="helpdesk_ticket_1_timesheet_1" model="account.analytic.line">
<field name="ticket_id" ref="helpdesk_mgmt.helpdesk_ticket_1" />
<field name="name">Initial analysis</field>
<field name="user_id" ref='base.user_admin' />
<field name="project_id" ref="project_1" />
<field name="task_id" ref="project_task_1" />
<field name="unit_amount" eval="2.5" />
</record>
<record id="helpdesk_ticket_1_timesheet_2" model="account.analytic.line">
<field name="ticket_id" ref="helpdesk_mgmt.helpdesk_ticket_1" />
<field name="name">Resolution</field>
<field name="user_id" ref='base.user_admin' />
<field name="project_id" ref="project_1" />
<field name="task_id" ref="project_task_1" />
<field name="unit_amount" eval="2" />
</record>
</odoo>
Loading

0 comments on commit bc79d82

Please sign in to comment.