[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
This commit is contained in:
parent
13092cfab4
commit
32d90f6014
|
@ -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
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue