Skip to content

Commit

Permalink
[15.0][MIG] connector_jira_servicedesk: Migrate to version 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sonhd91 committed Jun 29, 2022
1 parent e70ac25 commit 0b9df40
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 40 deletions.
24 changes: 15 additions & 9 deletions connector_jira_servicedesk/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ JIRA Connector - Service Desk Extension
: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
:target: https://github.com/OCA/connector-jira/tree/15.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
:target: https://translation.odoo-community.org/projects/connector-jira-15-0/connector-jira-15-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
:target: https://runbot.odoo-community.org/runbot/233/15.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -86,7 +86,7 @@ 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**>`_.
`feedback <https://github.com/OCA/connector-jira/issues/new?body=module:%20connector_jira_servicedesk%0Aversion:%2015.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 @@ -101,11 +101,17 @@ Authors
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>
* `Camptocamp <https://camptocamp.com>`_:

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

* `Trobz <https://trobz.com>`_:

* Son Ho <sonhd@trobz.com>

Maintainers
~~~~~~~~~~~
Expand All @@ -120,6 +126,6 @@ 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.
This module is part of the `OCA/connector-jira <https://github.com/OCA/connector-jira/tree/15.0/connector_jira_servicedesk>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion connector_jira_servicedesk/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "JIRA Connector - Service Desk Extension",
"version": "13.0.1.1.0",
"version": "15.0.1.0.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Connector",
Expand Down
4 changes: 3 additions & 1 deletion connector_jira_servicedesk/models/jira_backend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def _selection_project_template(self):
return selection

def import_organization(self):
self.env["jira.organization"].import_batch(self)
self.env["jira.organization"].with_delay(
channel="root.connector_jira.import"
).import_batch(self)
return True

def activate_organization(self):
Expand Down
12 changes: 4 additions & 8 deletions connector_jira_servicedesk/models/jira_organization/adapter.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Copyright 2019 Camptocamp SA
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import logging

from requests.structures import CaseInsensitiveDict

from odoo.addons.component.core import Component

_logger = logging.getLogger(__name__)

try:
from jira.resources import Resource
from jira.utils import CaseInsensitiveDict
except ImportError as err:
_logger.debug(err)
Resource = object
CaseInsensitiveDict = None


class Organization(Resource):
Expand All @@ -35,11 +35,7 @@ class OrganizationAdapter(Component):
# The Service Desk REST API returns an error if this header
# is not used. The API may change so they want an agreement for
# the client about this.
_desk_headers = (
CaseInsensitiveDict({"X-ExperimentalApi": "opt-in"})
if (CaseInsensitiveDict)
else None
)
_desk_headers = CaseInsensitiveDict({"X-ExperimentalApi": "opt-in"})

_desk_api_path_base = "{server}/rest/servicedeskapi/{path}"

Expand Down
7 changes: 2 additions & 5 deletions connector_jira_servicedesk/models/jira_organization/common.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# Copyright 2016-2019 Camptocamp SA
# Copyright 2016-2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)


from odoo import fields, models

from odoo.addons.queue_job.job import job


class JiraOrganization(models.Model):
_name = "jira.organization"
_inherit = "jira.binding"
_description = "Jira Organization"

name = fields.Char("Name", required=True, readonly=True)
name = fields.Char(required=True, readonly=True)
backend_id = fields.Many2one(ondelete="cascade")
project_ids = fields.Many2many(comodel_name="jira.project.project")

@job(default_channel="root.connector_jira.import")
def import_batch(self, backend, from_date=None, to_date=None):
"""Prepare a batch import of organization from Jira
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Camptocamp SA
# Copyright 2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

import logging
Expand All @@ -21,7 +21,8 @@ def state_exit_start(self):
if self.sync_action == "link":
self.state = "link_organizations"
else:
super().state_exit_start()
res = super().state_exit_start()
return res

def state_exit_link_organizations(self):
if not self.jira_project_id:
Expand Down
5 changes: 3 additions & 2 deletions connector_jira_servicedesk/models/project_task/importer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2019 Camptocamp SA
# Copyright 2016-2022 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo.addons.component.core import Component
Expand Down Expand Up @@ -48,9 +48,10 @@ def _get_external_data(self):

def _import_dependencies(self):
"""Import the dependencies for the record"""
super()._import_dependencies()
res = super()._import_dependencies()
jira_org_ids = self.component(usage="organization.from.task").get_jira_org_ids(
self.external_record
)
for jira_org_id in jira_org_ids:
self._import_dependency(jira_org_id, "jira.organization")
return res
14 changes: 10 additions & 4 deletions connector_jira_servicedesk/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
* 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>
* `Camptocamp <https://camptocamp.com>`_:

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

