[FIX] Correctly stop embedded form when switching from editable to non-editable list
When using the ``set_editable`` feature (context key) from filters (togglable on/off), the list view would not correctly clean up (destroy) the form when switching from editable with a started editor (and form) to non-editable, leading to form fields (in this case m2o fields being in an incorrect state and trying to query a non-started autocompletion widget on every click anywhere blowing it up). lp bug: https://launchpad.net/bugs/1117320 fixed bzr revid: xmo@openerp.com-20130225135629-8k338gw0arsi6m6j
This commit is contained in:
parent
021086d5a8
commit
a8d2327cda
|
@ -132,6 +132,15 @@ openerp.web.list_editable = function (instance) {
|
|||
var self = this;
|
||||
// tree/@editable takes priority on everything else if present.
|
||||
var result = this._super(data, grouped);
|
||||
|
||||
// In case current editor was started previously, also has to run
|
||||
// when toggling from editable to non-editable in case form widgets
|
||||
// have setup global behaviors expecting themselves to exist
|
||||
// somehow.
|
||||
this.editor.destroy();
|
||||
// Editor is not restartable due to formview not being restartable
|
||||
this.editor = this.make_editor();
|
||||
|
||||
if (this.editable()) {
|
||||
this.$el.addClass('oe_list_editable');
|
||||
// FIXME: any hook available to ensure this is only done once?
|
||||
|
@ -143,10 +152,6 @@ openerp.web.list_editable = function (instance) {
|
|||
e.preventDefault();
|
||||
self.cancel_edition();
|
||||
});
|
||||
this.editor.destroy();
|
||||
// Editor is not restartable due to formview not being
|
||||
// restartable
|
||||
this.editor = this.make_editor();
|
||||
var editor_ready = this.editor.prependTo(this.$el)
|
||||
.done(this.proxy('setup_events'));
|
||||
|
||||
|
|
Loading…
Reference in New Issue