OCA / interface-github

Tools to interact with github from Odoo
GNU Affero General Public License v3.0
46 stars 77 forks source link

[13.0] [BUG]"github_connector" module > Wrong hierarchical structure of directory path arborescence & Github URL field, on "github.repository.branch" form view #52

Closed NCS-75 closed 4 years ago

NCS-75 commented 4 years ago

Context : OCB 13.0 Odoo Server up to date [(07/06/2020),] Not able to reproduce on runbot : http://3430035-13-0-523584.runbot2.odoo-community.org, because of mising setting possibility : github_login' and 'github_password' in Odoo configuration file

Steps to reproduce : Install "github_connector" module Apply extra settings to mention Github credentials, in odoo conf file

Go to ‘Settings’ / ‘Technical’ / ‘Parameters’ / ‘System Parameters’ and define the required values Go to your(s) user(s) form to add them in the new ‘Connector Github Manager’ groups Go to ‘Github’ / ‘Settings’ / ‘Sync Object’, and select the object type you want to synchronize and its Gthub name (OCA, or muk-it) ; then click to "Load from Github" Once done for your organization(s), go to ‘Github’ / ‘Github Commnunity’ / ‘Organizations’ and, click on your organization / ‘Organization Series’ Tabs, to set repositories you don’t want to download (or repositories you want to download). Also, click to "Repositories sync" Now, you suppose to see on the form, the count button repositories link incremented.

_Then, access to the form of any branches created, by going from menu to "Github repository/Repository branches" and look at the wrong syntax displayed , on ""Githuburl"" field** :**

_(model=github.repository.branch&viewtype=form) Github URL : https://github.com/OCA/OCA/account-invoicing/tree/13.0
Same for another banch, Github URL : https://github.com/muk-it/muk-it/muk_base/tree/13.0

Mistake ? : (/models/github_repository_branch.py) Code suppose to display right url syntax, no ?

@api.depends("name", "repository_id.complete_name")
    def _compute_github_url(self):
        for branch in self:
            branch.github_url = "https://github.com/{}/{}/tree/{}".format(
                branch.organization_id.github_login,
                branch.repository_id.complete_name,
                branch.name,
            )
...
github_url = fields.Char(
        string="Github URL", store=True, compute="_compute_github_url"

. _(/views/view_github_repositorybranch.xml) Line 174 : <field name="github_url" widget="url" colspan="4" />

Consequence: Github url link not rechable, Directory, on server, are also created base on same wrong arborescence :

pedrobaeza commented 4 years ago

Fixed in 6cc412a64b33a4969948efdb93691d933c105e91

NCS-75 commented 4 years ago

Hi, @pedrobaeza Thanks for the fix 6cc412a

Under your control, It seems that you forgot to modify also this part of code on "github_repository_branch.py" line 279 )

    # Compute Section
    @api.depends("name", "repository_id.name")
    def _compute_complete_name(self):
        for branch in self:
            branch.complete_name = (
# -              branch.repository_id.complete_name + "/" + branch.name
                 branch.repository_id.name + "/" + branch.name
            )

. If you do so, directory arborescence is ok, then.... (like downside image) Connector3

pedrobaeza commented 4 years ago

OK, fixed in a4cdbdc1d4ef02ebcf099270fe5218f80e6a9390. Next time, you can do the PR with the needed changes if you prefer.