diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f8976b3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# generated from manifests external_dependencies +github3.py diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..66bc2cb --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo_test_helper diff --git a/vcp/README.rst b/vcp/README.rst new file mode 100644 index 0000000..8ebbbed --- /dev/null +++ b/vcp/README.rst @@ -0,0 +1,91 @@ +=== +Vcp +=== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e5814614bba4bc7f628d116d3529a253bb2ae9bff8e8a16c3cfc7eefa5def3cf + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github + :target: https://github.com/OCA/version-control-platform/tree/18.0/vcp + :alt: OCA/version-control-platform +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Creates a set of modules used for handling a version control patform. + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +The aim of this module is to allow any community to import data from a +version control system. + +The system should be done in a way that is agnostic to the system and +the connections are handled directly by specific modules. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Dixmit + +Contributors +------------ + +- `Dixmit `__ + + - Enric Tobella + +- `Akretion `__ + + - Sebastien Beau + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/version-control-platform `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/vcp/__init__.py b/vcp/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/vcp/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/vcp/__manifest__.py b/vcp/__manifest__.py new file mode 100644 index 0000000..0d061e0 --- /dev/null +++ b/vcp/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2025 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Vcp", + "summary": """Virtual Control Platform core module""", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/version-control-platform", + "depends": ["base"], + "data": [ + "security/ir.model.access.csv", + "data/ir_cron.xml", + "views/menu.xml", + "views/vcp_comment.xml", + "views/vcp_review.xml", + "views/vcp_request.xml", + "views/vcp_repository.xml", + "views/vcp_branch.xml", + "views/vcp_platform.xml", + ], + "demo": [], +} diff --git a/vcp/data/ir_cron.xml b/vcp/data/ir_cron.xml new file mode 100644 index 0000000..08a50e6 --- /dev/null +++ b/vcp/data/ir_cron.xml @@ -0,0 +1,23 @@ + + + + + VCP: Repository Update + + code + model._cron_update_repositories() + 1 + minutes + False + + + VCP: Platform Update + + code + model._cron_update_platforms() + 1 + days + False + + diff --git a/vcp/models/__init__.py b/vcp/models/__init__.py new file mode 100644 index 0000000..b0f8a8f --- /dev/null +++ b/vcp/models/__init__.py @@ -0,0 +1,7 @@ +from . import vcp_platform +from . import vcp_branch +from . import vcp_repository +from . import vcp_request +from . import vcp_review +from . import vcp_comment +from . import res_partner diff --git a/vcp/models/res_partner.py b/vcp/models/res_partner.py new file mode 100644 index 0000000..cdecce8 --- /dev/null +++ b/vcp/models/res_partner.py @@ -0,0 +1,66 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import api, fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + vcp_merged_requests = fields.Integer( + compute="_compute_vcp_contributions", + string="Merged Requests", + prefetch=False, + ) + vcp_created_requests = fields.Integer( + compute="_compute_vcp_contributions", + string="Created Requests", + prefetch=False, + ) + vcp_comments = fields.Integer( + compute="_compute_vcp_contributions", string="Comments", prefetch=False + ) + vcp_reviews = fields.Integer( + compute="_compute_vcp_contributions", string="Reviews", prefetch=False + ) + + @api.depends() + def _compute_vcp_contributions(self): + self.filtered(lambda p: p.github_user)._compute_vcp_contributions_field( + "partner_id" + ) + self.filtered(lambda p: not p.github_user)._compute_vcp_contributions_field( + "organization_id" + ) + + @api.model + def _get_contributors_field_map(self): + return { + "vcp_merged_requests": "merged_requests", + "vcp_created_requests": "created_requests", + "vcp_comments": "comments", + "vcp_reviews": "reviews", + } + + def _compute_vcp_contributions_field(self, field): + today = fields.Date.today() + start, end = self.env["vcp.platform"]._get_dates(today.year, today.month, "MAT") + data = ( + self.env["vcp.platform"] + .search([]) + ._generate_data( + start=start, end=end, field=field, kind="user", extra_domain=[] + ) + ) + field_map = self._get_contributors_field_map() + for partner in self: + partner.update( + {key: data[partner.id].get(field_map[key], 0) for key in field_map} + ) + + def _get_contributor_url(self): + return False + + def _get_contributors_name(self, kind, **kwargs): + return self.name diff --git a/vcp/models/vcp_branch.py b/vcp/models/vcp_branch.py new file mode 100644 index 0000000..023803a --- /dev/null +++ b/vcp/models/vcp_branch.py @@ -0,0 +1,19 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class VcpBranch(models.Model): + _name = "vcp.branch" + _description = "Branch" + + name = fields.Char(required=True) + platform_id = fields.Many2one( + comodel_name="vcp.platform", + string="Platform", + required=True, + ) + _sql_constraints = [ + ("name_uniq", "unique(name, platform_id)", "Branch name must be unique.") + ] diff --git a/vcp/models/vcp_comment.py b/vcp/models/vcp_comment.py new file mode 100644 index 0000000..31ffcd7 --- /dev/null +++ b/vcp/models/vcp_comment.py @@ -0,0 +1,36 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class VcpComment(models.Model): + _name = "vcp.comment" + _description = "Comment" + + external_id = fields.Char(readonly=True, required=True, index=True) + body = fields.Html(readonly=True) + partner_id = fields.Many2one( + comodel_name="res.partner", + readonly=True, + ) + organization_id = fields.Many2one( + related="request_id.organization_id", + readonly=True, + store=True, + ) + repository_id = fields.Many2one( + related="request_id.repository_id", + readonly=True, + store=True, + ) + created_at = fields.Datetime(readonly=True) + updated_at = fields.Datetime(readonly=True) + request_id = fields.Many2one( + comodel_name="vcp.request", + string="Request", + readonly=True, + ) + _sql_constraints = [ + ("external_id_uniq", "unique(external_id)", "External ID must be unique.") + ] diff --git a/vcp/models/vcp_platform.py b/vcp/models/vcp_platform.py new file mode 100644 index 0000000..8d6e3d7 --- /dev/null +++ b/vcp/models/vcp_platform.py @@ -0,0 +1,219 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging +from collections import defaultdict +from datetime import datetime + +from dateutil.relativedelta import relativedelta + +from odoo import fields, models, tools + +_logger = logging.getLogger(__name__) + + +class VCPPlatform(models.Model): + """ + This model should define how to interact with a Version Control Platform + (VCP) such as GitHub, GitLab, etc. + 1 platform should correspond to 1 organization/account on the VCP. + """ + + _name = "vcp.platform" + _description = "VCP Platform" + + name = fields.Char(required=True) + description = fields.Char(readonly=True) + short_description = fields.Char(readonly=True) + last_update = fields.Datetime(readonly=True) + active = fields.Boolean(default=True) + update_interval_days = fields.Integer(default=3) + image_1920 = fields.Image() + branch_ids = fields.One2many( + "vcp.branch", + inverse_name="platform_id", + ) + image_128 = fields.Image( + max_width=128, + max_height=128, + store=True, + related="image_1920", + string="Image 128", + ) + image_64 = fields.Image( + max_width=64, max_height=64, store=True, related="image_1920", string="Image 64" + ) + kind = fields.Selection([], required=True) + key_ids = fields.One2many( + comodel_name="vcp.platform.key", + inverse_name="platform_id", + string="API Keys", + ) + repository_ids = fields.One2many( + "vcp.repository", + inverse_name="platform_id", + ) + + def update_information(self): + self.ensure_one() + getattr(self, f"_update_information_{self.kind}")() + self.last_update = fields.Datetime.now() + + def _cron_update_platforms(self): + for organization in self.search([]): + try: + organization.update_information() + except Exception as e: + _logger.error( + "Error updating organization %s: %s", organization.name, str(e) + ) + + @tools.ormcache("self.id", "name") + def _get_branch(self, name): + self.ensure_one() + branch = self.env["vcp.branch"].search( + [("platform_id", "=", self.id), ("name", "=", name)], + limit=1, + ) + if not branch: + branch = ( + self.env["vcp.branch"] + .sudo() + .create( + { + "platform_id": self.id, + "name": name, + } + ) + ) + return branch.id + + def _get_merged_domain(self, start, end, **values): + return [ + ("repository_id.platform_id", "in", self.ids), + ("is_merged", "=", True), + ("closed_at", ">=", start), + ("closed_at", "<", end), + ] + + def _get_created_domain(self, start, end, **values): + return [ + ("repository_id.platform_id", "in", self.ids), + ("created_at", ">=", start), + ("created_at", "<", end), + ] + + def _get_comments_domain(self, start, end, **values): + return [ + ("request_id.repository_id.platform_id", "in", self.ids), + ("created_at", ">=", start), + ("created_at", "<", end), + ] + + def _get_reviews_domain(self, start, end, **values): + return [ + ("request_id.repository_id.platform_id", "in", self.ids), + ("submitted_at", ">=", start), + ("submitted_at", "<", end), + ] + + def _get_default_data(self, start, end, field, kind, **values): + return { + "name": "", + "github_name": "", + "created_requests": 0, + "merged_requests": 0, + "comments": 0, + "reviews": 0, + "developers": 0, + } + + def _generate_data(self, start, end, field, kind, extra_domain=None, **values): + if extra_domain is None: + extra_domain = [] + default_dict = self._get_default_data(start, end, field, kind, **values) + data = defaultdict(lambda: default_dict.copy()) + if not field: + return data + for merged in ( + self.env["vcp.request"] + .sudo() + .read_group( + self._get_merged_domain(start, end, **values) + + extra_domain + + [(field, "!=", False)], + [field], + [field], + ) + ): + data[merged[field][0]]["merged_requests"] = merged[f"{field}_count"] + for pr in ( + self.env["vcp.request"] + .sudo() + .read_group( + self._get_created_domain(start, end, **values) + + extra_domain + + [(field, "!=", False)], + [field, "partner_id:count_distinct"] + if field != "partner_id" + else [field], + [field], + ) + ): + data[pr[field][0]]["created_requests"] = pr[f"{field}_count"] + if field != "partner_id": + data[pr[field][0]]["developers"] = pr["partner_id"] + for comment in ( + self.env["vcp.comment"] + .sudo() + .read_group( + self._get_comments_domain(start, end, **values) + + extra_domain + + [(field, "!=", False)], + [field], + [field], + ) + ): + data[comment[field][0]]["comments"] = comment[f"{field}_count"] + for review in ( + self.env["vcp.review"] + .sudo() + .read_group( + self._get_reviews_domain(start, end, **values) + + extra_domain + + [(field, "!=", False)], + [field], + [field], + ) + ): + data[review[field][0]]["reviews"] = review[f"{field}_count"] + return data + + def _get_dates(self, year, month, period, **values): + if month == 12: + end = datetime(year + 1, 1, 1, 0, 0, 0) + else: + end = datetime(year, month + 1, 1, 0, 0, 0) + if period == "YTD": + start = datetime(year, 1, 1, 0, 0, 0) + elif period == "MAT": + start = end - relativedelta(years=1) + else: + start = datetime(year, month, 1, 0, 0, 0) + return start, end + + +class VcpPlatformKey(models.Model): + _name = "vcp.platform.key" + _description = "VCP Platform API Key" # TODO + + platform_id = fields.Many2one( + comodel_name="vcp.platform", + string="Platform", + required=True, + ondelete="cascade", + ) + name = fields.Char(required=True) + + _sql_constraints = [ + ("name_uniq", "unique(name, platform_id)", "API Key must be unique.") + ] diff --git a/vcp/models/vcp_repository.py b/vcp/models/vcp_repository.py new file mode 100644 index 0000000..7778659 --- /dev/null +++ b/vcp/models/vcp_repository.py @@ -0,0 +1,47 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class VcpRepository(models.Model): + _name = "vcp.repository" + _description = "Repository" + + name = fields.Char(required=True, index=True) + description = fields.Char(readonly=True) + platform_id = fields.Many2one( + comodel_name="vcp.platform", + required=True, + ) + created_at = fields.Datetime(readonly=True) + stargazers_count = fields.Integer(readonly=True) + fork_count = fields.Integer(readonly=True) + watchers_count = fields.Integer(readonly=True) + from_date = fields.Datetime(readonly=True, required=True) + request_ids = fields.One2many("vcp.request", inverse_name="repository_id") + request_count = fields.Integer(compute="_compute_request_count") + active = fields.Boolean(default=True) + + @api.depends("request_ids") + def _compute_request_count(self): + for record in self: + record.request_count = len(record.request_ids) + + def force_update_information(self): + self.update_information(update_interval_days=365) + + def update_information(self, update_interval_days=None): + self.ensure_one() + getattr(self, f"_update_information_{self.platform_id.kind}")( + update_interval_days=update_interval_days + ) + + def _cron_update_repositories(self, limit=1): + repositories = self.search([], limit=limit, order="from_date ASC") + for repository in repositories: + repository.update_information() + + def _get_repository_url(self): + self.ensure_one() + return False diff --git a/vcp/models/vcp_request.py b/vcp/models/vcp_request.py new file mode 100644 index 0000000..f5855b2 --- /dev/null +++ b/vcp/models/vcp_request.py @@ -0,0 +1,68 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models, tools + + +class VcpRequest(models.Model): + _name = "vcp.request" + _description = "Code Request" + + external_id = fields.Char(string="Externa ID", readonly=True, index=True) + name = fields.Char(readonly=True) + partner_id = fields.Many2one( + comodel_name="res.partner", + string="Contributor", + readonly=True, + ) + repository_id = fields.Many2one( + comodel_name="vcp.repository", + readonly=True, + ondelete="cascade", + ) + branch_id = fields.Many2one( + comodel_name="vcp.branch", + readonly=True, + ondelete="restrict", + ) + organization_id = fields.Many2one( + comodel_name="res.partner", + readonly=True, + ) + url = fields.Char(readonly=True) + state = fields.Char(readonly=True) + is_merged = fields.Boolean(readonly=True) + created_at = fields.Datetime(readonly=True) + updated_at = fields.Datetime(readonly=True) + closed_at = fields.Datetime(readonly=True) + number = fields.Integer(readonly=True) + label_ids = fields.Many2many( + comodel_name="vcp.request.label", + string="Labels", + readonly=True, + ) + commits = fields.Integer(readonly=True) + additions = fields.Integer(readonly=True) + deletions = fields.Integer(readonly=True) + total_comments = fields.Integer(readonly=True) + review_comments = fields.Integer(readonly=True) + + _sql_constraints = [ + ("external_id_uniq", "unique(external_id)", "External ID must be unique.") + ] + + +class VcpRequestLabel(models.Model): + _name = "vcp.request.label" + _description = "Vcp Request Label" + + name = fields.Char(required=True) + + _sql_constraints = [("name_uniq", "unique(name)", "Label name must be unique.")] + + @tools.ormcache("name") + def _get_label(self, name): + label = self.search([("name", "=", name)], limit=1) + if not label: + label = self.sudo().create({"name": name}) + return label.id diff --git a/vcp/models/vcp_review.py b/vcp/models/vcp_review.py new file mode 100644 index 0000000..c81ba05 --- /dev/null +++ b/vcp/models/vcp_review.py @@ -0,0 +1,38 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class VcpReview(models.Model): + _name = "vcp.review" + _description = "Review" # TODO + + external_id = fields.Char(readonly=True, required=True, index=True) + body = fields.Html(readonly=True) + state = fields.Char(readonly=True) + partner_id = fields.Many2one("res.partner", readonly=True) + submitted_at = fields.Datetime(readonly=True) + repository_id = fields.Many2one( + related="request_id.repository_id", + readonly=True, + store=True, + ) + request_id = fields.Many2one( + "vcp.request", + readonly=True, + ) + organization_id = fields.Many2one( + related="request_id.organization_id", + readonly=True, + store=True, + ) + platform_id = fields.Many2one( + related="request_id.repository_id.platform_id", + readonly=True, + store=True, + ) + + _sql_constraints = [ + ("external_id_uniq", "unique(external_id)", "External ID must be unique.") + ] diff --git a/vcp/pyproject.toml b/vcp/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/vcp/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/vcp/readme/CONTEXT.md b/vcp/readme/CONTEXT.md new file mode 100644 index 0000000..1c22f75 --- /dev/null +++ b/vcp/readme/CONTEXT.md @@ -0,0 +1,3 @@ +The aim of this module is to allow any community to import data from a version control system. + +The system should be done in a way that is agnostic to the system and the connections are handled directly by specific modules. diff --git a/vcp/readme/CONTRIBUTORS.md b/vcp/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..579d94d --- /dev/null +++ b/vcp/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Dixmit](https://dixmit.com) + - Enric Tobella + +- [Akretion](https://akretion.com) + - Sebastien Beau diff --git a/vcp/readme/DESCRIPTION.md b/vcp/readme/DESCRIPTION.md new file mode 100644 index 0000000..f05f973 --- /dev/null +++ b/vcp/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Creates a set of modules used for handling a version control patform. diff --git a/vcp/security/ir.model.access.csv b/vcp/security/ir.model.access.csv new file mode 100644 index 0000000..34d58cd --- /dev/null +++ b/vcp/security/ir.model.access.csv @@ -0,0 +1,11 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +access_vcp_platform,Access Platform,model_vcp_platform,base.group_user,1,0,0,0 +access_vcp_platform_portal,Access Platform from Portal,model_vcp_platform,base.group_portal,1,0,0,0 +manage_vcp_platform,Manage Platform,model_vcp_platform,base.group_system,1,1,1,0 +manage_vcp_platform_key,Manage Platform Keys,model_vcp_platform_key,base.group_system,1,1,1,1 +access_branch,Access Branch,model_vcp_branch,base.group_user,1,0,0,0 +access_repository,Access Repository,model_vcp_repository,base.group_user,1,0,0,0 +access_request,Access Pull Requests,model_vcp_request,base.group_user,1,0,0,0 +access_request_label,Access Pull Requests Labels,model_vcp_request_label,base.group_user,1,0,0,0 +access_review,Access Reviews,model_vcp_review,base.group_user,1,0,0,0 +access_comment,Access Comments,model_vcp_comment,base.group_user,1,0,0,0 diff --git a/vcp/static/description/icon.png b/vcp/static/description/icon.png new file mode 100644 index 0000000..1fece97 Binary files /dev/null and b/vcp/static/description/icon.png differ diff --git a/vcp/static/description/icon.svg b/vcp/static/description/icon.svg new file mode 100644 index 0000000..261d62c --- /dev/null +++ b/vcp/static/description/icon.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + diff --git a/vcp/static/description/index.html b/vcp/static/description/index.html new file mode 100644 index 0000000..19cb1b8 --- /dev/null +++ b/vcp/static/description/index.html @@ -0,0 +1,438 @@ + + + + + +Vcp + + + +
+

