Skip to content

Commit

Permalink
[ADD] helpdesk_mgmt_timesheet: work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
dalonsod committed Jul 30, 2020
1 parent c375341 commit 5121b0b
Show file tree
Hide file tree
Showing 13 changed files with 670 additions and 32 deletions.
114 changes: 114 additions & 0 deletions helpdesk_mgmt_timesheet/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
=========================
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/12.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-12-0/helpdesk-12-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/12.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:%2012.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

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/12.0/helpdesk_mgmt_timesheet>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 6 additions & 2 deletions helpdesk_mgmt_timesheet/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 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).

{
Expand All @@ -20,9 +21,12 @@
'hr_timesheet',
],
'data': [
'security/helpdesk_mgmt_timesheet_security.xml',
'views/helpdesk_team_view.xml',
'views/helpdesk_ticket_view.xml',
'views/hr_timesheet_view.xml',
]
'report/report_timesheet_templates.xml',
],
'demo': [
'demo/helpdesk_mgmt_timesheet_demo.xml',
],
}
44 changes: 44 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,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<data 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>
</data>

</odoo>
4 changes: 2 additions & 2 deletions helpdesk_mgmt_timesheet/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class HelpdeskTicket(models.Model):
string='Timesheet',
)
total_hours = fields.Float(
compute='impute_hours',
compute='_compute_total_hours',
readonly=True,
store=True,
string='Total Hours'
)

@api.depends('timesheet_ids.unit_amount')
def impute_hours(self):
def _compute_total_hours(self):
for record in self:
record.total_hours = sum(
record.timesheet_ids.mapped('unit_amount')
Expand Down
6 changes: 0 additions & 6 deletions helpdesk_mgmt_timesheet/models/helpdesk_ticket_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ class HelpdeskTicketTeam(models.Model):
comodel_name='project.project',
string='Default Project',
)
reset_default_project = fields.Boolean(
string='Reset Project',
)

@api.constrains('allow_timesheet')
def _constrains_allow_timesheet(self):
if not self.allow_timesheet:
self.default_project = False

def action_clear(self):
self.default_project_id = False
1 change: 1 addition & 0 deletions helpdesk_mgmt_timesheet/models/hr_timesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AccountAnalyticLine(models.Model):
ticket_id = fields.Many2one(
comodel_name='helpdesk.ticket',
string='Ticket',
domain=[("project_id", "!=", False)],
groups="helpdesk_mgmt.group_helpdesk_user",
)
ticket_partner_id = fields.Many2one(
Expand Down
21 changes: 21 additions & 0 deletions helpdesk_mgmt_timesheet/report/report_timesheet_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_timesheet" inherit_id="hr_timesheet.report_timesheet">
<xpath expr="//t[@t-set='show_project']" position="after">
<t t-set="show_ticket" t-value="bool(docs.mapped('ticket_id'))"/>
</xpath>
<xpath expr="//table[hasclass('table-sm')]/thead/tr/th[3]" position="after">
<th t-if="show_ticket">Ticket</th>
</xpath>
<xpath expr="//table[hasclass('table-sm')]/tbody/tr[1]/td[3]" position="after">
<td t-if="show_ticket">
<span t-field="l.ticket_id.number"/> - <span t-field="l.ticket_id.name"/>
</td>
</xpath>
<xpath expr="//table[hasclass('table-sm')]/tbody/tr[2]/td[3]" position="after">
<td t-if="show_ticket">
<td t-if="show_ticket"/>
</td>
</xpath>
</template>
</odoo>

This file was deleted.

Loading

0 comments on commit 5121b0b

Please sign in to comment.