summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/control_panel.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-11-08 14:20:07 +0100
committerChristophe Simonis <chs@odoo.com>2016-11-08 14:20:07 +0100
commitc19f54650594211e4af7e68214de4f118686b8e1 (patch)
treeae27c8fb401e8159bad45781a8e7b0ab20235b35 /addons/web/static/src/js/control_panel.js
parentd32970830ea938bead60e8368a3389f9d20853df (diff)
parentb7957550010e0cecc1dbefcbc122d9a49f50ae1d (diff)
[MERGE] forward port branch 9.0 up to b795755
Diffstat (limited to 'addons/web/static/src/js/control_panel.js')
-rw-r--r--addons/web/static/src/js/control_panel.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/addons/web/static/src/js/control_panel.js b/addons/web/static/src/js/control_panel.js
index 5c7d206e777..018489e4956 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