diff --git a/openerp/addons/base/module/module.py b/openerp/addons/base/module/module.py
index 5db21282c65..a2fa5084c39 100644
--- a/openerp/addons/base/module/module.py
+++ b/openerp/addons/base/module/module.py
@@ -321,7 +321,19 @@ class module(osv.osv):
def button_install(self, cr, uid, ids, context=None):
self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
return dict(ACTION_DICT, name=_('Install'))
-
+
+ def button_immediate_install(self, cr, uid, ids, context=None):
+ """ Installs the selected module(s) immediately and fully,
+ returns the next res.config action to execute
+
+ :param ids: identifiers of the modules to install
+ :returns: next res.config item to execute
+ :rtype: dict[str, object]
+ """
+ self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
+ cr.commit()
+ db, pool = pooler.restart_pool(cr.dbname, update_module=True)
+ return pool.get('res.config').next(db.cursor(), uid, [], context=context)
def button_install_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'uninstalled', 'demo':False})
diff --git a/openerp/addons/base/module/module_view.xml b/openerp/addons/base/module/module_view.xml
index 76aec91b98e..99468493814 100644
--- a/openerp/addons/base/module/module_view.xml
+++ b/openerp/addons/base/module/module_view.xml
@@ -70,8 +70,9 @@
+
-
+
@@ -79,13 +80,9 @@
Complex
-
Install
-
+
+
-
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 78f1f831920..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):
"""
@@ -231,37 +236,32 @@ def load_information_from_description_file(module):
if terp_file:
info = {}
if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'):
- terp_f = tools.file_open(terp_file)
- try:
- info = eval(terp_f.read())
- except Exception:
- logger.notifyChannel('modules', netsvc.LOG_ERROR,
- 'module %s: exception while evaluating file %s' %
- (module, terp_file))
- raise
- finally:
- terp_f.close()
- # TODO the version should probably be mandatory
- info.setdefault('version', '0')
- info.setdefault('category', 'Uncategorized')
- info.setdefault('depends', [])
- info.setdefault('author', '')
- info.setdefault('website', '')
- info.setdefault('name', False)
- info.setdefault('description', '')
- info.setdefault('complexity', 'normal')
- info.setdefault('application', False)
- info.setdefault('icon', 'images/icon.png')
- info['certificate'] = info.get('certificate') or None
- info['web'] = info.get('web') or False
- info['license'] = info.get('license') or 'AGPL-3'
- info.setdefault('installable', True)
- info.setdefault('active', False)
- # If the following is provided, it is called after the module is --loaded.
- info.setdefault('post_load', None)
- for kind in ['data', 'demo', 'test',
- 'init_xml', 'update_xml', 'demo_xml']:
- info.setdefault(kind, [])
+ # default values for descriptor
+ info = {
+ 'active': False,
+ 'application': False,
+ 'author': '',
+ 'category': 'Uncategorized',
+ 'certificate': None,
+ 'complexity': 'normal',
+ 'depends': [],
+ 'description': '',
+ 'icon': get_module_icon(module),
+ 'installable': True,
+ 'license': 'AGPL-3',
+ 'name': False,
+ 'post_load': None,
+ 'version': '0.0.0',
+ 'web': False,
+ 'website': '',
+ }
+ info.update(itertools.izip(
+ 'depends data demo test init_xml update_xml demo_xml'.split(),
+ iter(list, None)))
+
+ with tools.file_open(terp_file) as terp_f:
+ info.update(eval(terp_f.read()))
+
return info
#TODO: refactor the logger in this file to follow the logging guidelines