[FIX] cancel list edition on search

Otherwise, if a search is performed while creating or editing a line
(e.g. in logged calls, create a line without saving then try to apply
a filter) the edition section (and new line) disappears but the list
remains in "edition" mode (e.g. save/discard button) even though
edition data is missing (trying to save or discard will error out).

bzr revid: xmo@openerp.com-20121210100914-delia5bhmtgrujpu
This commit is contained in:
Xavier Morel 2012-12-10 11:09:14 +01:00
parent f9e610a890
commit e972b6a5d4
1 changed files with 9 additions and 2 deletions

View File

@ -105,8 +105,15 @@ openerp.web.list_editable = function (instance) {
* Replace do_search to handle editability process
*/
do_search: function(domain, context, group_by) {
this._context_editable = !!context.set_editable;
this._super.apply(this, arguments);
var self=this, _super = self._super, args=arguments;
var ready = this.editor.is_editing()
? this.cancel_edition(true)
: $.when();
return ready.then(function () {
self._context_editable = !!context.set_editable;
return _super.apply(self, args);
});
},
/**
* Replace do_add_record to handle editability (and adding new record