[NEW] Add refresh issues functionnality
This commit is contained in:
24
dev_github_connector/models/git_issue.py
Normal file
24
dev_github_connector/models/git_issue.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
from github import Github
|
||||
|
||||
|
||||
class GitIssue(models.Model):
|
||||
_inherit = "git.issue"
|
||||
|
||||
def _convert_issue_status(self, status):
|
||||
if status == "open":
|
||||
return "opened"
|
||||
elif status == "closed":
|
||||
return "closed"
|
||||
else:
|
||||
return status
|
||||
|
||||
def refresh_data(self):
|
||||
for record in self:
|
||||
if record.platform.tool == "github":
|
||||
github = Github()
|
||||
repo = github.get_repo(self.repo.displayed_name)
|
||||
issue = repo.get_issue(number=self.issue_id)
|
||||
record.status = self._convert_issue_status(issue.state)
|
Reference in New Issue
Block a user