Skip to content

Commit

Permalink
[IMP]connector_jira_servicedesk: Add servicedesk_issue_url
Browse files Browse the repository at this point in the history
Update connector_jira_servicedesk/models/account_analytic_line/common.py

Co-authored-by: Stéphane Mangin <StephaneMangin@users.noreply.github.com>

Update connector_jira_servicedesk/tests/test_import_organization.py

Co-authored-by: Stéphane Mangin <StephaneMangin@users.noreply.github.com>

Update connector_jira_servicedesk/tests/common.py

Co-authored-by: Stéphane Mangin <StephaneMangin@users.noreply.github.com>

Update connector_jira_servicedesk/i18n/connector_jira_servicedesk.pot

Co-authored-by: Stéphane Mangin <StephaneMangin@users.noreply.github.com>

Update connector_jira_servicedesk/models/account_analytic_line/importer.py

Co-authored-by: Stéphane Mangin <StephaneMangin@users.noreply.github.com>
  • Loading branch information
2 people authored and leemannd committed Feb 10, 2021
1 parent 5641379 commit 3bd443a
Show file tree
Hide file tree
Showing 16 changed files with 684 additions and 12 deletions.
84 changes: 81 additions & 3 deletions connector_jira_servicedesk/README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
=======================================
JIRA Connector - Service Desk Extension
=======================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fconnector--jira-lightgray.png?logo=github
:target: https://github.com/OCA/connector-jira/tree/13.0/connector_jira_servicedesk
:alt: OCA/connector-jira
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/connector-jira-13-0/connector-jira-13-0-connector_jira_servicedesk
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/233/13.0
:alt: Try me on Runbot

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

This module add support with jira servicedesk

**Table of contents**

.. contents::
:local:

Usage
=====

Setup
-----
~~~~~

A new button is added on the JIRA backend, to import the organizations
of JIRA. Before, be sure to use the button "Configure Organization Link"
in the "Advanced Configuration" tab.


Features
^^^^^^^^
~~~~~~~~

Organizations
-------------
~~~~~~~~~~~~~

On Service Desk, you can share projects with Organizations.
You may want to use different Odoo projects according to the
Expand Down Expand Up @@ -45,3 +79,47 @@ ones, while you only have one project on JIRA.
* Tasks with org "Rhea" will be attached to this project
* Tasks with orgs "Themis" and "Rhea" will be attached to another project "Themis and Rhea"
* The rest of the tasks will be attached to a fourth project (configured without organizations)

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-jira/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/connector-jira/issues/new?body=module:%20connector_jira_servicedesk%0Aversion:%2013.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
~~~~~~~

* Camptocamp

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

* Patrick Tombez <patrick.tombez@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Jaime Arroyo
* Akim Juillerat <akim.juillerat@camptocamp.com>
* Denis Leemann <denis.leemann@camptocamp.com>

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/connector-jira <https://github.com/OCA/connector-jira/tree/13.0/connector_jira_servicedesk>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -158,4 +158,3 @@ msgstr ""
#: model:ir.model,name:connector_jira_servicedesk.model_jira_project_base_mixin
msgid "jira.project.base.mixin"
msgstr ""

Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import common
from . import importer
44 changes: 44 additions & 0 deletions connector_jira_servicedesk/models/account_analytic_line/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2020-2021 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, fields, models


class JiraAccountAnalyticLine(models.Model):
_inherit = "jira.account.analytic.line"

jira_servicedesk_issue_url = fields.Char(
string="Original JIRA service desk issue Link",
compute="_compute_jira_servicedesk_issue_url",
)

@api.depends("jira_issue_key")
def _compute_jira_servicedesk_issue_url(self):
"""Compute the external URL to JIRA service desk."""
for record in self:
jira_project = fields.first(self.project_id.jira_bind_ids)
if jira_project and record.jira_issue_key:
record.jira_servicedesk_issue_url = jira_project.make_servicedesk_issue_url( # noqa:
record.jira_issue_key
)