Vcp

+ + +

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

Creates a set of modules used for handling a version control patform.

+

Table of contents

+ +
+

Use Cases / Context

+

The aim of this module is to allow any community to import data from a +version control system.

+

The system should be done in a way that is agnostic to the system and +the connections are handled directly by specific modules.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Dixmit
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/version-control-platform project on GitHub.

+

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

+
+
+
+ + diff --git a/vcp/tests/__init__.py b/vcp/tests/__init__.py new file mode 100644 index 0000000..02bd456 --- /dev/null +++ b/vcp/tests/__init__.py @@ -0,0 +1 @@ +from . import test_base diff --git a/vcp/tests/models/__init__.py b/vcp/tests/models/__init__.py new file mode 100644 index 0000000..ccba792 --- /dev/null +++ b/vcp/tests/models/__init__.py @@ -0,0 +1 @@ +from . import vcp_platform diff --git a/vcp/tests/models/vcp_platform.py b/vcp/tests/models/vcp_platform.py new file mode 100644 index 0000000..c37936e --- /dev/null +++ b/vcp/tests/models/vcp_platform.py @@ -0,0 +1,16 @@ +# Copyright 2026 GRAP +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + +from odoo import fields, models + +_logger = logging.getLogger(__name__) + + +class VCPPlatform(models.Model): + _inherit = "vcp.platform" + + kind = fields.Selection( + selection_add=[("dummy", "Dummy Value")], + ondelete={"dummy": "cascade"}, + ) diff --git a/vcp/tests/test_base.py b/vcp/tests/test_base.py new file mode 100644 index 0000000..05117da --- /dev/null +++ b/vcp/tests/test_base.py @@ -0,0 +1,132 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from datetime import timedelta + +from odoo_test_helper import FakeModelLoader + +from odoo.fields import Date +from odoo.tests import tagged + +from odoo.addons.base.tests.common import HttpCaseWithUserDemo, HttpCaseWithUserPortal + + +@tagged("post_install", "-at_install") +class TestBase(HttpCaseWithUserDemo, HttpCaseWithUserPortal): + @classmethod + def setUpClass(cls): + super().setUpClass() + # Load fake order model + cls.loader = FakeModelLoader(cls.env, cls.__module__) + cls.loader.backup_registry() + from .models.vcp_platform import VCPPlatform + + cls.loader.update_registry((VCPPlatform,)) + + # be sure some expected values are set otherwise homepage may fail + date = Date.today() + date = date - timedelta(days=date.day) + cls.partner_portal.write( + { + "city": "Bayonne", + "company_name": "YourCompany", + "country_id": cls.env.ref("base.us").id, + "phone": "(683)-556-5104", + "street": "858 Lynn Street", + "zip": "07002", + } + ) + platform = cls.env["vcp.platform"].create( + { + "name": "oca", + "short_description": "OCA", + "description": "OCA", + "kind": "dummy", + } + ) + repository = cls.env["vcp.repository"].create( + { + "name": "contributors-module", + "description": "OCA/contributors-module", + "platform_id": platform.id, + "from_date": date, + } + ) + user_01 = cls.env["res.partner"].create( + { + "name": "Enric Tobella", + } + ) + user_02 = cls.env["res.partner"].create( + { + "name": "Luis Rodriguez", + } + ) + user_03 = cls.env["res.partner"].create( + { + "name": "Jordi Ballester", + } + ) + org_01 = cls.env["res.partner"].create( + { + "name": "Dixmit", + } + ) + org_02 = cls.env["res.partner"].create( + { + "name": "ForgeFlow", + } + ) + pull_request_01 = cls.env["vcp.request"].create( + { + "external_id": 1, + "name": "Test PR", + "repository_id": repository.id, + "partner_id": user_01.id, + "organization_id": org_01.id, + "created_at": date, + "closed_at": date, + "is_merged": True, + } + ) + cls.env["vcp.request"].create( + { + "external_id": 2, + "name": "Test PR", + "repository_id": repository.id, + "partner_id": user_02.id, + "organization_id": org_01.id, + "created_at": date, + "is_merged": False, + } + ) + cls.env["vcp.request"].create( + { + "external_id": 3, + "name": "Test PR", + "repository_id": repository.id, + "partner_id": user_03.id, + "organization_id": org_02.id, + "created_at": date, + "is_merged": False, + } + ) + cls.env["vcp.review"].create( + { + "external_id": 1, + "body": "Test Review", + "state": "APPROVED", + "request_id": pull_request_01.id, + "partner_id": user_01.id, + "submitted_at": date, + } + ) + cls.env["vcp.comment"].create( + { + "external_id": 1, + "body": "Test Comment", + "request_id": pull_request_01.id, + "partner_id": user_01.id, + "created_at": date, + } + ) diff --git a/vcp/views/menu.xml b/vcp/views/menu.xml new file mode 100644 index 0000000..ae210f4 --- /dev/null +++ b/vcp/views/menu.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/vcp/views/vcp_branch.xml b/vcp/views/vcp_branch.xml new file mode 100644 index 0000000..f5b6041 --- /dev/null +++ b/vcp/views/vcp_branch.xml @@ -0,0 +1,27 @@ + + + + + vcp.branch + +
+
+ + + + + + + + + + + vcp.branch + + + + + + + diff --git a/vcp/views/vcp_comment.xml b/vcp/views/vcp_comment.xml new file mode 100644 index 0000000..c43cec9 --- /dev/null +++ b/vcp/views/vcp_comment.xml @@ -0,0 +1,26 @@ + + + + + vcp.comment + +
+
+ + + + + + + + + + vcp.comment + + + + + + + diff --git a/vcp/views/vcp_platform.xml b/vcp/views/vcp_platform.xml new file mode 100644 index 0000000..39c5959 --- /dev/null +++ b/vcp/views/vcp_platform.xml @@ -0,0 +1,83 @@ + + + + + vcp.platform + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + vcp.platform + + + + + + + + + + vcp.platform + + + + + + + + + Platforms + vcp-platforms + vcp.platform + list,form + [] + {} + + + + Platforms + + + + + diff --git a/vcp/views/vcp_repository.xml b/vcp/views/vcp_repository.xml new file mode 100644 index 0000000..ca431aa --- /dev/null +++ b/vcp/views/vcp_repository.xml @@ -0,0 +1,102 @@ + + + + + vcp.repository + +
+
+
+ +
+ + + + +
+ + + + + +
+
+
+
+ + + vcp.repository + + + + + + + + + + vcp.repository + + + + + + + + + + + + Repositories + vcp-repositories + vcp.repository + list,form + [] + {} + + + + Repositories + + + + +
diff --git a/vcp/views/vcp_request.xml b/vcp/views/vcp_request.xml new file mode 100644 index 0000000..fd7b5ee --- /dev/null +++ b/vcp/views/vcp_request.xml @@ -0,0 +1,92 @@ + + + + + vcp.request + +
+
+ + + + + + + + + + + + + + + + + + + + + + + vcp.request + + + + + + + + + + + + + vcp.request + + + + + + + + + + + + + + Requests + vcp-requests + vcp.request + list,form + [] + {} + + + + Requests + vcp-platform-requests + vcp.request + list,form + [("repository_id", "=", active_id)] + {} + + + + Requests + + + + + diff --git a/vcp/views/vcp_review.xml b/vcp/views/vcp_review.xml new file mode 100644 index 0000000..6c20335 --- /dev/null +++ b/vcp/views/vcp_review.xml @@ -0,0 +1,27 @@ + + + + + vcp.review + +
+
+ + + + + + + + + + + vcp.review + + + + + + + diff --git a/vcp_github/README.rst b/vcp_github/README.rst new file mode 100644 index 0000000..07627b8 --- /dev/null +++ b/vcp_github/README.rst @@ -0,0 +1,211 @@ +========== +Vcp Github +========== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:086596db3dcb4fa7565fc97cf01ccd22449731243622d4587a1f609eab8bc121 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github + :target: https://github.com/OCA/version-control-platform/tree/18.0/vcp_github + :alt: OCA/version-control-platform +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp_github + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +[ This file must be max 2-3 paragraphs, and is required. + +The goal of this document is to explain quickly the features of this +module: “what” this module does and “what” it is for. ] + +Example: + +This module extends the functionality of ... to support ... and to allow +users to ... + +**Table of contents** + +.. contents:: + :local: + +Use Cases / Context +=================== + +[ This file is optional but strongly suggested to allow end-users to +evaluate the module's usefulness in their context. ] + +BUSINESS NEED: It should explain the “why” of the module: + +- what is the business requirement that generated the need to develop + this module +- in which context or use cases this module can be useful (practical + examples are welcome!). + +APPROACH: It could also explain the approach to address the mentioned +need. + +USEFUL INFORMATION: It can also inform on related modules: + +- modules it depends on and their features +- other modules that can work well together with this one +- suggested setups where the module is useful (eg: multicompany, + multi-website) + +Installation +============ + +[ This file must only be present if there are very specific installation +instructions, such as installing non-python dependencies. The audience +is systems administrators. ] + +To install this module, you need to: + +1. Do this ... + +Configuration +============= + +[ This file is not always required; it should explain **how to configure +the module before using it**; it is aimed at users with administration +privileges. + +Please be detailed on the path to configuration (eg: do you need to +activate developer mode?), describe step by step configurations and the +use of screenshots is strongly recommended.] + +To configure this module, you need to: + +- Go to *App* > Menu > Menu item +- Activate boolean… > save +- … + +Usage +===== + +[ This file is required and contains the instructions on **“how”** to +use the module for end-users. + +If the module does not have a visible impact on the user interface, just +add the following sentence: + + This module does not impact the user interface. + +If that’s not the case, please make sure that every usage step is +covered and remember that images speak more than words!] + +To use this module, you need to: + +- Go to *App* > Menu > Menu item + + *insert screenshot!* + +- In “Contact” form, add a value to field *xyz* > save + + *insert screenshot!* + +- The value of *xyz* is now displayed in the list view. + + *insert screenshot!* + +Known issues / Roadmap +====================== + +[ Enumerate known caveats and future potential improvements. It is +mostly intended for end-users, and can also help potential new +contributors discovering new features to implement. ] + +- ... + +Changelog +========= + +[ The change log. The goal of this file is to help readers understand +changes between version. The primary audience is end users and +integrators. Purely technical changes such as code refactoring must not +be mentioned here. + +This file may contain ONE level of section titles, underlined with the ~ +(tilde) character. Other section markers are forbidden and will likely +break the structure of the README.rst or other documents where this +fragment is included. ] + +11.0.x.y.z (YYYY-MM-DD) +----------------------- + +- [BREAKING] Breaking changes come first. + (`#70 `__) +- [ADD] New feature. (`#74 `__) +- [FIX] Correct this. (`#71 `__) + +11.0.x.y.z (YYYY-MM-DD) +----------------------- + +- ... + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Dixmit + +Contributors +------------ + +- Firstname Lastname email.address@example.org (optional company website + url) +- Second Person second.person@example.org (optional company website url) + +Other credits +------------- + +[ This file is optional and contains additional credits, other than +authors, contributors, and maintainers. ] + +The development of this module has been financially supported by: + +- Company 1 name +- Company 2 name + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/version-control-platform `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/vcp_github/__init__.py b/vcp_github/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/vcp_github/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/vcp_github/__manifest__.py b/vcp_github/__manifest__.py new file mode 100644 index 0000000..9ddb87a --- /dev/null +++ b/vcp_github/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Vcp Github", + "summary": """Integrate Virtual Control Platform with Github""", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/version-control-platform", + "depends": [ + "vcp", + ], + "external_dependencies": { + "python": ["github3.py"], + }, + "data": [], + "demo": [], +} diff --git a/vcp_github/models/__init__.py b/vcp_github/models/__init__.py new file mode 100644 index 0000000..8fe49b4 --- /dev/null +++ b/vcp_github/models/__init__.py @@ -0,0 +1,3 @@ +from . import vcp_platform +from . import vcp_repository +from . import res_partner diff --git a/vcp_github/models/res_partner.py b/vcp_github/models/res_partner.py new file mode 100644 index 0000000..f46fed1 --- /dev/null +++ b/vcp_github/models/res_partner.py @@ -0,0 +1,123 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import github3 + +from odoo import fields, models, tools + + +class ResPartner(models.Model): + _inherit = "res.partner" + + github_name = fields.Char( + string="GitHub Username", + help="GitHub username of the contributor or organization", + readonly=True, + ) + github_organization = fields.Boolean( + string="Is GitHub Organization", + help="Check if this partner represents a GitHub organization", + readonly=True, + ) + github_user = fields.Boolean( + string="Is GitHub User", + help="Check if this partner represents a GitHub user", + readonly=True, + ) + + _sql_constraints = [ + ( + "github_name_uniq", + "unique(github_name)", + "The GitHub username must be unique across partners.", + ), + ] + + @tools.ormcache("github_login") + def _get_github_user_id(self, github_login): + partner = self.with_context(active_test=False).search( + [("github_name", "=ilike", github_login)], limit=1 + ) + if not partner: + return False + if not partner.github_user: + partner.github_user = True + return partner.id + + @tools.ormcache("github_login") + def _get_github_organization_id(self, github_login): + partner = self.with_context(active_test=False).search( + [("github_name", "=ilike", github_login)], limit=1 + ) + if not partner: + return False + if not partner.github_organization: + partner.github_organization = True + return partner.id + + def _get_github_user(self, gh, client): + if not gh: + return False + if isinstance(gh, github3.users.User): + github_login = gh.login + else: + github_login = str(gh) + partner = self._get_github_user_id(github_login) + if partner: + return partner + if isinstance(gh, str): + try: + gh = client.user(github_login) + name = gh.name or github_login + except github3.exceptions.NotFoundError: + name = gh + else: + if hasattr(gh, "name"): + name = gh.name or github_login + else: + name = github_login + self.env.registry.clear_cache() + return self.create( + { + "name": name, + "github_name": github_login, + "github_user": True, + } + ).id + + def _get_github_organization(self, gh, client): + if not gh: + return False + partner = self._get_github_organization_id(str(gh)) + if partner: + return partner + self.env.registry.clear_cache() + try: + org = client.organization(str(gh)) + + return self.create( + { + "name": org.name or str(gh), + "github_name": str(gh), + "github_organization": True, + } + ).id + except github3.exceptions.NotFoundError: + user = client.user(str(gh)) + name = user.name or str(gh) + except github3.exceptions.ForbiddenError: + name = str(gh) + return self.create( + { + "name": name, + "github_name": str(gh), + "github_user": True, + "github_organization": True, + } + ).id + + def _get_contributor_url(self): + result = super()._get_contributor_url() + if not result and self.github_name: + return f"https://github.com/{self.github_name}" + return result diff --git a/vcp_github/models/vcp_platform.py b/vcp_github/models/vcp_platform.py new file mode 100644 index 0000000..ddd91c7 --- /dev/null +++ b/vcp_github/models/vcp_platform.py @@ -0,0 +1,84 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import base64 +from datetime import datetime + +import github3 +import requests +from pytz import UTC + +from odoo import _, fields, models +from odoo.exceptions import ValidationError + + +class VcpPlatform(models.Model): + _inherit = "vcp.platform" + + kind = fields.Selection( + selection_add=[("github", "GitHub")], + ondelete={"github": "cascade"}, + ) + + def _get_github_clients(self): + git = [] + for key in self.key_ids: + git.append(github3.login(token=key.name)) + return git + + def _update_information_github(self): + self.ensure_one() + clients = self._get_github_clients() + if not clients: + raise ValidationError( + _("No github clients configured. Please enter at least an API Key.") + ) + org = clients[0].organization(self.name) + self.short_description = org.name + self.description = org.description + if org.avatar_url: + response = requests.get(org.avatar_url, timeout=10) + response.raise_for_status() + self.image_1920 = base64.b64encode(response.content) + repos = org.repositories() + for repo in repos: + self._update_github_repository(repo) + self.last_update = fields.Datetime.now() + + def _parse_github_date(self, date): + if not date: + return False + return UTC.normalize( + datetime.fromisoformat(date.replace("Z", "+00:00")) + ).replace(tzinfo=None) + + def _update_github_repository(self, repo): + vals = { + "created_at": self._parse_github_date(repo.created_at), + "stargazers_count": repo.stargazers_count, + "fork_count": repo.forks_count, + "watchers_count": repo.watchers_count, + "description": repo.description, + } + repository = self.env["vcp.repository"].search( + [ + ("name", "=", repo.name), + ("platform_id", "=", self.id), + ], + limit=1, + ) + if not repository: + repository = ( + self.env["vcp.repository"] + .sudo() + .create( + { + "name": repo.name, + "platform_id": self.id, + "from_date": vals.get("created_at"), + **vals, + } + ) + ) + else: + repository.sudo().write(vals) diff --git a/vcp_github/models/vcp_repository.py b/vcp_github/models/vcp_repository.py new file mode 100644 index 0000000..6d1630a --- /dev/null +++ b/vcp_github/models/vcp_repository.py @@ -0,0 +1,193 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging +from datetime import datetime, timedelta + +import github3 +from github3 import pulls +from pytz import UTC + +from odoo import fields, models +from odoo.exceptions import ValidationError + +_logger = logging.getLogger(__name__) + + +class VcpRepository(models.Model): + _inherit = "vcp.repository" + + def _parse_github_pr(self, pr, client): + origin_data = pr.as_dict() + comments_url = pr.comments_url + comments_req = client.session.get(comments_url) + comments = comments_req.json() + while comments_req.links.get("next"): + comments_url = comments_req.links["next"]["url"] + comments_req = client.session.get(comments_url) + comments += comments_req.json() + reviews_url = pr.reviews().url + reviews_req = client.session.get(reviews_url) + reviews = reviews_req.json() + while reviews_req.links.get("next"): + reviews_url = reviews_req.links["next"]["url"] + reviews_req = client.session.get(reviews_url) + reviews += reviews_req.json() + return ( + str(pr.id), + { + "partner_id": self.env["res.partner"]._get_github_user(pr.user, client), + "repository_id": self.id, + "branch_id": self.platform_id._get_branch(pr.base.ref), + "organization_id": self.env["res.partner"]._get_github_organization( + pr.head.repo[0], client + ), + "url": pr.html_url, + "state": pr.state, + "name": pr.title, + "is_merged": any(label["name"] == "merged 🎉" for label in pr.labels) + or pr.is_merged(), + "created_at": self.platform_id._parse_github_date( + origin_data["created_at"] + ), + "closed_at": self.platform_id._parse_github_date( + origin_data["closed_at"] + ), + "number": pr.number, + "updated_at": self.platform_id._parse_github_date( + origin_data["updated_at"] + ), + "label_ids": [fields.Command.clear()] + + [ + fields.Command.link( + self.env["vcp.request.label"]._get_label(label["name"]) + ) + for label in origin_data["labels"] + ], + "commits": origin_data["commits"], + "total_comments": origin_data["comments"], + "review_comments": origin_data["review_comments"], + "additions": origin_data["additions"], + "deletions": origin_data["deletions"], + }, + [ + { + "id": str(c["id"]), + "partner_id": c.get("user") + and self.env["res.partner"]._get_github_user( + c["user"].get("login"), client + ), + "body": c["body"], + "created_at": self.platform_id._parse_github_date(c["created_at"]), + "updated_at": self.platform_id._parse_github_date(c["updated_at"]), + } + for c in comments + ], + [ + { + "id": str(r["id"]), + "partner_id": r.get("user") + and self.env["res.partner"]._get_github_user( + r["user"].get("login"), client + ), + "body": r["body"], + "submitted_at": self.platform_id._parse_github_date( + r.get("submitted_at") + ), + "state": r["state"]["keyword"] + if isinstance(r["state"], dict) + else r["state"], + } + for r in reviews + ], + ) + + def _update_information_github( + self, update_interval_days=None, client_for_search=0 + ): + self.ensure_one() + clients = self.platform_id._get_github_clients() + try: + start = UTC.localize(self.from_date) + end = min( + start + + timedelta( + days=update_interval_days or self.platform_id.update_interval_days + ), + UTC.localize(datetime.now()), + ) + start += timedelta( + days=-1 + ) # Add buffer day to avoid missing PRs on boundary dates + i = client_for_search % len(clients) + for pr in clients[i].search_issues( + f"is:pr repo:{self.platform_id.name}/{self.name} " + f"updated:{start.isoformat()}..{end.isoformat()}" + ): + i = (1 + i) % len(clients) + pr_id, pr_data, comments, reviews = self._parse_github_pr( + clients[i]._instance_or_null( + pulls.PullRequest, + clients[i]._json( + pr.issue._get(pr.issue.pull_request_urls.get("url")), 200 + ), + ), + clients[i], + ) + opr = self.env["vcp.request"].search( + [("external_id", "=", pr_id), ("repository_id", "=", self.id)], + limit=1, + ) + if not opr: + opr = ( + self.env["vcp.request"] + .sudo() + .create({"external_id": pr_id, **pr_data}) + ) + else: + opr.sudo().write(pr_data) + for comment in comments: + comment_id = comment.pop("id") + ocomment = self.env["vcp.comment"].search( + [ + ("external_id", "=", comment_id), + ("repository_id", "=", self.id), + ], + limit=1, + ) + if not ocomment: + self.env["vcp.comment"].sudo().create( + { + "external_id": comment_id, + "request_id": opr.id, + **comment, + } + ) + else: + ocomment.sudo().write(comment) + for review in reviews: + review_id = review.pop("id") + oreview = self.env["vcp.review"].search( + [ + ("external_id", "=", review_id), + ("repository_id", "=", self.id), + ], + limit=1, + ) + if not oreview: + self.env["vcp.review"].sudo().create( + { + "external_id": review_id, + "request_id": opr.id, + **review, + } + ) + else: + oreview.sudo().write(review) + self.sudo().from_date = end.replace(tzinfo=None) + except github3.exceptions.ForbiddenError as e: + _logger.error(e) + rate = clients[i].rate_limit() + reset = fields.Datetime.to_string( + datetime.utcfromtimestamp(rate["resources"]["core"]["reset"]) + ) + raise ValidationError(self.env._(f"Reset on {reset}")) from e diff --git a/vcp_github/pyproject.toml b/vcp_github/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/vcp_github/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/vcp_github/readme/CONFIGURE.md b/vcp_github/readme/CONFIGURE.md new file mode 100644 index 0000000..2fdb0e6 --- /dev/null +++ b/vcp_github/readme/CONFIGURE.md @@ -0,0 +1,10 @@ +[ This file is not always required; it should explain **how to configure the module before using it**; it is aimed at users with administration privileges. + +Please be detailed on the path to configuration (eg: do you need to activate developer mode?), describe step by step configurations and the use of screenshots is strongly recommended.] + + +To configure this module, you need to: + +- Go to *App* > Menu > Menu item +- Activate boolean… > save +- … diff --git a/vcp_github/readme/CONTEXT.md b/vcp_github/readme/CONTEXT.md new file mode 100644 index 0000000..096235a --- /dev/null +++ b/vcp_github/readme/CONTEXT.md @@ -0,0 +1,16 @@ +[ This file is optional but strongly suggested to allow end-users to evaluate the +module's usefulness in their context. ] + +BUSINESS NEED: +It should explain the “why” of the module: +- what is the business requirement that generated the need to develop this module +- in which context or use cases this module can be useful (practical examples are welcome!). + +APPROACH: +It could also explain the approach to address the mentioned need. + +USEFUL INFORMATION: +It can also inform on related modules: +- modules it depends on and their features +- other modules that can work well together with this one +- suggested setups where the module is useful (eg: multicompany, multi-website) diff --git a/vcp_github/readme/CONTRIBUTORS.md b/vcp_github/readme/CONTRIBUTORS.md new file mode 100644 index 0000000..7be72fb --- /dev/null +++ b/vcp_github/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Firstname Lastname (optional company website url) +- Second Person (optional company website url) diff --git a/vcp_github/readme/CREDITS.md b/vcp_github/readme/CREDITS.md new file mode 100644 index 0000000..9c2b025 --- /dev/null +++ b/vcp_github/readme/CREDITS.md @@ -0,0 +1,7 @@ +[ This file is optional and contains additional credits, other than + authors, contributors, and maintainers. ] + +The development of this module has been financially supported by: + +- Company 1 name +- Company 2 name diff --git a/vcp_github/readme/DESCRIPTION.md b/vcp_github/readme/DESCRIPTION.md new file mode 100644 index 0000000..2371a14 --- /dev/null +++ b/vcp_github/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +[ This file must be max 2-3 paragraphs, and is required. + +The goal of this document is to explain quickly the features of this module: “what” this module does and “what” it is for. ] + +Example: + +This module extends the functionality of ... to support ... and to allow users to ... diff --git a/vcp_github/readme/HISTORY.md b/vcp_github/readme/HISTORY.md new file mode 100644 index 0000000..a6daf58 --- /dev/null +++ b/vcp_github/readme/HISTORY.md @@ -0,0 +1,22 @@ +[ The change log. The goal of this file is to help readers + understand changes between version. The primary audience is + end users and integrators. Purely technical changes such as + code refactoring must not be mentioned here. + + This file may contain ONE level of section titles, underlined + with the ~ (tilde) character. Other section markers are + forbidden and will likely break the structure of the README.rst + or other documents where this fragment is included. ] + +## 11.0.x.y.z (YYYY-MM-DD) + +- [BREAKING] Breaking changes come first. + ([#70](https://github.com/OCA/repo/issues/70)) +- [ADD] New feature. + ([#74](https://github.com/OCA/repo/issues/74)) +- [FIX] Correct this. + ([#71](https://github.com/OCA/repo/issues/71)) + +## 11.0.x.y.z (YYYY-MM-DD) + +- ... diff --git a/vcp_github/readme/INSTALL.md b/vcp_github/readme/INSTALL.md new file mode 100644 index 0000000..77b98e7 --- /dev/null +++ b/vcp_github/readme/INSTALL.md @@ -0,0 +1,7 @@ +[ This file must only be present if there are very specific + installation instructions, such as installing non-python + dependencies. The audience is systems administrators. ] + +To install this module, you need to: + +1. Do this ... diff --git a/vcp_github/readme/ROADMAP.md b/vcp_github/readme/ROADMAP.md new file mode 100644 index 0000000..446840c --- /dev/null +++ b/vcp_github/readme/ROADMAP.md @@ -0,0 +1,5 @@ +[ Enumerate known caveats and future potential improvements. + It is mostly intended for end-users, and can also help + potential new contributors discovering new features to implement. ] + +- ... diff --git a/vcp_github/readme/USAGE.md b/vcp_github/readme/USAGE.md new file mode 100644 index 0000000..2cf1275 --- /dev/null +++ b/vcp_github/readme/USAGE.md @@ -0,0 +1,21 @@ +[ This file is required and contains the instructions on **“how”** to use the module for end-users. + +If the module does not have a visible impact on the user interface, just add the following sentence: + +> This module does not impact the user interface. + +If that’s not the case, please make sure that every usage step is covered and remember that images speak more than words!] + +To use this module, you need to: + +- Go to *App* > Menu > Menu item + + *insert screenshot!* + +- In “Contact” form, add a value to field *xyz* > save + + *insert screenshot!* + +- The value of *xyz* is now displayed in the list view. + + *insert screenshot!* diff --git a/vcp_github/static/description/icon.png b/vcp_github/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/vcp_github/static/description/icon.png differ diff --git a/vcp_github/static/description/index.html b/vcp_github/static/description/index.html new file mode 100644 index 0000000..63aa4a5 --- /dev/null +++ b/vcp_github/static/description/index.html @@ -0,0 +1,555 @@ + + + + + +Vcp Github + + + +
+

