Skip to content

Commit ee2b805

Browse files
[MIG] github_connector: Migration to version 18.0
1 parent f23b363 commit ee2b805

28 files changed

+318
-344
lines changed

github_connector/README.rst

Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ Github Connector
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Finterface--github-lightgray.png?logo=github
20-
:target: https://github.com/OCA/interface-github/tree/17.0/github_connector
20+
:target: https://github.com/OCA/interface-github/tree/18.0/github_connector
2121
:alt: OCA/interface-github
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/interface-github-17-0/interface-github-17-0-github_connector
23+
:target: https://translation.odoo-community.org/projects/interface-github-18-0/interface-github-18-0-github_connector
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/interface-github&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/interface-github&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
This module allows you to:
3232

33-
- Fetch into Odoo social information from Github (Organizations, Teams,
34-
Users)
35-
- Fetch into Odoo Code structure information from Github (Repositories,
36-
Branches)
37-
- Download source code from Github
38-
- Analyze repository code from rules previously created
33+
- Fetch into Odoo social information from Github (Organizations, Teams,
34+
Users)
35+
- Fetch into Odoo Code structure information from Github (Repositories,
36+
Branches)
37+
- Download source code from Github
38+
- Analyze repository code from rules previously created
3939

4040
**Table of contents**
4141

@@ -66,14 +66,14 @@ Once installed, you have to:
6666
credentials, and the local path where the source code will be
6767
downloaded:
6868

69-
- ``source_code_local_path = /workspace/source_code/``
69+
- ``source_code_local_path = /workspace/source_code/``
7070

7171
Note: you can define the route as environment variable using the key
7272
SOURCE_CODE_LOCAL_PATH
7373

7474
Note: make sure that Odoo process has read / write access on that folder
7575

76-
- ``github_token = your_github_access_token``
76+
- ``github_token = your_github_access_token``
7777

7878
Note: The login/password auth has been deprecated by GitHub.
7979
https://docs.github.com/en/rest/overview/other-authentication-methods#via-username-and-password
@@ -101,14 +101,13 @@ Technical Information
101101

102102
This module provides 4 crons that you can enable:
103103

104-
- Synchronize All Organizations and Teams
105-
(``cron_update_organization``)
106-
- Synchronize Branches List for All repositories
107-
(``cron_update_branch_list``)
108-
- Download Source Code for All Github Branches (``cron_download_code``)
109-
- Analyze Source Code for All Github Branches (``cron_analyze_code``)
104+
- Synchronize All Organizations and Teams (``cron_update_organization``)
105+
- Synchronize Branches List for All repositories
106+
(``cron_update_branch_list``)
107+
- Download Source Code for All Github Branches (``cron_download_code``)
108+
- Analyze Source Code for All Github Branches (``cron_analyze_code``)
110109

111-
.. |image| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_settings.png
110+
.. |image| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_settings.png
112111

113112
Usage
114113
=====
@@ -295,58 +294,58 @@ This module provides several reports
295294

296295
|github_repository_branch_rule_info_report|
297296

298-
.. |sync_organization| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/sync_organization.png
299-
.. |github_organization_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_kanban.png
300-
.. |github_organization_series| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_series.png
301-
.. |github_organization_external_services| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_external_services.png
302-
.. |github_organization_sync_buttons| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_organization_sync_buttons.png
303-
.. |github_team_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_kanban.png
304-
.. |github_team_partner_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_partner_kanban.png
305-
.. |github_team_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_team_repository_kanban.png
306-
.. |github_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_kanban.png
307-
.. |github_repository_branch_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_kanban.png
308-
.. |wizard_download_analyze| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_download_analyze.png
309-
.. |github_repository_branch_list| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_list.png
310-
.. |wizard_create_team| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_team.png
311-
.. |wizard_create_repository| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/wizard_create_repository.png
312-
.. |reporting_branches_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_branches_by_serie.png
313-
.. |reporting_sizes_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/reporting_sizes_by_serie.png
314-
.. |github_repository_branch_rule_info_report| image:: https://raw.githubusercontent.com/OCA/interface-github/17.0/github_connector/static/description/github_repository_branch_rule_info_report.png
297+
.. |sync_organization| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/sync_organization.png
298+
.. |github_organization_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_kanban.png
299+
.. |github_organization_series| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_series.png
300+
.. |github_organization_external_services| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_external_services.png
301+
.. |github_organization_sync_buttons| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_organization_sync_buttons.png
302+
.. |github_team_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_kanban.png
303+
.. |github_team_partner_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_partner_kanban.png
304+
.. |github_team_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_team_repository_kanban.png
305+
.. |github_repository_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_kanban.png
306+
.. |github_repository_branch_kanban| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_kanban.png
307+
.. |wizard_download_analyze| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_download_analyze.png
308+
.. |github_repository_branch_list| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_list.png
309+
.. |wizard_create_team| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_create_team.png
310+
.. |wizard_create_repository| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/wizard_create_repository.png
311+
.. |reporting_branches_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/reporting_branches_by_serie.png
312+
.. |reporting_sizes_by_serie| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/reporting_sizes_by_serie.png
313+
.. |github_repository_branch_rule_info_report| image:: https://raw.githubusercontent.com/OCA/interface-github/18.0/github_connector/static/description/github_repository_branch_rule_info_report.png
315314

