-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP][MIG] connector_jira_tempo: Migration to 17.0
- Loading branch information
Showing
15 changed files
with
111 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import components | ||
from . import models | ||
from . import reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
] | ||
) |
4 changes: 0 additions & 4 deletions
4
connector_jira_tempo/models/account_analytic_line/__init__.py
This file was deleted.
Oops, something went wrong.
62 changes: 0 additions & 62 deletions
62
connector_jira_tempo/models/account_analytic_line/common.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import timesheet_analysis_report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class TimesheetsAnalysisReport(models.Model): | ||
_inherit = "timesheets.analysis.report" | ||
|
||
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"), | ||
], | ||
readonly=True, | ||
) | ||
|
||
@api.model | ||
def _select(self): | ||
return super()._select() + ", A.jira_tempo_status AS jira_tempo_status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.