[NEW] Add refresh issues functionnality
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class GitIssue(models.Model):
|
||||
_name = "git.issue"
|
||||
_description = "Issue Git"
|
||||
|
||||
issue_id = fields.Integer(string="ID", required=True)
|
||||
name = fields.Char(string="Title", required=True, copy=True)
|
||||
platform = fields.Many2one("git.platform", string="Git platform", required=True)
|
||||
repo = fields.Many2one(
|
||||
@@ -24,3 +26,8 @@ class GitIssue(models.Model):
|
||||
url = fields.Char(string="Link", required=True, copy=False)
|
||||
|
||||
task_id = fields.Many2one("project.task", required=True, copy=True)
|
||||
|
||||
def refresh_data(self):
|
||||
raise UserError(
|
||||
"A Git platform connector addons must be installed to refresh the issues data."
|
||||
)
|
||||
|
@@ -25,3 +25,8 @@ class Task(models.Model):
|
||||
"res_model": "create.git.issue",
|
||||
"target": "new",
|
||||
}
|
||||
|
||||
def refresh_issues(self):
|
||||
for record in self:
|
||||
for issue in record.issue_ids:
|
||||
issue.refresh_data()
|
||||
|
@@ -10,6 +10,7 @@
|
||||
<page name="git_issues" string="Git Issues">
|
||||
<button string="Create an issue" name="create_issue" type="object" class="oe_stat_button" icon="fa-plus-circle" style="margin: 0px 4px 0px 0px" />
|
||||
<button string="Link an issue" name="link_issue" type="object" class="oe_stat_button" icon="fa-link" style="margin: 0px 4px 0px 0px" />
|
||||
<button string="Refresh" name="refresh_issues" type="object" class="oe_stat_button" icon="fa-refresh" style="margin: 0px 4px 0px 0px" />
|
||||
<separator string="Current linked issues" />
|
||||
<field name="issue_ids" nolabel="1" mode="tree">
|
||||
<tree create="0" delete="1">
|
||||
|
Reference in New Issue
Block a user