316315
Known issues / Roadmap
317316
======================
318317

319-
- For the time being, Github API doesn't provide some informations that
320-
are available by the classic UI, that includes:
318+
- For the time being, Github API doesn't provide some informations that
319+
are available by the classic UI, that includes:
321320

322-
1. team hierarchy: the field is present in the model
323-
github_team.parent_id, but unused.
321+
1. team hierarchy: the field is present in the model
322+
github_team.parent_id, but unused.
324323

325-
- Possible improvements:
324+
- Possible improvements:
326325

327-
1. Create a new module github_connector_website, that could display
328-
teams / repositories / branches informations for non logged users.
329-
2. Analyze commits (author, quantity by series, etc...): this feature
330-
has been partially implemented in a V8.0 PR.
331-
3. Synchronize Pull Request, Issues, Comments: this feature has been
332-
partially implemented in a V8.0 PR.
326+
1. Create a new module github_connector_website, that could display
327+
teams / repositories / branches informations for non logged users.
328+
2. Analyze commits (author, quantity by series, etc...): this feature
329+
has been partially implemented in a V8.0 PR.
330+
3. Synchronize Pull Request, Issues, Comments: this feature has been
331+
partially implemented in a V8.0 PR.
333332

334-
- Refactor the github connector:
333+
- Refactor the github connector:
335334

336-
A python library called PyGitHub is available. It could be
337-
interesting to use it, instead of using custom code. However, this
338-
lib doesn't provide good access to child object, generating for the
339-
time being, unnecessary API calls. For example, updating a repository
340-
should call before a call to the parent organization (The current
341-
module is so faster).
335+
A python library called PyGitHub is available. It could be interesting
336+
to use it, instead of using custom code. However, this lib doesn't
337+
provide good access to child object, generating for the time being,
338+
unnecessary API calls. For example, updating a repository should call
339+
before a call to the parent organization (The current module is so
340+
faster).
342341

343342
Bug Tracker
344343
===========
345344

346345
Bugs are tracked on `GitHub Issues <https://github.com/OCA/interface-github/issues>`_.
347346
In case of trouble, please check there if your issue has already been reported.
348347
If you spotted it first, help us to smash it by providing a detailed and welcomed
349-
`feedback <https://github.com/OCA/interface-github/issues/new?body=module:%20github_connector%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
348+
`feedback <https://github.com/OCA/interface-github/issues/new?body=module:%20github_connector%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
350349

351350
Do not contact contributors directly about support or help with technical issues.
352351

@@ -363,20 +362,20 @@ Authors
363362
Contributors
364363
------------
365364

