Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][WIP][MIG] connector_jira_tempo: Migration to 17.0 #111

Draft
wants to merge 29 commits into
base: 17.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1c46838
[UPD] Brainbean Apps => CorporateHub
alexey-pelykh Nov 4, 2020
aad75b5
[ADD] connector_jira_tempo
simahawk Nov 22, 2018
f538cd0
Fix tempo api call with actual username instead of key
guewen Mar 18, 2019
7a0d5b9
Handle 404 errors on tempo requests
guewen Apr 3, 2019
52e37c7
Tempo: sync status, add tests
simahawk May 8, 2019
8be92fd
Tempo: add hook to validate TS
simahawk May 29, 2019
38ac714
[ADD] icon.png
OCA-git-bot Jul 12, 2019
38fbe2a
[MIG] connector_jira_tempo: Migration to 12.0
alexey-pelykh Aug 31, 2019
fd40c78
[UPD] README.rst
OCA-git-bot Oct 28, 2019
6489902
[ADD] connector_jira_tempo_base, connector_jira_tempo_project_role
alexey-pelykh Aug 30, 2019
61b06d0
[FIX][11.0] Fix get timesheet lines domain
jcoux Jan 29, 2020
8283c19
connector_jira_tempo 12.0.2.1.0
OCA-git-bot Feb 14, 2020
aefef4e
[FIX][11.0] Remove enterprise related code
jcoux Feb 26, 2020
b691dce
connector_jira_tempo 12.0.2.1.1
OCA-git-bot Feb 27, 2020
ab62e05
[IMP] connector_jira_tempo: black, isort, prettier
grindtildeath Aug 6, 2020
0c392aa
[MIG] connector_jira_tempo: Migration to 13.0
grindtildeath Aug 6, 2020
4d6431d
[UPD] README.rst
OCA-git-bot Feb 10, 2021
63014cc
[IMP] connector_jira_tempo: black, isort, prettier
Jun 22, 2022
f84900d
[15.0][MIG] connector_jira_tempo: Migration to 15.0
Jun 22, 2022
73686e1
[UPD] Update connector_jira_tempo.pot
Jul 25, 2022
d6702e5
[UPD] README.rst
OCA-git-bot Jul 25, 2022
8f2ff21
[UPD] README.rst
OCA-git-bot Sep 3, 2023
07fde06
user mapping work
gurneyalex Feb 16, 2024
15ddf05
connector_jira_tempo: handle missing key
gurneyalex Apr 10, 2024
e5a46d4
connector_jira_tempo: migrate to cloud version
gurneyalex Apr 19, 2024
9378842
tempo connector: fix TS approval sync
gurneyalex Apr 19, 2024
3cdccfe
[FIX] connector_jira_tempo: validation status
gurneyalex Apr 24, 2024
3d2104a
[IMP] connector_jira_tempo: pre-commit auto-fixes
SilvioC2C Jul 11, 2024
2dd16be
[WIP][MIG] connector_jira_tempo: Migration to 17.0
SilvioC2C Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions connector_jira_tempo/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
====================
JIRA Connector Tempo
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f50e6d1a785293b7646d47d84fa2e1f3323b44769f5e48c537a622ea652ef3e5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/17.0/connector_jira_tempo
: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-17-0/connector-jira-17-0-connector_jira_tempo
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-jira&target_branch=17.0
:alt: Try me on Runboat

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

This module adds Jira Tempo synchronization feature.

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector-jira/issues/new?body=module:%20connector_jira_tempo%0Aversion:%2017.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
------------

- `Camptocamp <https://www.camptocamp.com>`__:

- Simone Orsi <[email protected]>
- Guewen Baconnier <[email protected]>
- Akim Juillerat <[email protected]>
- Denis Leemann <[email protected]>

- `CorporateHub <https://corporatehub.eu/>`__

- Alexey Pelykh <[email protected]>

- `Trobz <https://trobz.com>`__:

- Son Ho <[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/connector-jira <https://github.com/OCA/connector-jira/tree/17.0/connector_jira_tempo>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions connector_jira_tempo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import components
from . import models
from . import reports
17 changes: 17 additions & 0 deletions connector_jira_tempo/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "JIRA Connector Tempo",
"version": "17.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Connector",
"depends": ["connector_jira_tempo_base", "hr_timesheet"],
"website": "https://github.com/OCA/connector-jira",
"data": [
"data/cron.xml",
"views/account_analytic_line.xml",
"views/jira_backend.xml",
],
"installable": True,
}
4 changes: 4 additions & 0 deletions connector_jira_tempo/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import jira_analytic_line_mapper
from . import jira_worklog_adapter
15 changes: 15 additions & 0 deletions connector_jira_tempo/components/jira_analytic_line_mapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2018 Camptocamp SA
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo.addons.component.core import Component
from odoo.addons.connector.components.mapper import mapping


class JiraAnalyticLineMapper(Component):
_inherit = "jira.analytic.line.mapper"

