summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-03-06 15:55:27 +0100
committerXavier Morel <xmo@openerp.com>2013-03-06 15:55:27 +0100
commit32d90f6014d41bfbee8550d9d592dac550030c70 (patch)
treee92890c3de1c853b142fc39f90206a3283a05ba0 /addons/web/static/src
parent13092cfab4a7b1b5d4b73bbd7a87b974f4cdafc7 (diff)
[FIX] cleanup m2o field events when reloading m2o fields
The big issue was the hooking on the closest ui-dialog's scroll event: if an m2o in a dialog (e.g. wizard-type situations) toggled state from editable to readonly (workflow action of some sort), the event hook would remain, and call .$input.autocomplete("widget") which would blow up because the autocompletion widget hasn't been re-initialized. Take care to fully unbind all events during the reload process to avoid this issue (and potentially other such as duplicate bindings and the like). lp bug: https://launchpad.net/bugs/1146321 fixed bzr revid: xmo@openerp.com-20130306145527-sssv7ocfvqxgv896
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/view_form.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 7ba45c865f3..07f06fa89ef 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -3020,6 +3020,26 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
if (!this.get("effective_readonly"))
this.render_editable();
},
+ destroy_content: function () {
+ if (this.$drop_down) {
+ this.$drop_down.off('click');
+ delete this.$drop_down;
+ }
+ if (this.$input) {
+ this.$input.closest(".ui-dialog .ui-dialog-content").off('scroll');
+ this.$input.off('keyup blur autocompleteclose autocompleteopen ' +
+ 'focus focusout change keydown');
+ delete this.$input;
+ }
+ if (this.$follow_button) {
+ this.$follow_button.off('blur focus click');
+ delete this.$follow_button;
+ }
+ },
+ destroy: function () {
+ this.destroy_content();
+ return this._super();
+ },
init_error_displayer: function() {
// nothing
},