summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-11-08 15:13:05 +0100
committerChristophe Simonis <chs@odoo.com>2016-11-08 15:13:05 +0100
commit7eb8ed276992cf3ce693a02414f6558ee553128e (patch)
treee41dd25308e836d30ccf609814b8942959cf2dc4 /addons/web/static/src
parent5a030db3eb77b6d80187f8ae1a64303b2f50391d (diff)
parent3d085f632d4c5a8aece92731494e1dbbc8923049 (diff)
[MERGE] forward port branch 10.0 up to 3d085f6
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/action_manager.js3
-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/session.js9
-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.js4
-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
12 files changed, 65 insertions, 7 deletions
diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js
index b6a33e443d1..7e8b89dda68 100644
--- a/addons/web/static/src/js/action_manager.js
+++ b/addons/web/static/src/js/action_manager.js
@@ -701,7 +701,8 @@ var ActionManager = Widget.extend({
this.dialog = new Dialog(this, {
title: executor.action.name,
dialogClass: executor.klass,
- buttons: []
+ buttons: [],
+ size: executor.action.context.dialog_size,
});
// chain on_close triggers with previous dialog, if any
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/session.js b/addons/web/static/src/js/framework/session.js
index 18fccecc331..6af97721926 100644
--- a/addons/web/static/src/js/framework/session.js
+++ b/addons/web/static/src/js/framework/session.js
@@ -141,9 +141,12 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, {
}
var def = this._groups_def[group];
if (!def) {
- var Model = window.openerp.web.Model;
- var Users = new Model('res.users');
- def = this._groups_def[group] = Users.call('has_group', [group]);
+ def = this._groups_def[group] = this.rpc('/web/dataset/call_kw/res.users/has_group', {
+ "model": "res.users",
+ "method": "has_group",
+ "args": [group],
+ "kwargs": {}
+ });
}
return def;
},
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 e0d0135185f..dd6c2354156 100644
--- a/addons/web/static/src/js/view_manager.js
+++ b/addons/web/static/src/js/view_manager.js
@@ -464,6 +464,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 00640696b41..702d43f061f 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -7,6 +7,7 @@ var data = require('web.data');
var Dialog = require('web.Dialog');
var common = require('web.form_common');
var ListView = require('web.ListView');
+require('web.ListEditor'); // one must be sure that the include of ListView are done (for eg: add start_edition methods)
var Model = require('web.DataModel');
var session = require('web.session');
var utils = require('web.utils');
@@ -99,6 +100,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 574f41e4c51..2dd5e80def4 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -88,6 +88,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 e92437d1551..db50fbb6208 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 e6936f9be41..c9a01f44ec2 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}));