366-
- Sylvain LE GAL (https://twitter.com/legalsylvain)
367-
- Sébastien BEAU ([email protected])
368-
- Benoît GUILLOT ([email protected])
369-
- Enrique Martín ([email protected])
370-
- `Tecnativa <https://www.tecnativa.com>`__:",
371-
372-
- Pedro M. Baeza
373-
- Vicent Cubells
374-
- Alexandre Díaz
375-
- Ernesto Tejeda
376-
- Carlos Roca
377-
- Víctor Martínez
378-
- João Marques
379-
- Carolina Fernandez
365+
- Sylvain LE GAL (https://twitter.com/legalsylvain)
366+
- Sébastien BEAU ([email protected])
367+
- Benoît GUILLOT ([email protected])
368+
- Enrique Martín ([email protected])
369+
- `Tecnativa <https://www.tecnativa.com>`__:",
370+
371+
- Pedro M. Baeza
372+
- Vicent Cubells
373+
- Alexandre Díaz
374+
- Ernesto Tejeda
375+
- Carlos Roca
376+
- Víctor Martínez
377+
- João Marques
378+
- Carolina Fernandez
380379

381380
Maintainers
382381
-----------
@@ -391,6 +390,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
391390
mission is to support the collaborative development of Odoo features and
392391
promote its widespread use.
393392

394-
This module is part of the `OCA/interface-github <https://github.com/OCA/interface-github/tree/17.0/github_connector>`_ project on GitHub.
393+
This module is part of the `OCA/interface-github <https://github.com/OCA/interface-github/tree/18.0/github_connector>`_ project on GitHub.
395394

396395
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

github_connector/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "Github Connector",
99
"summary": "Synchronize information from Github repositories",
10-
"version": "17.0.1.0.0",
10+
"version": "18.0.1.0.0",
1111
"category": "Connector",
1212
"license": "AGPL-3",
1313
"author": "Odoo Community Association (OCA), GRAP, Akretion, Tecnativa",

github_connector/data/ir_cron.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
1111
<field name="active" eval="False" />
1212
<field name="user_id" ref="base.user_root" />
1313
<field name="interval_type">days</field>
14-
<field name="numbercall">-1</field>
15-
<field name="doall" eval="False" />
1614
<field name="state">code</field>
1715
<field name="model_id" ref="model_github_organization" />
1816
<field name="code">model.cron_update_organization_team()</field>
@@ -23,8 +21,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
2321
<field name="active" eval="False" />
2422
<field name="user_id" ref="base.user_root" />
2523
<field name="interval_type">days</field>
26-
<field name="numbercall">-1</field>
27-
<field name="doall" eval="False" />
2824
<field name="state">code</field>
2925
<field name="model_id" ref="model_github_repository" />
3026
<field name="code">model.cron_update_branch_list()</field>
@@ -35,8 +31,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3531
<field name="active" eval="False" />
3632
<field name="user_id" ref="base.user_root" />
3733
<field name="interval_type">days</field>
38-
<field name="numbercall">-1</field>
39-
<field name="doall" eval="False" />
4034
<field name="state">code</field>
4135
<field name="model_id" ref="model_github_repository_branch" />
4236
<field name="code">model.cron_download_all()</field>
@@ -47,8 +41,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4741
<field name="active" eval="False" />
4842
<field name="user_id" ref="base.user_root" />
4943
<field name="interval_type">days</field>
50-
<field name="numbercall">-1</field>
51-
<field name="doall" eval="False" />
5244
<field name="state">code</field>
5345
<field name="model_id" ref="model_github_repository_branch" />
5446
<field name="code">model.cron_analyze_all()</field>

github_connector/models/abstract_github_model.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
UnknownObjectException,
1515
)
1616

17-
from odoo import _, api, fields, models, tools
17+
from odoo import api, fields, models, tools
1818
from odoo.exceptions import UserError
1919

2020
_logger = logging.getLogger(__name__)
@@ -36,17 +36,12 @@ class AbstractGithubModel(models.AbstractModel):
3636
_field_list_prevent_overwrite = []
3737

3838
github_id_external = fields.Char(string="Github Id", readonly=True, index=True)
39-
4039
github_name = fields.Char(string="Github Technical Name", readonly=True, index=True)
41-
4240
github_url = fields.Char(string="Github URL", readonly=True)
43-
4441
github_create_date = fields.Datetime(string="Create Date on Github", readonly=True)
45-
4642
github_write_date = fields.Datetime(
4743
string="Last Write Date on Github", readonly=True
4844
)
49-
5045
github_last_sync_date = fields.Datetime(
5146
string="Last Sync Date with Github", readonly=True
5247
)
@@ -55,7 +50,7 @@ class AbstractGithubModel(models.AbstractModel):
5550
def github_login_field(self):
5651
if self._github_login_field is None:
5752
raise UserError(
58-
_(
53+
self.env._(
5954
"Feature not Implemented : Please define 'github_login_field'"
6055
" function in child model."
6156
)
@@ -107,7 +102,7 @@ def get_github_base_obj_for_creation(self):
107102
"""
108103
self.ensure_one()
109104
raise UserError(
110-
_(
105+
self.env._(
111106
"Feature not Implemented : Please define"
112107
" 'get_github_base_obj_for_creation' function in child model."
113108
)
@@ -171,8 +166,10 @@ def _find_existing_object_by_name(self, data):
171166
return existing_objects
172167
elif len(existing_objects) > 1:
173168
raise UserError(
174-
_("Duplicate object with Github login %s")
175-
% (data[self._github_login_field],)
169+
self.env._(
170+
"Duplicate object with Github login %s",
171+
data[self._github_login_field],
172+
)
176173
)
177174
return None
178175

@@ -207,7 +204,7 @@ def create_from_name(self, name):
207204
# Try to get an user.
208205
gh_obj = gh_api.get_user(p_name)
209206
except UnknownObjectException:
210-
raise UserError(_("Invalid name '%s' provided") % name) from None
207+
raise UserError(self.env._("Invalid name '%s' provided", name)) from None
211208
res = self.get_odoo_data_from_github(gh_obj)
212209
# search if ID doesn't exist in database
213210
current_object = self.with_context(active_test=False).search(
@@ -255,9 +252,9 @@ def get_base64_image_from_github(self, url):
255252
stream = urlopen(url, timeout=10).read()
256253
break
257254
except Exception as err:
258-
_logger.warning("URL Call Error. %s" % (err.__str__()))
255+
_logger.warning("URL Call Error. %s", str(err))
259256
else:
260-
raise UserError(_("Maximum attempts reached."))
257+
raise UserError(self.env._("Maximum attempts reached."))
261258
return base64.standard_b64encode(stream)
262259

263260
# Custom Private Function
@@ -293,7 +290,7 @@ def get_github_connector(self):
293290
)
294291
if not token:
295292
raise UserError(
296-
_(
293+
self.env._(
297294
"Please add the 'github_token' in Odoo configuration file"
298295
" or as the 'github.access_token' configuration parameter."
299296
)

0 commit comments

Comments
 (0)