summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2016-06-09 11:44:31 +0200
committerAaron Bohy <aab@odoo.com>2016-06-16 13:48:18 +0200
commit2e29f388c5f636b5a40775a086283d4f6980c3bf (patch)
tree1e4887758d79e571e59226613b945e23382189a8
parentd632679a7272c39cb374d3845f40c7d626875cf3 (diff)
[FIX] calendar,pos,web: show_application should return a deferred
Also remove unused options dict from WebClient (especially action_post_login)
-rw-r--r--addons/calendar/static/src/js/base_calendar.js5
-rw-r--r--addons/point_of_sale/views/pos_templates.xml2
-rw-r--r--addons/web/static/src/js/abstract_web_client.js13
-rw-r--r--addons/web/static/src/js/web_client.js31
-rw-r--r--addons/web_tip/static/src/js/tip.js2
5 files changed, 19 insertions, 34 deletions
diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js
index dbdbb697546..954371654d4 100644
--- a/addons/calendar/static/src/js/base_calendar.js
+++ b/addons/calendar/static/src/js/base_calendar.js
@@ -218,12 +218,11 @@ WebClient.include({
self.get_next_notif();
}, 5 * 60 * 1000);
},
- //Override the show_application of addons/web/static/src/js/chrome.js
show_application: function() {
- this._super();
- this.check_notifications();
+ return this._super.apply(this, arguments).then(this.check_notifications.bind(this));
},
//Override addons/web/static/src/js/chrome.js
+ // FIXME: on_logout is no longer used
on_logout: function() {
this._super();
clearInterval(this.intervalNotif);
diff --git a/addons/point_of_sale/views/pos_templates.xml b/addons/point_of_sale/views/pos_templates.xml
index 3d45d8e3fd5..75e73c66d02 100644
--- a/addons/point_of_sale/views/pos_templates.xml
+++ b/addons/point_of_sale/views/pos_templates.xml
@@ -43,7 +43,7 @@
web_client._title_changed = function() {};
web_client.show_application = function() {
- web_client.action_manager.do_action("pos.ui");
+ return web_client.action_manager.do_action("pos.ui");
};
$(function () {
diff --git a/addons/web/static/src/js/abstract_web_client.js b/addons/web/static/src/js/abstract_web_client.js
index 6436f49dc7c..121ac43bdad 100644
--- a/addons/web/static/src/js/abstract_web_client.js
+++ b/addons/web/static/src/js/abstract_web_client.js
@@ -31,13 +31,10 @@ var WebClient = Widget.extend({
this.toggle_fullscreen(event.data.fullscreen);
},
},
- init: function(parent, client_options) {
+ init: function(parent) {
this.client_options = {};
this._super(parent);
this.origin = undefined;
- if (client_options) {
- _.extend(this.client_options, client_options);
- }
this._current_state = null;
this.menu_dm = new utils.DropMisordered();
this.action_mutex = new utils.Mutex();
@@ -65,13 +62,7 @@ var WebClient = Widget.extend({
// though it has no valid session
return $.when();
}
- }).then(function () {
- if (self.client_options.action) {
- self.do_action(self.client_options.action);
- delete(self.client_options.action);
- }
- core.bus.trigger('web_client_ready');
- });
+ }).then(core.bus.trigger.bind(core.bus, 'web_client_ready'));
},
bind_events: function() {
var self = this;
diff --git a/addons/web/static/src/js/web_client.js b/addons/web/static/src/js/web_client.js
index 4ec80b60cc9..570e64ac2bd 100644
--- a/addons/web/static/src/js/web_client.js
+++ b/addons/web/static/src/js/web_client.js
@@ -24,37 +24,32 @@ return AbstractWebClient.extend({
},
show_application: function() {
var self = this;
- self.toggle_bars(true);
-
- self.update_logo();
+ this.toggle_bars(true);
+ this.set_title();
+ this.update_logo();
// Menu is rendered server-side thus we don't want the widget to create any dom
- self.menu = new Menu(self);
- self.menu.setElement(this.$el.parents().find('.oe_application_menu_placeholder'));
- self.menu.on('menu_click', this, this.on_menu_action);
+ this.menu = new Menu(this);
+ this.menu.setElement(this.$el.parents().find('.oe_application_menu_placeholder'));
+ this.menu.on('menu_click', this, this.on_menu_action);
// Create the user menu (rendered client-side)
- self.user_menu = new UserMenu(self);
+ this.user_menu = new UserMenu(this);
var $user_menu_placeholder = $('body').find('.oe_user_menu_placeholder').show();
- var user_menu_loaded = self.user_menu.appendTo($user_menu_placeholder);
+ var user_menu_loaded = this.user_menu.appendTo($user_menu_placeholder);
// Create the systray menu (rendered server-side)
- self.systray_menu = new SystrayMenu(self);
- self.systray_menu.setElement(this.$el.parents().find('.oe_systray'));
- var systray_menu_loaded = self.systray_menu.start();
+ this.systray_menu = new SystrayMenu(this);
+ this.systray_menu.setElement(this.$el.parents().find('.oe_systray'));
+ var systray_menu_loaded = this.systray_menu.start();
// Start the menu once both systray and user menus are rendered
// to prevent overflows while loading
- $.when(systray_menu_loaded, user_menu_loaded).done(function() {
+ return $.when(systray_menu_loaded, user_menu_loaded).then(function() {
self.menu.start();
+ self.bind_hashchange();
});
- self.bind_hashchange();
- self.set_title();
- if (self.client_options.action_post_login) {
- self.action_manager.do_action(self.client_options.action_post_login);
- delete(self.client_options.action_post_login);
- }
},
toggle_bars: function(value) {
this.$('tr:has(td.navbar),.oe_leftbar').toggle(value);
diff --git a/addons/web_tip/static/src/js/tip.js b/addons/web_tip/static/src/js/tip.js
index 85774c1937b..6e94ad4d710 100644
--- a/addons/web_tip/static/src/js/tip.js
+++ b/addons/web_tip/static/src/js/tip.js
@@ -320,8 +320,8 @@ var Tip = Class.extend({
WebClient.include({
show_application: function() {
- this._super();
this.tips_handler = new Tips();
+ return this._super.apply(this, arguments);
}
});