From 9e94b86bfe3713ab65bcf204faffcb5d43746541 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Dec 2011 13:28:03 +0100 Subject: [PATCH] [IMP] icon management in modules * If icon is present in descriptor file, use that path * Else try to find #{module}/static/src/img/icon.png * Else fallback on /base/static/src/img/icon.png bzr revid: xmo@openerp.com-20111209122803-elwonegpl8kut7pf --- .../static/src/img/{kanban_partner.png => icon.png} | Bin openerp/modules/module.py | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) rename openerp/addons/base/static/src/img/{kanban_partner.png => icon.png} (100%) diff --git a/openerp/addons/base/static/src/img/kanban_partner.png b/openerp/addons/base/static/src/img/icon.png similarity index 100% rename from openerp/addons/base/static/src/img/kanban_partner.png rename to openerp/addons/base/static/src/img/icon.png diff --git a/openerp/modules/module.py b/openerp/modules/module.py index 899fa6efece..7f934275894 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -218,6 +218,11 @@ def get_module_resource(module, *args): return resource_path return False +def get_module_icon(module): + iconpath = ['static', 'src', 'img', 'icon.png'] + if get_module_resource(module, *iconpath): + return ('/' + module + '/') + '/'.join(iconpath) + return '/base/' + '/'.join(iconpath) def load_information_from_description_file(module): """ @@ -241,7 +246,7 @@ def load_information_from_description_file(module): 'complexity': 'normal', 'depends': [], 'description': '', - 'icon': None, + 'icon': get_module_icon(module), 'installable': True, 'license': 'AGPL-3', 'name': False,