Example #1
0
    def create_issue_project(self, cr, uid, ids, context=None):
        gitlab_conn = get_connection_gitlab(
            self.pool.get('ir.config_parameter'), cr)

        for issue in self.browse(cr, uid, ids, context=context):
            str_labels = ''
            regex_title = re.compile("^(\-\s)([A-Z]*\-\d*)(\:\s)(.*)$")
            regex_criteria = re.compile("^(.*)(\[\w\])\s(\*\*.*\*\*)(.*)$",
                                        re.MULTILINE)
            found_title = regex_title.findall(issue.us_id)
            for label in issue.label_ids:
                str_labels = 'col:' + issue.stage_id.name + ',' + label.name
                found_criteria = regex_criteria.findall(issue.description)
                for criteria in found_criteria:
                    res = gitlab_conn.createissue(
                        issue.project_id.gitlab_id,
                        #[User Story-id][Criteria ID] Criteria title
                        '[{0}] {1} {2}'.format(found_title[0][1], criteria[1],
                                               criteria[2].replace('**', '')),
                        #User Story\n\n Criteria Title Criteria Description
                        description="{0}\n\n - {1} {2}".format(
                            found_title[0][3], criteria[2], criteria[3]),
                        assignee_id=issue.user_id.gitlab_id,
                        labels=str_labels)
                    _logger.info(res)

        return {'type': 'ir.actions.act_window_close'}
Example #2
0
    def create_issue_project(self, cr, uid, ids, context=None):
        gitlab_conn = get_connection_gitlab(self.pool.get('ir.config_parameter'), cr)

        for issue in self.browse(cr, uid, ids, context=context):
            str_labels = ''
            regex_title = re.compile("^(\-\s)([A-Z]*\-\d*)(\:\s)(.*)$")
            regex_criteria = re.compile("^(.*)(\[\w\])\s(\*\*.*\*\*)(.*)$",re.MULTILINE)
            found_title = regex_title.findall(issue.us_id)
            for label in issue.label_ids:
                str_labels = 'col:' + issue.stage_id.name + ',' + label.name
                found_criteria = regex_criteria.findall(issue.description)
                for criteria in found_criteria:
                    res = gitlab_conn.createissue(
                        issue.project_id.gitlab_id,
                        #[User Story-id][Criteria ID] Criteria title
                        '[{0}] {1} {2}'.format(found_title[0][1], criteria[1], criteria[2].replace('**','')),
                        #User Story\n\n Criteria Title Criteria Description
                        description="{0}\n\n - {1} {2}".format(found_title[0][3], criteria[2], criteria[3]),
                        assignee_id=issue.user_id.gitlab_id,
                        labels=str_labels
                    )
                    _logger.info(res)

        return {'type': 'ir.actions.act_window_close'}
Example #3
0
    def sync(self, cr, uid, ids, context=None):
        gitlab_conn = get_connection_gitlab(self.pool.get('ir.config_parameter'), cr)
        projects = gitlab_conn.getprojects(per_page=100)
        self.gitlab_walk_projects(cr, uid, projects, gitlab_conn)

        return {'type': 'ir.actions.act_window_close'}