Vcp Github

+ + +

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

[ This file must be max 2-3 paragraphs, and is required.

+

The goal of this document is to explain quickly the features of this +module: “what” this module does and “what” it is for. ]

+

Example:

+

This module extends the functionality of … to support … and to allow +users to …

+

Table of contents

+ +
+

Use Cases / Context

+

[ This file is optional but strongly suggested to allow end-users to +evaluate the module’s usefulness in their context. ]

+

BUSINESS NEED: It should explain the “why” of the module:

+
    +
  • what is the business requirement that generated the need to develop +this module
  • +
  • in which context or use cases this module can be useful (practical +examples are welcome!).
  • +
+

APPROACH: It could also explain the approach to address the mentioned +need.

+

USEFUL INFORMATION: It can also inform on related modules:

+
    +
  • modules it depends on and their features
  • +
  • other modules that can work well together with this one
  • +
  • suggested setups where the module is useful (eg: multicompany, +multi-website)
  • +
+
+
+

Installation

+

[ This file must only be present if there are very specific installation +instructions, such as installing non-python dependencies. The audience +is systems administrators. ]

+

To install this module, you need to:

+
    +
  1. Do this …
  2. +
+
+
+

Configuration

+

[ This file is not always required; it should explain how to configure +the module before using it; it is aimed at users with administration +privileges.

+

Please be detailed on the path to configuration (eg: do you need to +activate developer mode?), describe step by step configurations and the +use of screenshots is strongly recommended.]

