[UPD] Change addons name

This commit is contained in:
Stéphan Sainléger
2022-06-10 14:44:42 +02:00
parent c0cb6c95c1
commit 542a8b60c9
15 changed files with 6 additions and 24 deletions

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
from . import project_task
from . import git_issue
from . import git_repo

View 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)

View 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

View 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",
}