Skip to content

Commit

Permalink
[MIG]helpdesk_motive: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Adasat authored and adasatorres committed May 15, 2024
1 parent 70df601 commit cdc6234
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 37 deletions.
28 changes: 18 additions & 10 deletions helpdesk_motive/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Helpdesk Motive
===============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d39e3a4544fc9651c357088907a9813140eab6c54457d917165081bbbacd7605
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -14,16 +17,16 @@ Helpdesk Motive
: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_motive
:target: https://github.com/OCA/helpdesk/tree/16.0/helpdesk_motive
: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_motive
:target: https://translation.odoo-community.org/projects/helpdesk-16-0/helpdesk-16-0-helpdesk_motive
: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
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&target_branch=16.0
:alt: Try me on Runboat

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

This module adds a motive field on the helpdesk ticket.
The list is filtered based on the helpdesk team.
Expand All @@ -50,8 +53,8 @@ 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_motive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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_motive%0Aversion:%2016.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.

Expand All @@ -61,6 +64,7 @@ Credits
Authors
~~~~~~~

* Binhex
* Konos
* Open Source Integrators

Expand All @@ -79,6 +83,10 @@ Contributors

* David Alonso <[email protected]>

* `Binhex <https://binhex.cloud>_`:

* Adasat Torres <[email protected]>

Maintainers
~~~~~~~~~~~

Expand All @@ -103,6 +111,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-nelsonramirezs| |maintainer-max3903|