+

To configure this module, you need to:

+
    +
  • Go to App > Menu > Menu item
  • +
  • Activate boolean… > save
  • +
  • +
+
+
+

Usage

+

[ This file is required and contains the instructions on “how” to +use the module for end-users.

+

If the module does not have a visible impact on the user interface, just +add the following sentence:

+
+This module does not impact the user interface.
+

If that’s not the case, please make sure that every usage step is +covered and remember that images speak more than words!]

+

To use this module, you need to:

+
    +
  • Go to App > Menu > Menu item

    +

    insert screenshot!

    +
  • +
  • In “Contact” form, add a value to field xyz > save

    +

    insert screenshot!

    +
  • +
  • The value of xyz is now displayed in the list view.

    +

    insert screenshot!

    +
  • +
+
+
+

Known issues / Roadmap

+

[ Enumerate known caveats and future potential improvements. It is +mostly intended for end-users, and can also help potential new +contributors discovering new features to implement. ]

+
    +
  • +
+
+
+

Changelog

+

[ The change log. The goal of this file is to help readers understand +changes between version. The primary audience is end users and +integrators. Purely technical changes such as code refactoring must not +be mentioned here.

+

This file may contain ONE level of section titles, underlined with the ~ +(tilde) character. Other section markers are forbidden and will likely +break the structure of the README.rst or other documents where this +fragment is included. ]

