[UPD] Separate core addons from Git platform connector addons
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
"website": "False",
|
"website": "False",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"category": "False",
|
"category": "False",
|
||||||
"summary": "Link project task to Github issues",
|
"summary": "Link project task to Git issues",
|
||||||
"description": """
|
"description": """
|
||||||
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
|
@@ -10,7 +10,7 @@ class Task(models.Model):
|
|||||||
|
|
||||||
def link_issue(self):
|
def link_issue(self):
|
||||||
return {
|
return {
|
||||||
"name": "Link a Github issue",
|
"name": "Link a Git issue",
|
||||||
"type": "ir.actions.act_window",
|
"type": "ir.actions.act_window",
|
||||||
"view_mode": "form",
|
"view_mode": "form",
|
||||||
"res_model": "link.git.issue",
|
"res_model": "link.git.issue",
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
access_git_issue_user,git.issue.user,dev_github_project_task_connector.model_git_issue,project.group_project_user,1,0,0,0
|
access_git_issue_user,git.issue.user,dev_git_project_task_connector.model_git_issue,project.group_project_user,1,0,0,0
|
||||||
access_git_issue_manager,git.issue.manager,dev_github_project_task_connector.model_git_issue,project.group_project_manager,1,1,1,1
|
access_git_issue_manager,git.issue.manager,dev_git_project_task_connector.model_git_issue,project.group_project_manager,1,1,1,1
|
||||||
access_git_repo_user,git.repo.user,dev_github_project_task_connector.model_git_repo,project.group_project_user,1,0,0,0
|
access_git_repo_user,git.repo.user,dev_git_project_task_connector.model_git_repo,project.group_project_user,1,0,0,0
|
||||||
access_git_repo_manager,git.repo.manager,dev_github_project_task_connector.model_git_repo,project.group_project_manager,1,1,1,1
|
access_git_repo_manager,git.repo.manager,dev_git_project_task_connector.model_git_repo,project.group_project_manager,1,1,1,1
|
|
@@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import models, fields
|
||||||
from github import Github
|
|
||||||
|
|
||||||
|
|
||||||
class LinkGitIssue(models.TransientModel):
|
class LinkGitIssue(models.TransientModel):
|
||||||
@@ -11,17 +10,10 @@ class LinkGitIssue(models.TransientModel):
|
|||||||
issue_repo = fields.Many2one("git.repo", string="Repository", required=True)
|
issue_repo = fields.Many2one("git.repo", string="Repository", required=True)
|
||||||
issue_number = fields.Integer("Issue number", required=True)
|
issue_number = fields.Integer("Issue number", required=True)
|
||||||
|
|
||||||
|
def _compute_issue_values(self):
|
||||||
|
# Function to inherit in Git platform connector addons
|
||||||
|
return {}
|
||||||
|
|
||||||
def link_issue(self):
|
def link_issue(self):
|
||||||
github = Github()
|
values = self._compute_issue_values()
|
||||||
repo = github.get_repo(self.issue_repo.displayed_name)
|
|
||||||
issue = repo.get_issue(number=self.issue_number)
|
|
||||||
values = {
|
|
||||||
"name": issue.title,
|
|
||||||
"repo": self.issue_repo.id,
|
|
||||||
"status": issue.state,
|
|
||||||
"url": issue.html_url,
|
|
||||||
"task_id": self.env["project.task"]
|
|
||||||
.browse(self._context.get("active_ids"))
|
|
||||||
.id,
|
|
||||||
}
|
|
||||||
self.env["git.issue"].create(values)
|
self.env["git.issue"].create(values)
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<field name="name">link_issue.wizard</field>
|
<field name="name">link_issue.wizard</field>
|
||||||
<field name="model">link.git.issue</field>
|
<field name="model">link.git.issue</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Link an existing Github issue to the current task">
|
<form string="Link an existing Git issue to the current task">
|
||||||
<group>
|
<group>
|
||||||
<field name="issue_repo" widget="selection" placeholder="Choose the repository of the issue" />
|
<field name="issue_repo" widget="selection" placeholder="Choose the repository of the issue" />
|
||||||
<field name="issue_number" />
|
<field name="issue_number" />
|
||||||
@@ -18,11 +18,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- <record id="action_link_issue" model="ir.actions.act_window">
|
|
||||||
<field name="name">Link Issue</field>
|
|
||||||
<field name="res_model">link.git.issue</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="view_id" ref="link_issue_wizard" />
|
|
||||||
<field name="target">new</field>
|
|
||||||
</record> -->
|
|
||||||
</odoo>
|
</odoo>
|
3
dev_github_connector/__init__.py
Normal file
3
dev_github_connector/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import wizard
|
78
dev_github_connector/__manifest__.py
Normal file
78
dev_github_connector/__manifest__.py
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# Copyright 2021 Elabore ()
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "Github Odoo Connector",
|
||||||
|
"version": "12.0.1.0.0",
|
||||||
|
"author": "Elabore",
|
||||||
|
"maintainer": "False",
|
||||||
|
"website": "False",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"category": "False",
|
||||||
|
"summary": "Connect Odoo user to Github user",
|
||||||
|
"description": """
|
||||||
|
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
|
:alt: License: AGPL-3
|
||||||
|
=============================
|
||||||
|
Github Odoo Connector
|
||||||
|
=============================
|
||||||
|
This module provides the capacity to link a user to a Gihub account in order to launch actions that need Github identification.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
Just install Github Odoo Connector, all dependencies will be installed by default.
|
||||||
|
|
||||||
|
Known issues / Roadmap
|
||||||
|
======================
|
||||||
|
|
||||||
|
Bug Tracker
|
||||||
|
===========
|
||||||
|
Bugs are tracked on `GitHub Issues
|
||||||
|
<https://github.com/elabore-coop/development-tools/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.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Images
|
||||||
|
------
|
||||||
|
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
------------
|
||||||
|
* Stéphan Sainléger <https://github.com/stephansainleger>
|
||||||
|
|
||||||
|
Funders
|
||||||
|
-------
|
||||||
|
The development of this module has been financially supported by:
|
||||||
|
* Elabore (https://elabore.coop)
|
||||||
|
* Lokavaluto (https://lokavaluto.fr)
|
||||||
|
|
||||||
|
Maintainer
|
||||||
|
----------
|
||||||
|
This module is maintained by ELABORE.
|
||||||
|
|
||||||
|
""",
|
||||||
|
# any module necessary for this one to work correctly
|
||||||
|
"depends": [
|
||||||
|
"base",
|
||||||
|
"dev_git_project_task_connector",
|
||||||
|
],
|
||||||
|
"external_dependencies": {
|
||||||
|
"python": [],
|
||||||
|
},
|
||||||
|
# always loaded
|
||||||
|
"data": [],
|
||||||
|
# only loaded in demonstration mode
|
||||||
|
"demo": [],
|
||||||
|
"js": [],
|
||||||
|
"css": [],
|
||||||
|
"qweb": [],
|
||||||
|
"installable": True,
|
||||||
|
# Install this module automatically if all dependency have been previously
|
||||||
|
# and independently installed. Used for synergetic or glue modules.
|
||||||
|
"auto_install": False,
|
||||||
|
"application": False,
|
||||||
|
}
|
3
dev_github_connector/wizard/__init__.py
Normal file
3
dev_github_connector/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import link_issue
|
24
dev_github_connector/wizard/link_issue.py
Normal file
24
dev_github_connector/wizard/link_issue.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import models
|
||||||
|
from github import Github
|
||||||
|
|
||||||
|
|
||||||
|
class LinkGitIssue(models.TransientModel):
|
||||||
|
_inherit = "link.git.issue"
|
||||||
|
|
||||||
|
def _compute_issue_values(self):
|
||||||
|
values = super(LinkGitIssue, self)._compute_issue_values()
|
||||||
|
github = Github()
|
||||||
|
repo = github.get_repo(self.issue_repo.displayed_name)
|
||||||
|
issue = repo.get_issue(number=self.issue_number)
|
||||||
|
values = {
|
||||||
|
"name": issue.title,
|
||||||
|
"repo": self.issue_repo.id,
|
||||||
|
"status": issue.state,
|
||||||
|
"url": issue.html_url,
|
||||||
|
"task_id": self.env["project.task"]
|
||||||
|
.browse(self._context.get("active_ids"))
|
||||||
|
.id,
|
||||||
|
}
|
||||||
|
return values
|
Reference in New Issue
Block a user