* `Trobz <https://trobz.com>`_:

* Son Ho <sonhd@trobz.com>
24 changes: 19 additions & 5 deletions connector_jira_servicedesk/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>JIRA Connector - Service Desk Extension</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">JIRA Connector - Service Desk Extension</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/connector-jira/tree/13.0/connector_jira_servicedesk"><img alt="OCA/connector-jira" src="https://img.shields.io/badge/github-OCA%2Fconnector--jira-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/connector-jira-13-0/connector-jira-13-0-connector_jira_servicedesk"><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/233/13.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/connector-jira/tree/15.0/connector_jira_servicedesk"><img alt="OCA/connector-jira" src="https://img.shields.io/badge/github-OCA%2Fconnector--jira-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/connector-jira-15-0/connector-jira-15-0-connector_jira_servicedesk"><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/233/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module add support with jira servicedesk</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -435,7 +435,7 @@ <h1><a class="toc-backref" href="#id5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/connector-jira/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/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**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/connector-jira/issues/new?body=module:%20connector_jira_servicedesk%0Aversion:%2015.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">
Expand All @@ -448,13 +448,27 @@ <h2><a class="toc-backref" href="#id7">Authors</a></h2>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id8">Contributors</a></h2>
<ul>
<li><p class="first">Jaime Arroyo</p>
</li>
<li><p class="first"><a class="reference external" href="https://camptocamp.com">Camptocamp</a>:</p>
<blockquote>
<ul class="simple">
<li>Patrick Tombez &lt;<a class="reference external" href="mailto:patrick.tombez&#64;camptocamp.com">patrick.tombez&#64;camptocamp.com</a>&gt;</li>
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
<li>Jaime Arroyo</li>
<li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
<li>Denis Leemann &lt;<a class="reference external" href="mailto:denis.leemann&#64;camptocamp.com">denis.leemann&#64;camptocamp.com</a>&gt;</li>
</ul>
</blockquote>
</li>
<li><p class="first"><a class="reference external" href="https://trobz.com">Trobz</a>:</p>
<blockquote>
<ul class="simple">
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
Expand All @@ -463,7 +477,7 @@ <h2><a class="toc-backref" href="#id9">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector-jira/tree/13.0/connector_jira_servicedesk">OCA/connector-jira</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/connector-jira/tree/15.0/connector_jira_servicedesk">OCA/connector-jira</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
4 changes: 2 additions & 2 deletions connector_jira_servicedesk/tests/test_import_organization.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright 2019-2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo.addons.connector_jira.tests.common import JiraSavepointCase
from odoo.addons.connector_jira.tests.common import JiraTransactionComponentCase

from .common import recorder


class TestImportOrganization(JiraSavepointCase):
class TestImportOrganization(JiraTransactionComponentCase):
@recorder.use_cassette
def test_import_organization_batch(self):
"""Batch import of organizations
Expand Down
2 changes: 1 addition & 1 deletion connector_jira_servicedesk/views/jira_backend_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<xpath expr="//page[@name='issue_type']" position="after">
<page name="organization" string="Organizations" states="running">
<field name="organization_ids">
<tree string="Jira Organization" create="0" delete="0" edit="0">
<tree create="0" delete="0" edit="0">
<field name="name" />
</tree>
<form string="Jira Organization" create="0" delete="0" edit="0">
Expand Down
4 changes: 4 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vcrpy==4.1.1
freezegun==0.3.15
odoo-addon-multi_step_wizard @git+https://github.com/OCA/server-ux@refs/pull/492/head#subdirectory=setup/multi_step_wizard
odoo-addon-connector_jira @git+https://github.com/OCA/connector-jira@refs/pull/76/head#subdirectory=setup/connector_jira

0 comments on commit 0b9df40

Please sign in to comment.