[IMP] Client actions now takes the action as argument. Use action.params for options.

bzr revid: fme@openerp.com-20121105130053-6gdklt6ok4lst6ba
This commit is contained in:
Fabien Meghazi
2012-11-05 14:00:53 +01:00
parent 2d42b35fba
commit 6f57449dcd
2 changed files with 10 additions and 9 deletions
+7 -6
View File
@@ -504,13 +504,13 @@ instance.web.Login = instance.web.Widget.extend({
template: "Login",
remember_credentials: true,
init: function(parent, params) {
init: function(parent, action) {
this._super(parent);
this.has_local_storage = typeof(localStorage) != 'undefined';
this.db_list = null;
this.selected_db = null;
this.selected_login = null;
this.params = params || {};
this.params = action.params || {};
if (this.params.login_successful) {
this.on('login_successful', this, this.params.login_successful);
@@ -616,8 +616,9 @@ instance.web.client_actions.add("login", "instance.web.Login");
* Client action to reload the whole interface.
* If params has an entry 'menu_id', it opens the given menu entry.
*/
instance.web.Reload = function(parent, params) {
var menu_id = (params && params.menu_id) || false;
instance.web.Reload = function(parent, action) {
var params = action.params || {};
var menu_id = params.menu_id || false;
var l = window.location;
var sobj = $.deparam(l.search.substr(1));
@@ -638,7 +639,7 @@ instance.web.client_actions.add("reload", "instance.web.Reload");
* Client action to go back in breadcrumb history.
* If can't go back in history stack, will go back to home.
*/
instance.web.HistoryBack = function(parent, params) {
instance.web.HistoryBack = function(parent) {
if (!parent.history_back()) {
window.location = '/' + (window.location.search || '');
}
@@ -649,7 +650,7 @@ instance.web.client_actions.add("history_back", "instance.web.HistoryBack");
* Client action to go back home.
*/
instance.web.Home = instance.web.Widget.extend({
init: function(parent, params) {
init: function(parent) {
window.location = '/' + (window.location.search || '');
}
});
+3 -3
View File
@@ -247,7 +247,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
action_menu_id: null,
});
if (_.isString(action) && instance.web.client_actions.contains(action)) {
var action_client = { type: "ir.actions.client", tag: action };
var action_client = { type: "ir.actions.client", tag: action, params: {} };
return this.do_action(action_client, options);
} else if (_.isNumber(action) || _.isString(action)) {
var self = this;
@@ -346,14 +346,14 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (!(ClientWidget.prototype instanceof instance.web.Widget)) {
var next;
if (next = ClientWidget(this, action.params)) {
if (next = ClientWidget(this, action)) {
return this.do_action(next, options);
}
return $.when();
}
return this.ir_actions_common({
widget: function () { return new ClientWidget(self, action.params); },
widget: function () { return new ClientWidget(self, action); },
action: action,
klass: 'oe_act_client',
post_process: function(widget) {