Merge pull request #1 from elabore-coop/12.0-github-connector
12.0 GitHub connector
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "Git Project Task Connector",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "12.0.1.1.0",
|
||||
"author": "Elabore",
|
||||
"maintainer": "False",
|
||||
"website": "False",
|
||||
@@ -74,6 +74,7 @@ This module is maintained by ELABORE.
|
||||
"views/project_task.xml",
|
||||
"views/git_issue.xml",
|
||||
"views/git_repository.xml",
|
||||
"views/res_config_settings_view.xml",
|
||||
"views/menus.xml",
|
||||
"data/git_issue_data.xml",
|
||||
],
|
||||
|
BIN
dev_git_project_task_connector/static/description/icon.png
Normal file
BIN
dev_git_project_task_connector/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="res_config_settings_view_form_git" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.view.form.inherit.git</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="99" />
|
||||
<field name="inherit_id" ref="base.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('settings')]" position="inside">
|
||||
<div class="app_settings_block" data-string="git" string="Git" data-key="dev_git_project_task_connector">
|
||||
<h2>Git generic configuration</h2>
|
||||
<div class="row mt16 o_settings_container" id="git_generic_settings">
|
||||
<p>No generic configuration</p>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "Github Odoo Connector",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "12.0.1.2.0",
|
||||
"author": "Elabore",
|
||||
"maintainer": "False",
|
||||
"website": "False",
|
||||
@@ -65,7 +65,7 @@ This module is maintained by ELABORE.
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
"views/res_user.xml",
|
||||
"views/res_config_settings_view.xml",
|
||||
"data/git_platform.xml",
|
||||
],
|
||||
# only loaded in demonstration mode
|
||||
|
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import res_user
|
||||
from . import res_config_settings
|
||||
from . import company
|
||||
from . import git_platform
|
||||
from . import git_issue
|
||||
|
@@ -1,9 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class Users(models.Model):
|
||||
_inherit = "res.users"
|
||||
class Company(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
github_token = fields.Char(string="Github token")
|
9
dev_github_connector/models/res_config_settings.py
Normal file
9
dev_github_connector/models/res_config_settings.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
github_token = fields.Char(
|
||||
related="company_id.github_token", string="Github token", readonly=False
|
||||
)
|
25
dev_github_connector/views/res_config_settings_view.xml
Normal file
25
dev_github_connector/views/res_config_settings_view.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="res_config_settings_view_form_github" model="ir.ui.view">
|
||||
<field name="name">res.config.settings.view.form.inherit.github</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="99" />
|
||||
<field name="inherit_id" ref="dev_git_project_task_connector.res_config_settings_view_form_git" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='git_generic_settings']" position="after">
|
||||
<h2>Github configuration</h2>
|
||||
<div class="row mt16 o_settings_container" id="github_settings">
|
||||
<div class="col-12 col-lg-6 o_setting_box" id="github_tokenl">
|
||||
<div class="o_setting_left_pane" />
|
||||
<div class="o_setting_right_pane">
|
||||
<span class="o_form_label">Github token</span>
|
||||
<div class="text-muted">
|
||||
<field name="github_token" widget="password" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="view_users_form_simple_gitub_token" model="ir.ui.view">
|
||||
<field name="name">res.users.github.preferences.form</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form_simple_modif" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='preferences']" position="after">
|
||||
<group string="Github credentials">
|
||||
<field name="github_token" readonly="0" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
@@ -18,7 +18,7 @@ class CreateGitIssue(models.TransientModel):
|
||||
def _create_git_issue(self):
|
||||
values = super(CreateGitIssue, self)._create_git_issue()
|
||||
if self.issue_platform.tool == "github":
|
||||
github = Github(self.env.user.github_token)
|
||||
github = Github(self.env.user.company_id.github_token)
|
||||
repo = github.get_repo(self.issue_repo.displayed_name)
|
||||
issue = repo.create_issue(
|
||||
title=self.issue_name, body=self.issue_description
|
||||
|
Reference in New Issue
Block a user