summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-12-09 12:40:02 +0100
committerXavier Morel <xmo@openerp.com>2011-12-09 12:40:02 +0100
commit89eb1140918c7389a2d67e189b96a8a5697cbe6b (patch)
treef21e58f0c0b7f163a301c80edede28a33eadf91e
parent926041c8b85000c33fb412586a6dbd0bcf5a779b (diff)
[ADD] API for immediate installation of modules (modules kanban view), buttons everywhere, remove weird kanban image fallback
bzr revid: xmo@openerp.com-20111209114002-dlz79hxft05bhnqx
-rw-r--r--openerp/addons/base/module/module.py14
-rw-r--r--openerp/addons/base/module/module_view.xml11
2 files changed, 17 insertions, 8 deletions
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 @@
<field name="complexity"/>
<templates>
<t t-name="kanban-box">
+ <t t-set="installed" t-value="record.state.raw_value == 'installed'"/>
<a type="edit">
- <img t-attf-src="/#{record.name.value}/static/images/icon.png" class="oe_module_icon"/>
+ <img t-attf-src="#{record.icon.value}" class="oe_module_icon"/>
</a>
<div class="oe_module_desc">
<h4><a type="edit"><field name="shortdesc"/></a></h4>
@@ -79,13 +80,9 @@
<field name="category_id"/><br/>
<span t-if="record.complexity.raw_value == 'Expert'" class="oe_label oe_warning">Complex</span>
</p>
- <a type="object" name="button_install" states="uninstalled" class="button">Install</a>
- <button t-if="record.state.raw_value == 'installed'" class="label" disabled="disabled">Installed</button>
+ <button type="object" name="button_immediate_install" states="uninstalled" class="button">Install</button>
+ <button t-if="installed" class="label" disabled="disabled">Installed</button>
</div>
- <script>
- $('.oe_module_icon').error(function() { $(this).attr('src', "/base/static/src/img/kanban_partner.png"); });
- $('a .oe_module_icon').error(function() { $(this).attr('src', "/base/static/src/img/kanban_partner.png"); });
- </script>
</t>
</templates>
</kanban>