@mapping
def tempo_timesheets_approval(self, record):
approval = record.get("_tempo_timesheets_approval", {"status": {"key": "OPEN"}})
return {"jira_tempo_status": approval["status"]["key"].lower()}
32 changes: 32 additions & 0 deletions connector_jira_tempo/components/jira_worklog_adapter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2019 Camptocamp SA
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import datetime
import json

from odoo.addons.component.core import Component


class JiraWorklogAdapter(Component):
_inherit = "jira.worklog.adapter"

def read(self, issue_id, worklog_id):
worklog = super().read(issue_id, worklog_id)
if self.env.context.get("jira_worklog_no_tempo_timesheets_approval_data"):
return worklog
with self.handle_404():
approval = self.tempo_timesheets_approval_read(worklog)
worklog["_tempo_timesheets_approval"] = approval
return worklog

def tempo_timesheets_approval_read(self, worklog):
backend = self._tempo_timesheets_get_webservice()
account_id = worklog["author"]["accountId"]
period_start = datetime.date.today().isoformat()
endpoint = f"timesheet-approvals/user/{account_id}?from={period_start}"
return json.loads(backend.call("get", url_params={"endpoint": endpoint}))

def tempo_timesheets_approval_read_status_by_team(self, team_id, period_start):
backend = self._tempo_timesheets_get_webservice()
endpoint = f"timesheet-approvals/team/{team_id}?from={period_start}"
return json.loads(backend.call("get", url_params={"endpoint": endpoint}))
20 changes: 20 additions & 0 deletions connector_jira_tempo/data/cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
-->
<odoo noupdate="1">
<record id="ir_cron_jira_sync_tempo_timesheets_approval_status" model="ir.cron">
<field name="name">JIRA - Sync Tempo Timesheet approval status</field>
<field name="model_id" ref="model_jira_backend" />
<field name="state">code</field>
<field name="code">
model.search([])._scheduler_sync_tempo_timesheets_approval_status()
</field>
<field name="active" eval="False" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
</record>
</odoo>
81 changes: 81 additions & 0 deletions connector_jira_tempo/i18n/connector_jira_tempo.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * connector_jira_tempo
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: connector_jira_tempo
#: model:ir.model,name:connector_jira_tempo.model_account_analytic_line
msgid "Analytic Line"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields.selection,name:connector_jira_tempo.selection__account_analytic_line__jira_tempo_status__approved
msgid "Approved"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields,help:connector_jira_tempo.field_jira_backend__validate_approved_ts
msgid ""
"If this flag is ON, once the status is sync'ed from Jira, all approved "
"timesheets will be validated on Odoo as well."
msgstr ""

#. module: connector_jira_tempo
#: model:ir.actions.server,name:connector_jira_tempo.ir_cron_jira_sync_tempo_timesheets_approval_status_ir_actions_server
#: model:ir.cron,cron_name:connector_jira_tempo.ir_cron_jira_sync_tempo_timesheets_approval_status
#: model:ir.cron,name:connector_jira_tempo.ir_cron_jira_sync_tempo_timesheets_approval_status
msgid "JIRA - Sync Tempo Timesheet approval status"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model,name:connector_jira_tempo.model_jira_backend
msgid "Jira Backend"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields,field_description:connector_jira_tempo.field_jira_backend__jira_company_team_id
msgid "Jira Company Team"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields,field_description:connector_jira_tempo.field_account_analytic_line__jira_tempo_status
#: model:ir.model.fields,field_description:connector_jira_tempo.field_jira_account_analytic_line__jira_tempo_status
msgid "Jira Tempo Status"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields.selection,name:connector_jira_tempo.selection__account_analytic_line__jira_tempo_status__open
msgid "Open"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields.selection,name:connector_jira_tempo.selection__account_analytic_line__jira_tempo_status__ready_to_submit
msgid "Ready to submit"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields,help:connector_jira_tempo.field_jira_backend__jira_company_team_id
msgid ""
"This field contains the ID of a company wide group on JIRA. Its main usage "
"is to fetch tempo statuses for ALL employees."
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields,field_description:connector_jira_tempo.field_jira_backend__validate_approved_ts
msgid "Validate Approved Ts"
msgstr ""

#. module: connector_jira_tempo
#: model:ir.model.fields.selection,name:connector_jira_tempo.selection__account_analytic_line__jira_tempo_status__waiting_for_approval
msgid "Waiting for approval"
msgstr ""
4 changes: 4 additions & 0 deletions connector_jira_tempo/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import account_analytic_line
from . import jira_backend
21 changes: 21 additions & 0 deletions connector_jira_tempo/models/account_analytic_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2019 Camptocamp SA
# Copyright 2019 Brainbean Apps (https://brainbeanapps.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


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

jira_tempo_status = fields.Selection(
selection=[
("approved", "Approved"),
("in_review", "In Review"),
# no longer used on cloud version
("waiting_for_approval", "Waiting for approval"),
# no longer used on cloud version
("ready_to_submit", "Ready to submit"),
("open", "Open"),
]
)
Loading
Loading