[UPD] Add git.platform model

to manage connection with other Git softwares
This commit is contained in:
Stéphan Sainléger
2022-06-10 20:55:09 +02:00
parent 64996c4ee5
commit 4b8a1f44a9
18 changed files with 100 additions and 32 deletions

View File

@@ -7,6 +7,7 @@ class CreateGitIssue(models.TransientModel):
_name = "create.git.issue"
_description = "Create a Git Issue"
issue_platform = fields.Many2one("git.platform", required=True)
issue_name = fields.Char(string="Title", required=True)
issue_description = fields.Html(string="Description", required=False)
issue_repo = fields.Many2one("git.repo", required=True)
@@ -17,8 +18,9 @@ class CreateGitIssue(models.TransientModel):
# Function to inherit in Git platform connector addons
def _create_git_issue(self):
return {}
return None
def create_issue(self):
values = self._create_git_issue()
self.env["git.issue"].create(values)
if values:
self.env["git.issue"].create(values)

View File

@@ -7,7 +7,8 @@
<field name="arch" type="xml">
<form string="create a new Git issue linked to the current task">
<group>
<field name="issue_repo" widget="selection" placeholder="Choose the repository of the issue" />
<field name="issue_platform" widget="selection" placeholder="Choose the platform for the issue" />
<field name="issue_repo" domain="[('platform_id', '=', issue_platform)]" widget="selection" placeholder="Choose the repository for the issue" />
<field name="issue_name" />
<field name="issue_description" />
</group>

View File

@@ -7,13 +7,19 @@ class LinkGitIssue(models.TransientModel):
_name = "link.git.issue"
_description = "Link a Git Issue to a project task"
issue_platform = fields.Many2one("git.platform", required=True)
issue_repo = fields.Many2one("git.repo", string="Repository", required=True)
issue_number = fields.Integer("Issue number", required=True)
# Function to inherit in Git platform connector addons
def _convert_issue_status(self, status):
return status
# Function to inherit in Git platform connector addons
def _compute_issue_values(self):
return {}
return None
def link_issue(self):
values = self._compute_issue_values()
self.env["git.issue"].create(values)
if values:
self.env["git.issue"].create(values)

View File

@@ -7,7 +7,8 @@
<field name="arch" type="xml">
<form string="Link an existing Git issue to the current task">
<group>
<field name="issue_repo" widget="selection" placeholder="Choose the repository of the issue" />
<field name="issue_platform" widget="selection" placeholder="Choose the platform of the issue" />
<field name="issue_repo" domain="[('platform_id', '=', issue_platform)]" widget="selection" placeholder="Choose the repository of the issue" />
<field name="issue_number" />
</group>
<footer>