class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"

jira_servicedesk_issue_url = fields.Char(
string="Original JIRA service desk issue Link",
compute="_compute_jira_servicedesk_issue_url",
readonly=True,
)

@api.depends("jira_bind_ids.jira_servicedesk_issue_url",)
def _compute_jira_servicedesk_issue_url(self):
"""Compute the service desk references to JIRA.
We assume that we have only one external record for a line
"""
for record in self:
if not record.jira_bind_ids:
continue
main_binding = record.jira_bind_ids[0]
record.jira_servicedesk_issue_url = main_binding.jira_servicedesk_issue_url
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Camptocamp SA
# Copyright 2019-2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo.addons.component.core import Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, work_context):
self.client._session.headers.update(self._desk_headers)

def read(self, id_):
# pylint: disable=method-required-super
organization = Organization(self.client._options, self.client._session)
with self.handle_404():
organization.find(id_)
Expand Down
14 changes: 14 additions & 0 deletions connector_jira_servicedesk/models/project_project/common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import urllib.parse

from odoo import _, api, exceptions, fields, models

Expand All @@ -26,6 +27,11 @@ class JiraProjectBaseFields(models.AbstractModel):
class JiraProjectProject(models.Model):
_inherit = "jira.project.project"

servicedesk_customer_portal_number = fields.Integer(
string="Service desk customer portal ID",
help="This number is used to compute servicedesk URL on analytic lines",
)

@api.model
def _selection_project_type(self):
selection = super()._selection_project_type()
Expand Down Expand Up @@ -72,3 +78,11 @@ def _constrains_jira_uniq(self):
)
% (other.display_name)
)

def make_servicedesk_issue_url(self, jira_issue_id):
return urllib.parse.urljoin(
self.backend_id.uri,
"/service_desk/customer/portal/{}/{}".format(
self.servicedesk_customer_portal_number, jira_issue_id
),
)
5 changes: 5 additions & 0 deletions connector_jira_servicedesk/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Patrick Tombez <patrick.tombez@camptocamp.com>
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Jaime Arroyo
* Akim Juillerat <akim.juillerat@camptocamp.com>
* Denis Leemann <denis.leemann@camptocamp.com>
1 change: 1 addition & 0 deletions connector_jira_servicedesk/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module add support with jira servicedesk
44 changes: 44 additions & 0 deletions connector_jira_servicedesk/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Setup
~~~~~

A new button is added on the JIRA backend, to import the organizations
of JIRA. Before, be sure to use the button "Configure Organization Link"
in the "Advanced Configuration" tab.


Features
~~~~~~~~

Organizations
~~~~~~~~~~~~~

On Service Desk, you can share projects with Organizations.
You may want to use different Odoo projects according to the
organizations. This is what this extension allows.

Example:

* You have one Service Desk project named "Earth Project" with key EARTH
* On JIRA SD You share this project with organizations Themis and Rhea
* However on Odoo, you want to track the hours differently for Themis and Rhea

Steps on Odoo:

* Create a Themis project, use the "Link with JIRA" action with the key EARTH
* When you hit Next, the organization(s) you want to link must be set
* Repeat with another project for Rhea

If the project binding for the synchronization already exists, you can still edit it in the settings of the project and change the organizations.

When a task or worklog is imported, it will search for a project having
exactly the same set of organizations than the one of the task. If no
project with the same set is found and you have a project configured
without organization, the task will be linked to it.

This means that, on Odoo, you can have shared project altogether with dedicated
ones, while you only have one project on JIRA.

* Tasks with org "Themis" will be attached to this project
* Tasks with org "Rhea" will be attached to this project
* Tasks with orgs "Themis" and "Rhea" will be attached to another project "Themis and Rhea"
* The rest of the tasks will be attached to a fourth project (configured without organizations)
Loading

0 comments on commit 3bd443a

Please sign in to comment.