diff options
| author | Xavier Morel <xmo@openerp.com> | 2011-08-19 16:39:47 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2011-08-19 16:39:47 +0200 |
| commit | eaf0914e2a152e1ff50c4ec2d0956584abedd04a (patch) | |
| tree | c5dbfeb3d8674a6bbcd455e929df96a71ec529e6 /addons/base_default_home/static/src | |
| parent | 2cefb02439751755962f43006009852bfdf25f4d (diff) | |
[FIX] incompatibility between static home and ActionManager
convert static home to a client action, fix ActionManager's handling of client actions to play correctly with the Widget lifecycle (and clean any client action displayed in case it's switching to an inner act_window)
bzr revid: xmo@openerp.com-20110819143947-29dzerce0d42fhel
Diffstat (limited to 'addons/base_default_home/static/src')
| -rw-r--r-- | addons/base_default_home/static/src/js/home.js | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/addons/base_default_home/static/src/js/home.js b/addons/base_default_home/static/src/js/home.js index 7470b2914ce..f10aa214f66 100644 --- a/addons/base_default_home/static/src/js/home.js +++ b/addons/base_default_home/static/src/js/home.js @@ -63,22 +63,38 @@ openerp.base_default_home = function (openerp) { if (!_(installed_modules).isEmpty()) { return old_home.call(self); } - self.$element.find('.oe-application').html( - QWeb.render('StaticHome', { - url: window.location.protocol + '//' + window.location.host + window.location.pathname, - session: self.session, - rows: openerp.base_default_home.applications - })).delegate('.oe-static-home-tile-text button', 'click', function () { - self.install_module($(this).val()); + self.action_manager.do_action({ + type: 'ir.actions.client', + tag: 'home.default' }) - }, function (err, event) { event.preventDefault(); return old_home.call(self); }); + } + }); + + openerp.base.client_actions.add( + 'home.default', 'openerp.base_default_home.DefaultHome'); + openerp.base_default_home.DefaultHome = openerp.base.View.extend({ + template: 'StaticHome', + start: function () { + var r = this._super(); + this.$element.delegate('.oe-static-home-tile-text button', 'click', function () { + self.install_module($(this).val()); + }); + return r; + }, + render: function () { + return this._super({ + url: window.location.protocol + '//' + window.location.host + window.location.pathname, + session: this.session, + rows: openerp.base_default_home.applications + }) }, install_module: function (module_name) { - var Modules = new openerp.base.DataSetSearch( this, 'ir.module.module', null, [['name', '=', module_name], ['state', '=', 'uninstalled']]); + var Modules = new openerp.base.DataSetSearch( + this, 'ir.module.module', null, [['name', '=', module_name], ['state', '=', 'uninstalled']]); var Upgrade = new openerp.base.DataSet(this, 'base.module.upgrade'); $.blockUI({ |