+
+

11.0.x.y.z (YYYY-MM-DD)

+
    +
  • [BREAKING] Breaking changes come first. +(#70)
  • +
  • [ADD] New feature. (#74)
  • +
  • [FIX] Correct this. (#71)
  • +
+
+ +
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Dixmit
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

[ This file is optional and contains additional credits, other than +authors, contributors, and maintainers. ]

+

The development of this module has been financially supported by:

+
    +
  • Company 1 name
  • +
  • Company 2 name
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/version-control-platform project on GitHub.

+

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

+
+
+
+ + diff --git a/vcp_github/tests/__init__.py b/vcp_github/tests/__init__.py new file mode 100644 index 0000000..c63e32e --- /dev/null +++ b/vcp_github/tests/__init__.py @@ -0,0 +1 @@ +from . import test_github diff --git a/vcp_github/tests/test_github.py b/vcp_github/tests/test_github.py new file mode 100644 index 0000000..76cd448 --- /dev/null +++ b/vcp_github/tests/test_github.py @@ -0,0 +1,114 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import base64 +from unittest.mock import MagicMock, patch + +from odoo.fields import Command +from odoo.tests.common import TransactionCase + + +class TestGithub(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.platform = cls.env["vcp.platform"].create( + { + "name": "oca", + "kind": "github", + "key_ids": [ + Command.create({"name": "ghp_exampletoken1234567890abcdef"}) + ], + } + ) + + def test_update_organization_and_logo(self): + base_url = self.env["ir.config_parameter"].sudo().get_param("web.base.url") + with ( + patch("odoo.addons.vcp_github.models.vcp_platform.github3") as mock_github3, + patch( + "odoo.addons.vcp_github.models.vcp_platform.requests.get" + ) as mock_requests_get, + ): + mock_client = MagicMock() + mock_org = MagicMock() + mock_org.name = "Odoo Community Association" + mock_org.avatar_url = f"{base_url}/logo.png" + mock_requests_get.return_value.content = base64.b64decode( + self.env.company.logo + ) + mock_client.organization.return_value = mock_org + mock_github3.login.return_value = mock_client + self.platform.update_information() + self.assertEqual( + self.platform.short_description, "Odoo Community Association" + ) + mock_github3.login.assert_called_once_with( + token="ghp_exampletoken1234567890abcdef" + ) + mock_client.organization.assert_called_once_with("oca") + + def test_update_organization_with_repository(self): + with patch( + "odoo.addons.vcp_github.models.vcp_platform.github3" + ) as mock_github3: + mock_client = MagicMock() + mock_org = MagicMock() + mock_org.name = "Odoo Community Association" + mock_org.avatar_url = False + mock_repo1 = MagicMock() + mock_repo1.name = "server-tools" + mock_repo1.created_at = "2020-01-01T00:00:00Z" + mock_repo2 = MagicMock() + mock_repo2.name = "server-brand" + mock_repo2.created_at = "2021-01-01T10:00:00Z" + mock_org.repositories.return_value = [mock_repo1, mock_repo2] + mock_client.organization.return_value = mock_org + mock_github3.login.return_value = mock_client + self.platform.update_information() + self.assertEqual(len(self.platform.repository_ids), 2) + repo_names = {repo.name for repo in self.platform.repository_ids} + self.assertSetEqual(repo_names, {"server-tools", "server-brand"}) + mock_github3.login.assert_called_once_with( + token="ghp_exampletoken1234567890abcdef" + ) + mock_client.organization.assert_called_once_with("oca") + return self.platform.repository_ids.filtered(lambda r: r.name == "server-tools") + + def test_update_repository(self): + repository = self.test_update_organization_with_repository() + self.assertFalse(repository.request_ids) + with patch( + "odoo.addons.vcp_github.models.vcp_platform.github3.login" + ) as mock_client: + mock_login = MagicMock() + mock_client.return_value = mock_login + mock_login.session.get.return_value = MagicMock( + links={}, + json=lambda: [], + ) + mock_issue_request = MagicMock( + as_dict=lambda: { + "id": 1, + "user": {"login": "contributor1"}, + "base": {"ref": "main"}, + "head": {"repo": [MagicMock()]}, + "html_url": "https://github.com/oca/server-tools/pull/1", + "state": "closed", + "title": "Fix issue", + "labels": [{"name": "merged 🎉"}], + "created_at": "2023-01-01T00:00:00Z", + "updated_at": "2023-01-03T00:00:00Z", + "closed_at": "2023-01-02T00:00:00Z", + "commits": 3, + "comments": 2, + "review_comments": 1, + "additions": 150, + "deletions": 50, + "number": 1, + } + ) + mock_login._instance_or_null.return_value = mock_issue_request + mock_login.search_issues.return_value = [mock_issue_request] + repository.update_information() + self.assertTrue(repository.request_ids) diff --git a/vcp_portal/README.rst b/vcp_portal/README.rst new file mode 100644 index 0000000..e3cac0f --- /dev/null +++ b/vcp_portal/README.rst @@ -0,0 +1,85 @@ +============ +Vcp - Portal +============ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:649a33ecc95d6699ddbe80c0b0781a81f36d66c4b09839dc8f133a4127369bb7 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github + :target: https://github.com/OCA/version-control-platform/tree/18.0/vcp_portal + :alt: OCA/version-control-platform +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp_portal + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of ``portal`` module, when ``vcp`` +module is installed. + +It adds a new entry in the partner portal menu. + +|portal_menu| + +When selecting this new item, partner has the possibility to see, some +indicators regarding contributions. + +|portal_form| + +.. |portal_menu| image:: https://raw.githubusercontent.com/OCA/version-control-platform/18.0/vcp_portal/static/description/portal_menu.png +.. |portal_form| image:: https://raw.githubusercontent.com/OCA/version-control-platform/18.0/vcp_portal/static/description/portal_form.png + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Dixmit +* GRAP + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/version-control-platform `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/vcp_portal/__init__.py b/vcp_portal/__init__.py new file mode 100644 index 0000000..e046e49 --- /dev/null +++ b/vcp_portal/__init__.py @@ -0,0 +1 @@ +from . import controllers diff --git a/vcp_portal/__manifest__.py b/vcp_portal/__manifest__.py new file mode 100644 index 0000000..cfa9d1c --- /dev/null +++ b/vcp_portal/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2026 GRAP +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Vcp - Portal", + "summary": "Glue module between Virtual Control Platform and Portal", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,GRAP,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/version-control-platform", + "depends": ["vcp", "portal"], + "data": [ + "templates/templates.xml", + ], + "demo": [], + "assets": { + "web.assets_frontend": [ + "vcp_portal/static/src/components/**/*.esm.js", + "vcp_portal/static/src/components/**/*.xml", + "vcp_portal/static/src/components/**/*.scss", + ], + "web.assets_tests": [ + "vcp_portal/static/tests/**/*", + ], + }, + "auto_install": True, +} diff --git a/vcp_portal/controllers/__init__.py b/vcp_portal/controllers/__init__.py new file mode 100644 index 0000000..12a7e52 --- /dev/null +++ b/vcp_portal/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/vcp_portal/controllers/main.py b/vcp_portal/controllers/main.py new file mode 100644 index 0000000..a2283a1 --- /dev/null +++ b/vcp_portal/controllers/main.py @@ -0,0 +1,185 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from math import sqrt + +from odoo import _, http +from odoo.http import request + +from odoo.addons.portal.controllers.portal import CustomerPortal + + +class ContributorsController(CustomerPortal): + @http.route( + [ + "/vcp", + "/vcp/", + ], + type="http", + auth="user", + website=True, + ) + def contributors_vcp(self, vcp=None): + values = self._prepare_portal_layout_values() + values.update(self._prepare_home_portal_values([])) + if vcp is None: + vcps = request.env["vcp.platform"].search([]) + return request.render( + "vcp_portal.vcp_platforms_template", + {"vcps": vcps, **values}, + ) + vcp_id = ( + request.env["vcp.platform"] + .sudo() + .search([("name", "=ilike", vcp)], limit=1) + .id + ) + return request.render( + "vcp_portal.vcp_platform_template", + {"vcp": vcp_id, **values}, + ) + + def _get_index(self, data): + return round( + sqrt(data["created_requests"]) + + data["merged_requests"] + + sqrt(data["comments"]) + + data["reviews"], + 2, + ) + + def _get_field(self, kind): + if kind == "contributors": + return "partner_id" + elif kind == "organizations": + return "organization_id" + elif kind == "repositories": + return "repository_id" + return False + + @http.route(["/vcp-fetch"], type="json", auth="user", readonly=True) + def fetch_vcp_data(self, vcp_id, year, month, kind, period, **values): + vcp = request.env["vcp.platform"].browse(vcp_id).exists() + if not vcp: + return [] + start, end = vcp._get_dates(year, month, period, **values) + data = vcp._generate_data(start, end, self._get_field(kind), kind, **values) + return { + "columns": self._get_vcp_columns(kind), + "data": self._improve_vcp_data(data, kind, **values), + } + + def _get_vcp_columns(self, kind): + if kind == "contributors": + return [ + {"field": "name", "title": _("Name"), "kind": "name"}, + { + "field": "created_requests", + "title": _("Created Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "merged_requests", + "title": _("Merged Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "comments", + "title": _("Comments"), + "kind": "float", + "decimals": 0, + }, + { + "field": "reviews", + "title": _("Reviews"), + "kind": "float", + "decimals": 0, + }, + ] + elif kind == "organizations": + return [ + {"field": "name", "title": _("Organization Name"), "kind": "name"}, + { + "field": "created_requests", + "title": _("Created Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "merged_requests", + "title": _("Merged Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "comments", + "title": _("Comments"), + "kind": "float", + "decimals": 0, + }, + { + "field": "reviews", + "title": _("Reviews"), + "kind": "float", + "decimals": 0, + }, + { + "field": "developers", + "title": _("Developers"), + "kind": "float", + "decimals": 0, + }, + ] + elif kind == "repositories": + return [ + {"field": "name", "title": _("Repository Name"), "kind": "name"}, + { + "field": "created_requests", + "title": _("Created Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "merged_requests", + "title": _("Merged Requests"), + "kind": "float", + "decimals": 0, + }, + { + "field": "comments", + "title": _("Comments"), + "kind": "float", + "decimals": 0, + }, + { + "field": "reviews", + "title": _("Reviews"), + "kind": "float", + "decimals": 0, + }, + { + "field": "developers", + "title": _("Developers"), + "kind": "float", + "decimals": 0, + }, + ] + return [] + + def _improve_vcp_data(self, data, kind, **kwargs): + for key, values in data.items(): + if kind == "contributors": + partner = request.env["res.partner"].browse(key) + values["name"] = partner._get_contributors_name(kind, **kwargs) + values["url"] = partner._get_contributor_url() + elif kind == "organizations": + organization = request.env["res.partner"].browse(key) + values["name"] = organization._get_contributors_name(kind, **kwargs) + values["url"] = organization._get_contributor_url() + elif kind == "repositories": + repository = request.env["vcp.repository"].browse(key) + values["name"] = repository.name + values["url"] = repository._get_repository_url() + return data diff --git a/vcp_portal/i18n/fr.po b/vcp_portal/i18n/fr.po new file mode 100644 index 0000000..80b08c3 --- /dev/null +++ b/vcp_portal/i18n/fr.po @@ -0,0 +1,15 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * vcp_website_portal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/vcp_portal/pyproject.toml b/vcp_portal/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/vcp_portal/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/vcp_portal/readme/DESCRIPTION.md b/vcp_portal/readme/DESCRIPTION.md new file mode 100644 index 0000000..2b3a7fc --- /dev/null +++ b/vcp_portal/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +This module extends the functionality of `portal` module, +when `vcp` module is installed. + +It adds a new entry in the partner portal menu. + +![portal_menu](../static/description/portal_menu.png) + +When selecting this new item, partner has the possibility to see, some indicators regarding contributions. + +![portal_form](../static/description/portal_form.png) diff --git a/vcp_portal/static/description/index.html b/vcp_portal/static/description/index.html new file mode 100644 index 0000000..cbc57c4 --- /dev/null +++ b/vcp_portal/static/description/index.html @@ -0,0 +1,423 @@ + + + + + +Vcp - Portal + + + +
+

Vcp - Portal

+ + +

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

This module extends the functionality of portal module, when vcp +module is installed.

+

It adds a new entry in the partner portal menu.

+

portal_menu

+

When selecting this new item, partner has the possibility to see, some +indicators regarding contributions.

+

portal_form

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Dixmit
  • +
  • GRAP
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/version-control-platform project on GitHub.

+

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

+
+
+
+ + diff --git a/vcp_portal/static/description/portal_menu.png b/vcp_portal/static/description/portal_menu.png new file mode 100644 index 0000000..ad3e358 Binary files /dev/null and b/vcp_portal/static/description/portal_menu.png differ diff --git a/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.esm.js b/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.esm.js new file mode 100644 index 0000000..0ad6447 --- /dev/null +++ b/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.esm.js @@ -0,0 +1,8 @@ +import {Component} from "@odoo/owl"; + +export class PopoverTooltip extends Component { + static template = "vcp.PopoverTooltip"; + static props = { + content: String, + }; +} diff --git a/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.xml b/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.xml new file mode 100644 index 0000000..268ffe9 --- /dev/null +++ b/vcp_portal/static/src/components/popover_tooltip/popover_tooltip.xml @@ -0,0 +1,7 @@ + + +
+ +
+
+
diff --git a/vcp_portal/static/src/components/vcp_render/vcp_render.esm.js b/vcp_portal/static/src/components/vcp_render/vcp_render.esm.js new file mode 100644 index 0000000..2fe5c78 --- /dev/null +++ b/vcp_portal/static/src/components/vcp_render/vcp_render.esm.js @@ -0,0 +1,122 @@ +import {Component, markup, onMounted, useState} from "@odoo/owl"; +import {Dropdown} from "@web/core/dropdown/dropdown"; +import {DropdownItem} from "@web/core/dropdown/dropdown_item"; +import {PopoverTooltip} from "../popover_tooltip/popover_tooltip.esm"; +import {formatFloat} from "@web/core/utils/numbers"; +import {registry} from "@web/core/registry"; +import {renderToString} from "@web/core/utils/render"; +import {rpc} from "@web/core/network/rpc"; +import {usePopover} from "@web/core/popover/popover_hook"; + +export class VcpRender extends Component { + static template = "vcp.VcpRender"; + setup() { + const year = new Date().getFullYear(); + const month = new Date().getMonth() + 1; + this.state = useState({ + sort: { + contributors: "index", + organizations: "merged_pull_requests", + repositories: "merged_pull_requests", + }, + columns: {}, + period: "YTD", + contributors: [], + organizations: [], + repositories: [], + year: month === 1 ? year - 1 : year, + month: (month === 1 ? 12 : month - 1).toString(), + kind: "contributors", + }); + onMounted(this.fetchData.bind(this)); + this.popover = usePopover(PopoverTooltip); + } + selectPeriod(period) { + this.state.period = period; + this.fetchData(); + } + initColumnTooltip(ev, column) { + this.popover.open(ev.currentTarget, { + content: markup(column.tooltip), + }); + } + initDateTooltip(ev) { + this.popover.open(ev.currentTarget, { + content: markup(renderToString("vcp.DateSelectionTooltip")), + }); + } + async fetchData() { + const data = await rpc("/vcp-fetch", this.getParameters()); + if (this.state.kind === "contributors") { + this.state.contributors = data.data; + } else if (this.state.kind === "organizations") { + this.state.organizations = data.data; + } else if (this.state.kind === "repositories") { + this.state.repositories = data.data; + } + this.state.columns = data.columns; + return data; + } + getParameters() { + return { + year: parseInt(this.state.year, 10), + month: parseInt(this.state.month, 10), + vcp_id: this.props.vcp, + kind: this.state.kind, + period: this.state.period, + }; + } + get rowIds() { + if (this.state.kind === "contributors") { + return Object.keys(this.state.contributors).sort( + (a, b) => + this.state.contributors[b][this.state.sort.contributors] - + this.state.contributors[a][this.state.sort.contributors] + ); + } else if (this.state.kind === "organizations") { + return Object.keys(this.state.organizations).sort( + (a, b) => + this.state.organizations[b][this.state.sort.organizations] - + this.state.organizations[a][this.state.sort.organizations] + ); + } else if (this.state.kind === "repositories") { + return Object.keys(this.state.repositories).sort( + (a, b) => + this.state.repositories[b][this.state.sort.repositories] - + this.state.repositories[a][this.state.sort.repositories] + ); + } + return []; + } + getRowData(row_id) { + if (this.state.kind === "organizations") { + return this.state.organizations[row_id]; + } + if (this.state.kind === "repositories") { + return this.state.repositories[row_id]; + } + if (this.state.kind === "contributors") { + return this.state.contributors[row_id]; + } + return {}; + } + formatFloat(value, digits) { + return formatFloat(value, {digits: [digits, digits]}); + } + setKind(kind) { + this.state.kind = kind; + this.fetchData(); + } + sortBy(field) { + this.state.sort[this.state.kind] = field; + } +} + +VcpRender.props = { + vcp: Number, +}; +VcpRender.components = { + Dropdown, + DropdownItem, +}; +registry.category("public_components").add("vcp.VcpRender", VcpRender); diff --git a/vcp_portal/static/src/components/vcp_render/vcp_render.scss b/vcp_portal/static/src/components/vcp_render/vcp_render.scss new file mode 100644 index 0000000..7e556a6 --- /dev/null +++ b/vcp_portal/static/src/components/vcp_render/vcp_render.scss @@ -0,0 +1,31 @@ +.o_vcp_render { + .o_vcp_render_table { + .o_vcp_render_table_header { + &.sortable { + cursor: pointer; + } + } + } + .o_input { + input { + display: block; + width: 100%; + padding: 0.375rem 0.75rem; + font-size: 0.875rem; + font-weight: 400; + line-height: 1.5; + color: #212529; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: white; + background-clip: padding-box; + border: var(--border-width) solid var(--border-color); + border-radius: var(--border-radius); + transition: + background-color 0.05s ease-in-out, + border-color 0.05s ease-in-out, + box-shadow 0.05s ease-in-out; + } + } +} diff --git a/vcp_portal/static/src/components/vcp_render/vcp_render.xml b/vcp_portal/static/src/components/vcp_render/vcp_render.xml new file mode 100644 index 0000000..2c10a84 --- /dev/null +++ b/vcp_portal/static/src/components/vcp_render/vcp_render.xml @@ -0,0 +1,148 @@ + + +
+ Select the period for which you want to see the contributors statistics. + Options are: +
+
    +
  • MTD: Month-To-Date
  • +
  • YTD: Year-To-Date - From January to the selected month
  • +
  • MAT: Moving Annual Total - Last 12 Months
  • +
+
+ +
+

Contributors Statistics

+
+
+ +
+
+ +
+
+ + + + MTD + YTD + MAT + + +
+
+ +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + +
+
+
+ +
diff --git a/vcp_portal/static/tests/tours/portal.esm.js b/vcp_portal/static/tests/tours/portal.esm.js new file mode 100644 index 0000000..c30087f --- /dev/null +++ b/vcp_portal/static/tests/tours/portal.esm.js @@ -0,0 +1,111 @@ +import {registry} from "@web/core/registry"; + +registry.category("web_tour.tours").add("portal_load_contributors_github", { + url: "/my", + steps: () => [ + { + content: "Check portal is loaded and Find Contributors menu", + trigger: 'a[href*="/vcp"]:contains("Virtual Control Platforms"):first', + run: "click", + expectUnloadPage: true, + }, + { + content: "Check Contributors Page", + trigger: 'a[href*="/vcp/oca"]:contains("OCA"):first', + run: "click", + expectUnloadPage: true, + }, + { + content: "Check Contributors Page", + trigger: "owl-component", + }, + { + content: "Check Etobella", + trigger: 'span:contains("Enric Tobella"):first', + }, + { + content: "Check LuisDixmit", + trigger: 'span:contains("Luis Rodriguez"):first', + }, + { + content: "Check JordiBForgeFlow", + trigger: 'span:contains("Jordi Ballester"):first', + }, + { + content: "Check Etobella Created Value", + trigger: 'tr:contains("Enric Tobella") td:nth-child(2):contains("1"):first', + }, + { + content: "Check LuisDixmit Created Value", + trigger: + 'tr:contains("Luis Rodriguez") td:nth-child(2):contains("1"):first', + }, + { + content: "Check JordiBForgeFlow Created Value", + trigger: + 'tr:contains("Jordi Ballester") td:nth-child(2):contains("1"):first', + }, + { + content: "Check Etobella Merged Value", + trigger: 'tr:contains("Enric Tobella") td:nth-child(3):contains("1"):first', + }, + { + content: "Check LuisDixmit Merged Value", + trigger: + 'tr:contains("Luis Rodriguez") td:nth-child(3):contains("0"):first', + }, + { + content: "Check JordiBForgeFlow Merged Value", + trigger: + 'tr:contains("Jordi Ballester") td:nth-child(3):contains("0"):first', + }, + { + content: "Change to Repositories", + trigger: ".o_vcp_repositories button", + run: "click", + }, + { + content: "Check Repository", + trigger: 'span:contains("contributors-module"):first', + }, + { + content: "Check Created Requests Value", + trigger: + 'tr:contains("contributors-module") td:nth-child(2):contains("3"):first', + }, + { + content: "Check Merged Requests Value", + trigger: + 'tr:contains("contributors-module") td:nth-child(3):contains("1"):first', + }, + { + content: "Change to Organizations", + trigger: ".o_vcp_organizations button", + run: "click", + }, + { + content: "Check Dixmit", + trigger: 'tr:contains("Dixmit"):first', + }, + { + content: "Check ForgeFlow", + trigger: 'tr:contains("ForgeFlow"):first', + }, + { + content: "Check Dixmit Created Pull Requests Value", + trigger: 'tr:contains("Dixmit") td:nth-child(2):contains("2"):first', + }, + { + content: "Check ForgeFlow Created Pull Requests Value", + trigger: 'tr:contains("ForgeFlow") td:nth-child(2):contains("1"):first', + }, + { + content: "Check Dixmit Merged Pull Requests Value", + trigger: 'tr:contains("Dixmit") td:nth-child(3):contains("1"):first', + }, + { + content: "Check ForgeFlow Merged Pull Requests Value", + trigger: 'tr:contains("ForgeFlow") td:nth-child(3):contains("0"):first', + }, + ], +}); diff --git a/vcp_portal/templates/templates.xml b/vcp_portal/templates/templates.xml new file mode 100644 index 0000000..a02a163 --- /dev/null +++ b/vcp_portal/templates/templates.xml @@ -0,0 +1,67 @@ + + + + + + + diff --git a/vcp_portal/tests/__init__.py b/vcp_portal/tests/__init__.py new file mode 100644 index 0000000..4814a87 --- /dev/null +++ b/vcp_portal/tests/__init__.py @@ -0,0 +1 @@ +from . import test_vcp_portal diff --git a/vcp_portal/tests/test_vcp_portal.py b/vcp_portal/tests/test_vcp_portal.py new file mode 100644 index 0000000..d55e6d1 --- /dev/null +++ b/vcp_portal/tests/test_vcp_portal.py @@ -0,0 +1,13 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo.tests import tagged + +from odoo.addons.vcp.tests.test_base import TestBase + + +@tagged("post_install", "-at_install") +class TestVCPPortal(TestBase): + def test_01_portal_load_tour(self): + self.start_tour("/", "portal_load_contributors_github", login="portal") diff --git a/vcp_website/README.rst b/vcp_website/README.rst new file mode 100644 index 0000000..09c8f79 --- /dev/null +++ b/vcp_website/README.rst @@ -0,0 +1,73 @@ +============= +Vcp - Website +============= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0471d7839f1265a582540c4f4e8dd6b37fb02dcc94fc7ae9c1bf9474f8466efc + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github + :target: https://github.com/OCA/version-control-platform/tree/18.0/vcp_website + :alt: OCA/version-control-platform +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp_website + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module is a technical glue module, installed when ``website`` and +``vcp`` modules are installed. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Dixmit +* GRAP + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/version-control-platform `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/vcp_website/__init__.py b/vcp_website/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/vcp_website/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/vcp_website/__manifest__.py b/vcp_website/__manifest__.py new file mode 100644 index 0000000..7df0338 --- /dev/null +++ b/vcp_website/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2026 GRAP +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Vcp - Website", + "summary": "Glue module between Virtual Control Platform and Website", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,GRAP,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/version-control-platform", + "depends": ["vcp", "website"], + "data": [], + "demo": [], + "auto_install": True, +} diff --git a/vcp_website/i18n/fr.po b/vcp_website/i18n/fr.po new file mode 100644 index 0000000..c28badf --- /dev/null +++ b/vcp_website/i18n/fr.po @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * vcp_website +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: vcp_website +#: model:ir.model,name:vcp_website.model_res_partner +msgid "Contact" +msgstr "Contact" diff --git a/vcp_website/models/__init__.py b/vcp_website/models/__init__.py new file mode 100644 index 0000000..91fed54 --- /dev/null +++ b/vcp_website/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/vcp_website/models/res_partner.py b/vcp_website/models/res_partner.py new file mode 100644 index 0000000..e4a69ef --- /dev/null +++ b/vcp_website/models/res_partner.py @@ -0,0 +1,14 @@ +# Copyright 2026 Dixmit +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + + +from odoo import models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + def _get_contributor_url(self): + if self.is_published and self.website_url: + return self.website_url + return super()._get_contributor_url() diff --git a/vcp_website/pyproject.toml b/vcp_website/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/vcp_website/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/vcp_website/readme/DESCRIPTION.md b/vcp_website/readme/DESCRIPTION.md new file mode 100644 index 0000000..24d3a63 --- /dev/null +++ b/vcp_website/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module is a technical glue module, +installed when `website` and `vcp` modules are installed. diff --git a/vcp_website/static/description/index.html b/vcp_website/static/description/index.html new file mode 100644 index 0000000..e882a72 --- /dev/null +++ b/vcp_website/static/description/index.html @@ -0,0 +1,418 @@ + + + + + +Vcp - Website + + + +
+

Vcp - Website

+ + +

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

This module is a technical glue module, installed when website and +vcp modules are installed.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Dixmit
  • +
  • GRAP
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/version-control-platform project on GitHub.

+

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

+
+
+
+ + diff --git a/vcp_website_partner/README.rst b/vcp_website_partner/README.rst new file mode 100644 index 0000000..a1689d7 --- /dev/null +++ b/vcp_website_partner/README.rst @@ -0,0 +1,80 @@ +===================== +Vcp - Website Partner +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:0471d7839f1265a582540c4f4e8dd6b37fb02dcc94fc7ae9c1bf9474f8466efc + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fversion--control--platform-lightgray.png?logo=github + :target: https://github.com/OCA/version-control-platform/tree/18.0/vcp_website_partner + :alt: OCA/version-control-platform +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/version-control-platform-18-0/version-control-platform-18-0-vcp_website_partner + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/version-control-platform&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of ``website_partner`` module, +when ``vcp`` module is installed. + +It adds on partner website form view, some indicators regarding +contributions. + +|website_partner_form| + +.. |website_partner_form| image:: https://raw.githubusercontent.com/OCA/version-control-platform/18.0/vcp_website_partner/static/description/website_partner_form.png + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Dixmit +* GRAP + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/version-control-platform `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/vcp_website_partner/__init__.py b/vcp_website_partner/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/vcp_website_partner/__manifest__.py b/vcp_website_partner/__manifest__.py new file mode 100644 index 0000000..3726118 --- /dev/null +++ b/vcp_website_partner/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2026 GRAP +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Vcp - Website Partner", + "summary": "Glue module between Virtual Control Platform and Website Partner", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "author": "Dixmit,GRAP,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/version-control-platform", + "depends": ["vcp", "website_partner"], + "data": [ + "templates/templates.xml", + ], + "demo": [], + "auto_install": True, +} diff --git a/vcp_website_partner/i18n/fr.po b/vcp_website_partner/i18n/fr.po new file mode 100644 index 0000000..74ed903 --- /dev/null +++ b/vcp_website_partner/i18n/fr.po @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * vcp_website_partner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: vcp_website_partner +#: model_terms:ir.ui.view,arch_db:vcp_website_partner.partner_detail +msgid "Comments" +msgstr "Commentaires" + +#. module: vcp_website_partner +#: model_terms:ir.ui.view,arch_db:vcp_website_partner.partner_detail +msgid "Created Requests" +msgstr "Requêtes créées" + +#. module: vcp_website_partner +#: model_terms:ir.ui.view,arch_db:vcp_website_partner.partner_detail +msgid "Merged Requests" +msgstr "Requêtes fusionnées" + +#. module: vcp_website_partner +#: model_terms:ir.ui.view,arch_db:vcp_website_partner.partner_detail +msgid "Reviews" +msgstr "Revues" diff --git a/vcp_website_partner/pyproject.toml b/vcp_website_partner/pyproject.toml new file mode 100644 index 0000000..4231d0c --- /dev/null +++ b/vcp_website_partner/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/vcp_website_partner/readme/DESCRIPTION.md b/vcp_website_partner/readme/DESCRIPTION.md new file mode 100644 index 0000000..79a8b60 --- /dev/null +++ b/vcp_website_partner/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module extends the functionality of `website_partner` module, +when `vcp` module is installed. + +It adds on partner website form view, some indicators regarding contributions. + +![website_partner_form](../static/description/website_partner_form.png) diff --git a/vcp_website_partner/static/description/index.html b/vcp_website_partner/static/description/index.html new file mode 100644 index 0000000..5fbbbdc --- /dev/null +++ b/vcp_website_partner/static/description/index.html @@ -0,0 +1,421 @@ + + + + + +Vcp - Website Partner + + + +
+

Vcp - Website Partner

+ + +

Beta License: AGPL-3 OCA/version-control-platform Translate me on Weblate Try me on Runboat

+

This module extends the functionality of website_partner module, +when vcp module is installed.

+

It adds on partner website form view, some indicators regarding +contributions.

+

website_partner_form

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Dixmit
  • +
  • GRAP
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/version-control-platform project on GitHub.

+

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

+
+
+
+ + diff --git a/vcp_website_partner/static/description/website_partner_form.png b/vcp_website_partner/static/description/website_partner_form.png new file mode 100644 index 0000000..ad3e358 Binary files /dev/null and b/vcp_website_partner/static/description/website_partner_form.png differ diff --git a/vcp_website_partner/templates/templates.xml b/vcp_website_partner/templates/templates.xml new file mode 100644 index 0000000..34ebaeb --- /dev/null +++ b/vcp_website_partner/templates/templates.xml @@ -0,0 +1,36 @@ + + + +