From 6705b9c24934818a8eb15dd9739b2f395dbd9f94 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 19 Jul 2011 14:32:46 +0200 Subject: [PATCH] [IMP] prepare for a default home action (in case no actual home action is setup) bzr revid: xmo@openerp.com-20110719123246-av28luyczaoeoh7r --- addons/base/static/src/js/chrome.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index cf4d3ab5338..5a049bf5dd8 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -1173,15 +1173,28 @@ openerp.base.WebClient = openerp.base.Controller.extend({ var ds = new openerp.base.DataSetSearch(this.session, 'res.users'); ds.read_ids([parseInt(this.session.uid, 10)], ['action_id'], function (users) { var home_action = users[0].action_id; - if (!home_action) { return; } + if (!home_action) { + self.default_home(); + return; + } // oh dear - openerp.base.View.prototype.execute_action.call( - self, { - 'name': home_action[0], - 'type': 'action' - }, ds, self.action_manager); + self.execute_home_action(home_action[0], ds); }) }, + default_home: function () { console.log('base default home') }, + /** + * Bundles the execution of the home action + * + * @param {Number} action action id + * @param {openerp.base.DataSet} dataset action executor + */ + execute_home_action: function (action, dataset) { + openerp.base.View.prototype.execute_action.call( + this, { + 'name': action, + 'type': 'action' + }, dataset, this.action_manager); + }, on_menu_action: function(action) { this.action_manager.do_action(action); },