[NEW] Addons dev_github_project_task_connector creation
This commit is contained in:
5
dev_github_project_task_connector/models/__init__.py
Normal file
5
dev_github_project_task_connector/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import project_task
|
||||
from . import git_issue
|
||||
from . import git_repo
|
23
dev_github_project_task_connector/models/git_issue.py
Normal file
23
dev_github_project_task_connector/models/git_issue.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class GitIssue(models.Model):
|
||||
_name = "git.issue"
|
||||
_description = "Issue Git"
|
||||
|
||||
name = fields.Char(string="Title", required=True, copy=True)
|
||||
repo = fields.Many2one("git.repo", required=True, copy=True)
|
||||
status = fields.Selection(
|
||||
[
|
||||
("opened", "Opened"),
|
||||
("closed", "Closed"),
|
||||
],
|
||||
required=True,
|
||||
default="opened",
|
||||
copy=False,
|
||||
)
|
||||
url = fields.Char(string="Link", required=True, copy=False)
|
||||
|
||||
task_id = fields.Many2one("project.task", required=True, copy=True)
|
21
dev_github_project_task_connector/models/git_repo.py
Normal file
21
dev_github_project_task_connector/models/git_repo.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class GitRepository(models.Model):
|
||||
_name = "git.repo"
|
||||
_description = "Repository Git"
|
||||
|
||||
name = fields.Char(string="name", required=True)
|
||||
owner = fields.Char(string="Owner", required=True)
|
||||
displayed_name = fields.Char(
|
||||
string="Displayed name", compute="_compute_displayed_name"
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.depends("owner", "name")
|
||||
def _compute_displayed_name(self):
|
||||
for record in self:
|
||||
if record.name and record.owner:
|
||||
record.displayed_name = record.owner + "/" + record.name
|
18
dev_github_project_task_connector/models/project_task.py
Normal file
18
dev_github_project_task_connector/models/project_task.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class Task(models.Model):
|
||||
_inherit = "project.task"
|
||||
|
||||
issue_ids = fields.One2many("git.issue", "task_id")
|
||||
|
||||
def link_issue(self):
|
||||
return {
|
||||
"name": "Link a Github issue",
|
||||
"type": "ir.actions.act_window",
|
||||
"view_mode": "form",
|
||||
"res_model": "link.git.issue",
|
||||
"target": "new",
|
||||
}
|
Reference in New Issue
Block a user