This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/14.0/helpdesk_motive>`_ project on GitHub.
This module is part of the `OCA/helpdesk <https://github.com/OCA/helpdesk/tree/16.0/helpdesk_motive>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 3 additions & 2 deletions helpdesk_motive/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright (C) 2019 Open Source Integrators
# Copyright (C) 2019 Konos
# Copyright (C) 2023 Binhex -Adasat Torres
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Helpdesk Motive",
"version": "14.0.1.0.2",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"summary": "Keep the motive ",
"author": "Konos, Open Source Integrators, Odoo Community Association (OCA)",
"author": "Binhex, Konos, Open Source Integrators, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/helpdesk",
"depends": ["helpdesk_mgmt"],
"data": [
Expand Down
28 changes: 14 additions & 14 deletions helpdesk_motive/demo/helpdesk_motive_demo.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" ?>
<odoo>
<data noupdate="1">
<record id="helpdesk_motive_1" model="helpdesk.ticket.motive">
<field name="name">Client requirement</field>
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_1" />
</record>
<record id="helpdesk_motive_2" model="helpdesk.ticket.motive">
<field name="name">Update required</field>
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_1" />
</record>
<odoo noupdate="1">

<record id="helpdesk_motive_1" model="helpdesk.ticket.motive">
<field name="name">Client requirement</field>
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_1" />
</record>
<record id="helpdesk_motive_2" model="helpdesk.ticket.motive">
<field name="name">Update required</field>
<field name="team_id" ref="helpdesk_mgmt.helpdesk_team_1" />
</record>

<record id="helpdesk_mgmt.helpdesk_ticket_7" model="helpdesk.ticket">
<field name="motive_id" ref="helpdesk_motive_1" />
</record>

<record id="helpdesk_mgmt.helpdesk_ticket_7" model="helpdesk.ticket">
<field name="motive_id" ref="helpdesk_motive_1" />
</record>
</data>
</odoo>
12 changes: 9 additions & 3 deletions helpdesk_motive/models/helpdesk_ticket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (c) 2019 Open Source Integrators
# Copyright (C) 2019 Konos
# Copyright (C) 2023 Binhex -Adasat Torres
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models

Expand All @@ -8,10 +9,15 @@ class HelpdeskTicket(models.Model):
_inherit = "helpdesk.ticket"

motive_id = fields.Many2one(
"helpdesk.ticket.motive", string="Motive", help="Motive"
"helpdesk.ticket.motive",
string="Motive",
help="Motive",
store=True,
readonly=False,
compute="_compute_team_user_helpdesk_motive",
)

@api.onchange("team_id", "user_id")
def _onchange_team_user_helpdesk_motive(self):
@api.depends("team_id", "user_id")
def _compute_team_user_helpdesk_motive(self):
for record in self:
record.motive_id = False
2 changes: 1 addition & 1 deletion helpdesk_motive/models/helpdesk_ticket_motive.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class HelpdeskMotive(models.Model):
_description = "Helpdesk Motive"
_order = "name asc"

name = fields.Char("Name", required=True)
name = fields.Char(required=True)
team_id = fields.Many2one("helpdesk.ticket.team", string="Helpdesk Team")
4 changes: 3 additions & 1 deletion helpdesk_motive/models/helpdesk_ticket_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ class HelpdeskTicketTeam(models.Model):
_inherit = "helpdesk.ticket.team"

motive_ids = fields.One2many(
comodel_name="helpdesk.ticket.motive", inverse_name="team_id", string="Motives"
comodel_name="helpdesk.ticket.motive",
inverse_name="team_id",
string="Motives",
)
4 changes: 4 additions & 0 deletions helpdesk_motive/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
* `Solvos <https://www.solvos.es>`_:

* David Alonso <[email protected]>

* `Binhex <https://binhex.cloud>_`:

* Adasat Torres <[email protected]>
17 changes: 12 additions & 5 deletions helpdesk_motive/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Helpdesk Motive</title>
<style type="text/css">

Expand Down Expand Up @@ -366,8 +366,10 @@ <h1 class="title">Helpdesk Motive</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d39e3a4544fc9651c357088907a9813140eab6c54457d917165081bbbacd7605
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/helpdesk/tree/14.0/helpdesk_motive"><img alt="OCA/helpdesk" src="https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/helpdesk-14-0/helpdesk-14-0-helpdesk_motive"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/282/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/helpdesk/tree/16.0/helpdesk_motive"><img alt="OCA/helpdesk" src="https://img.shields.io/badge/github-OCA%2Fhelpdesk-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/helpdesk-16-0/helpdesk-16-0-helpdesk_motive"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/helpdesk&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds a motive field on the helpdesk ticket.
The list is filtered based on the helpdesk team.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -402,15 +404,16 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/helpdesk/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_motive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/helpdesk/issues/new?body=module:%20helpdesk_motive%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Binhex</li>
<li>Konos</li>
<li>Open Source Integrators</li>
</ul>
Expand All @@ -430,6 +433,10 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<li>David Alonso &lt;<a class="reference external" href="mailto:david.alonso&#64;solvos.es">david.alonso&#64;solvos.es</a>&gt;</li>
</ul>
</li>
<li><cite>Binhex &lt;https://binhex.cloud&gt;_</cite>:<ul>
<li>Adasat Torres &lt;<a class="reference external" href="mailto:a.torres&#64;binhex.cloud">a.torres&#64;binhex.cloud</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -441,7 +448,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external" href="https://github.com/nelsonramirezs"><img alt="nelsonramirezs" src="https://github.com/nelsonramirezs.png?size=40px" /></a> <a class="reference external" href="https://github.com/max3903"><img alt="max3903" src="https://github.com/max3903.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/helpdesk/tree/14.0/helpdesk_motive">OCA/helpdesk</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/helpdesk/tree/16.0/helpdesk_motive">OCA/helpdesk</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions helpdesk_motive/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_helpdesk_motive
66 changes: 66 additions & 0 deletions helpdesk_motive/tests/test_helpdesk_motive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (C) 2023 Binhex - Adasat Torres
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import new_test_user
from odoo.tests.common import TransactionCase


class TestHelpdeskMotive(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# Initialize the class object
helpdesk_ticket_team = cls.env["helpdesk.ticket.team"]
ctx = {
"mail_create_nolog": True,
"mail_create_nosubscribe": True,
"mail_notrack": True,
"no_reset_password": True,
}
cls.user_team = new_test_user(
cls.env,
login="helpdesk_mgmt-user_team",
groups="helpdesk_mgmt.group_helpdesk_user_team",
context=ctx,
)
cls.user = new_test_user(
cls.env,
login="helpdesk_mgmt-user",
groups="helpdesk_mgmt.group_helpdesk_user",
context=ctx,
)
cls.team_a = helpdesk_ticket_team.create(
{"name": "Team A", "user_ids": [(6, 0, [cls.user.id])]}
)
cls.team_b = helpdesk_ticket_team.create(
{"name": "Team B", "user_ids": [(6, 0, [cls.user_team.id])]}
)

cls.motive_id = cls.env["helpdesk.ticket.motive"].create(
{"name": "motive_test", "team_id": cls.team_a.id}
)

cls.ticket_a_user_team = cls._create_ticket(
cls, cls.team_a, cls.motive_id, cls.user_team
)

def _create_ticket(self, team, motive, user=False):
return self.env["helpdesk.ticket"].create(
{
"name": "Ticket %s (%s)"
% (team.name, user.login if user else "unassigned"),
"description": "Description",
"team_id": team.id,
"user_id": user.id if user else False,
"priority": "1",
"motive_id": motive.id,
}
)

def test_compute_team_user_helpdesk_motive(self):
self.assertTrue(self.ticket_a_user_team.motive_id)
self.ticket_a_user_team.write({"team_id": self.team_b.id})
self.assertFalse(self.ticket_a_user_team.motive_id)
self.ticket_a_user_team.write({"motive_id": self.motive_id.id})
self.assertTrue(self.ticket_a_user_team.motive_id)
self.ticket_a_user_team.write({"user_id": self.user.id})
self.assertFalse(self.ticket_a_user_team.motive_id)
2 changes: 1 addition & 1 deletion helpdesk_motive/views/helpdesk_ticket_motive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<field name="name">helpdesk.ticket.motive.tree</field>
<field name="model">helpdesk.ticket.motive</field>
<field name="arch" type="xml">
<tree string="Motives">
<tree>
<field name="name" />
<field name="team_id" />
</tree>
Expand Down

0 comments on commit cdc6234

Please sign in to comment.