summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-11-08 14:43:28 +0100
committerChristophe Simonis <chs@odoo.com>2016-11-08 14:43:28 +0100
commit63860373acb47356c7731cbc8258af0fd7fd9da4 (patch)
treeb669d2c50f6d2326adad219acd7014b86faf5e3f /addons/web/static/src/js
parent3c3cced5d964f410f32c410cce1133f504bdad2f (diff)
parentc19f54650594211e4af7e68214de4f118686b8e1 (diff)
[MERGE] forward port branch saas-11 up to c19f546
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/boot.js2
-rw-r--r--addons/web/static/src/js/control_panel.js19
-rw-r--r--addons/web/static/src/js/framework/view.js6
-rw-r--r--addons/web/static/src/js/view_manager.js8
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js3
-rw-r--r--addons/web/static/src/js/views/form_view.js3
-rw-r--r--addons/web/static/src/js/views/graph_view.js6
-rw-r--r--addons/web/static/src/js/views/list_view.js2
-rw-r--r--addons/web/static/src/js/views/pivot_view.js6
-rw-r--r--addons/web/static/src/js/widgets/sidebar.js4
10 files changed, 56 insertions, 3 deletions
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
index 842858926a9..b84cd0f58f8 100644
--- a/addons/web/static/src/js/boot.js
+++ b/addons/web/static/src/js/boot.js
@@ -189,7 +189,7 @@
if (odoo.debug && !_.isEmpty(debug_jobs)) log.push('\nDebug: ', debug_jobs);
if (odoo.debug || !_.isEmpty(failed) || !_.isEmpty(unloaded)) {
- console[_.isEmpty(unloaded) ? 'info' : 'error'].apply(console, log);
+ console[_.isEmpty(failed) || _.isEmpty(unloaded) ? 'info' : 'error'].apply(console, log);
}
}
},
diff --git a/addons/web/static/src/js/control_panel.js b/addons/web/static/src/js/control_panel.js
index 56f02d90eaf..173d91aea25 100644
--- a/addons/web/static/src/js/control_panel.js
+++ b/addons/web/static/src/js/control_panel.js
@@ -76,6 +76,10 @@ var ControlPanel = Widget.extend({
return this._super();
},
+ destroy: function() {
+ this._clear_breadcrumbs_handlers();
+ return this._super.apply(this, arguments);
+ },
/**
* @return {Object} the Bus the ControlPanel is listening on
*/
@@ -108,7 +112,9 @@ var ControlPanel = Widget.extend({
// Render the breadcrumbs
if (status.breadcrumbs) {
- new_cp_content.$breadcrumbs = this._render_breadcrumbs(status.breadcrumbs);
+ this._clear_breadcrumbs_handlers();
+ this.$breadcrumbs = this._render_breadcrumbs(status.breadcrumbs);
+ new_cp_content.$breadcrumbs = this.$breadcrumbs;
}
// Detach control_panel old content and attach new elements
@@ -208,6 +214,17 @@ var ControlPanel = Widget.extend({
return $bc;
},
/**
+ * Private function that removes event handlers attached on the currently
+ * displayed breadcrumbs.
+ */
+ _clear_breadcrumbs_handlers: function () {
+ if (this.$breadcrumbs) {
+ _.each(this.$breadcrumbs, function ($bc) {
+ $bc.off();
+ });
+ }
+ },
+ /**
* Private function that updates the SearchView's visibility and extend the
* breadcrumbs area if the SearchView is not visible
* @param {openerp.web.SearchView} [searchview] the searchview Widget
diff --git a/addons/web/static/src/js/framework/view.js b/addons/web/static/src/js/framework/view.js
index 9b3d1751570..ded3ba10bb7 100644
--- a/addons/web/static/src/js/framework/view.js
+++ b/addons/web/static/src/js/framework/view.js
@@ -196,6 +196,12 @@ var View = Widget.extend({
get_context: function () {
return {};
},
+ destroy: function () {
+ if (this.$buttons) {
+ this.$buttons.off();
+ }
+ return this._super.apply(this, arguments);
+ },
set_scrollTop: function(scrollTop) {
this.scrollTop = scrollTop;
},
diff --git a/addons/web/static/src/js/view_manager.js b/addons/web/static/src/js/view_manager.js
index ec7ce95313a..dd730b62f4e 100644
--- a/addons/web/static/src/js/view_manager.js
+++ b/addons/web/static/src/js/view_manager.js
@@ -463,6 +463,14 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
}
this.active_view.controller.do_load_state(state, warm);
},
+ destroy: function () {
+ if (this.control_elements) {
+ if (this.control_elements.$switch_buttons) {
+ this.control_elements.$switch_buttons.off();
+ }
+ }
+ return this._super.apply(this, arguments);
+ },
});
return ViewManager;
diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js
index dd4c4fb0fb6..00bbd8b3c24 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -99,6 +99,9 @@ var FieldMany2One = common.AbstractField.extend(common.CompletionFieldMixin, com
delete this.$dropdown;
}
if (this.$input) {
+ if (this.$input.data('ui-autocomplete')) {
+ this.$input.autocomplete("destroy");
+ }
this.$input.closest(".modal .modal-content").off('scroll');
this.$input.off('keyup blur autocompleteclose autocompleteopen ' +
'focus focusout change keydown');
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index f517a94c819..9d3caf7d76a 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -94,6 +94,9 @@ var FormView = View.extend(common.FieldManagerMixin, {
});
},
start: function() {
+ if (this.$pager) {
+ this.$pager.off();
+ }
var self = this;
this.rendering_engine.set_fields_registry(this.fields_registry);
diff --git a/addons/web/static/src/js/views/graph_view.js b/addons/web/static/src/js/views/graph_view.js
index ea9d09636f5..308c1359248 100644
--- a/addons/web/static/src/js/views/graph_view.js
+++ b/addons/web/static/src/js/views/graph_view.js
@@ -129,6 +129,12 @@ var GraphView = View.extend({
this.widget.set_measure(this.active_measure);
}
},
+ destroy: function () {
+ if (this.$buttons) {
+ this.$buttons.find('button').off(); // remove jquery's tooltip() handlers
+ }
+ return this._super.apply(this, arguments);
+ },
});
core.view_registry.add('graph', GraphView);
diff --git a/addons/web/static/src/js/views/list_view.js b/addons/web/static/src/js/views/list_view.js
index 5bf94100898..e97b4eac93f 100644
--- a/addons/web/static/src/js/views/list_view.js
+++ b/addons/web/static/src/js/views/list_view.js
@@ -267,7 +267,7 @@ var ListView = View.extend({
render_buttons: function($node) {
if (!this.$buttons) {
this.$buttons = $(QWeb.render("ListView.buttons", {'widget': this}));
- this.$buttons.find('.o_list_button_add').click(this.proxy('do_add_record'));
+ this.$buttons.on('click', '.o_list_button_add', this.proxy('do_add_record'));
this.$buttons.appendTo($node);
}
},
diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js
index 264fa2af985..be63f02248d 100644
--- a/addons/web/static/src/js/views/pivot_view.js
+++ b/addons/web/static/src/js/views/pivot_view.js
@@ -827,6 +827,12 @@ var PivotView = View.extend({
error: crash_manager.rpc_error.bind(crash_manager)
});
},
+ destroy: function () {
+ if (this.$buttons) {
+ this.$buttons.find('button').off(); // remove jquery's tooltip() handlers
+ }
+ return this._super.apply(this, arguments);
+ },
});
function traverse_tree(root, f, arg1, arg2, arg3) {
diff --git a/addons/web/static/src/js/widgets/sidebar.js b/addons/web/static/src/js/widgets/sidebar.js
index 03997db6c36..1e382c3d985 100644
--- a/addons/web/static/src/js/widgets/sidebar.js
+++ b/addons/web/static/src/js/widgets/sidebar.js
@@ -52,6 +52,10 @@ var Sidebar = Widget.extend({
event.preventDefault();
});
},
+ destroy: function() {
+ $(window).off(this.fileupload_id);
+ return this._super.apply(this, arguments);
+ },
redraw: function() {
this.$el.html(QWeb.render('Sidebar', {widget: this}));