Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions github_connector_odoo/models/github_repository_branch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (C) 2016-Today: Odoo Community Association (OCA)
# Copyright 2020-2023 Tecnativa - Víctor Martínez
# Copyright 2024 Tecnativa - Pedro M. Baeza
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

Expand All @@ -9,6 +10,8 @@
from odoo import api, fields, models
from odoo.modules.module import get_manifest

import odoo.addons

# Hard define this value to make this module working with or without
# the patch (that backports V10 manifests analysis code.
MANIFEST_NAMES = ("__manifest__.py", "__openerp__.py")
Expand Down Expand Up @@ -209,7 +212,9 @@ def _operation_analysis_rule_by_module_version(
manifest_keys_find = module_version.manifest_key_ids.filtered(
lambda x: x.id in rule.manifest_key_ids.ids
)
odoo.addons.__path__.append(full_path) # HACK: to get file_open working
module_info = get_manifest(module_version.technical_name, full_path)
odoo.addons.__path__.remove(full_path)
spec = rule._set_spec(rule.paths.splitlines())
for manifest_key_find in manifest_keys_find:
if manifest_key_find.name in module_info:
Expand All @@ -227,7 +232,9 @@ def _analyze_module_name(self, path, module_name):
module_version_obj = self.env["odoo.module.version"]
try:
full_module_path = os.path.join(path, module_name)
odoo.addons.__path__.append(path) # HACK: to get file_open working
module_info = get_manifest(module_name, full_module_path)
odoo.addons.__path__.remove(path)
# Create module version, if the module is installable
# in the serie
if module_info.get("installable", False):
Expand Down
9 changes: 5 additions & 4 deletions github_connector_odoo/models/odoo_module_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (C) 2016-Today: Odoo Community Association (OCA)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# Copyright 2024 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import base64
Expand Down Expand Up @@ -495,11 +496,11 @@ def create_or_update_from_manifest(self, info, repository_branch, full_module_pa
try:
with open(icon_path, "rb") as f:
image = f.read()
image_enc = base64.b64encode(image)
if resize:
image = tools.image.ImageProcess(image_enc, False)
image.resize(96, 96)
image_enc = image.image_base64(output_format="PNG")
process = tools.image.ImageProcess(image, False)
process.resize(96, 96)
image = process.image_quality()
image_enc = base64.b64encode(image)
except Exception:
_logger.warning("Unable to read or resize %s", icon_path)
module_version.write({"image": image_enc})
Expand Down