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
2 changes: 1 addition & 1 deletion github_connector_odoo/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Github Connector - Odoo',
'summary': 'Analyze Odoo modules information from Github repositories',
'version': '11.0.1.0.0',
'version': '11.0.1.0.1',
'category': 'Connector',
'license': 'AGPL-3',
'author': 'Odoo Community Association (OCA), Sylvain LE GAL, GRAP',
Expand Down
28 changes: 20 additions & 8 deletions github_connector_odoo/models/odoo_module_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class OdooModuleVersion(models.Model):
string='Odoo Type', selection=_ODOO_TYPE_SELECTION, store=True,
compute='_compute_odoo_type')

image = fields.Binary(string='Icon Image', reaonly=True)
image = fields.Binary(string='Icon Image', readonly=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


github_url = fields.Char(
string='Github URL', compute='_compute_github_url', store=True,
Expand Down Expand Up @@ -332,19 +332,31 @@ def create_or_update_from_manifest(
info, repository_branch, module_version.module_id)
module_version.write(value)
icon_path = False
for current_icon_path in self._ICON_PATH:
resize = False
if info.get('images'):
full_current_icon_path = os.path.join(
full_module_path, current_icon_path, 'icon.png')
full_module_path, info.get('images')[0])
if os.path.exists(full_current_icon_path):
icon_path = full_current_icon_path
else:
for current_icon_path in self._ICON_PATH:
full_current_icon_path = os.path.join(
full_module_path, current_icon_path, 'icon.png')
if os.path.exists(full_current_icon_path):
icon_path = full_current_icon_path
resize = True
break
if icon_path:
resized_image = False
image_enc = False
try:
with open(icon_path, 'rb') as f:
image = f.read()
resized_image = tools.image_resize_image(
base64.b64encode(image), size=(96, 96),
encoding='base64', filetype='PNG')
if resize:
image_enc = tools.image_resize_image(
base64.b64encode(image), size=(96, 96),
encoding='base64', filetype='PNG')
else:
image_enc = base64.b64encode(image)
except Exception:
_logger.warning("Unable to read or resize %s" % icon_path)
module_version.write({'image': resized_image})
module_version.write({'image': image_enc})