[FIX] error caused by autosave-on-blur when vaidating a row with [Return]

bzr revid: xmo@openerp.com-20120619110350-64sb4uy2t1eydiou
This commit is contained in:
Xavier Morel 2012-06-19 13:03:50 +02:00
parent 125eead80a
commit 19d5cb01c7
1 changed files with 14 additions and 0 deletions

View File

@ -2730,16 +2730,30 @@ openerp.web.form.One2ManyListView = openerp.web.ListView.extend({
}
});
openerp.web.form.One2ManyList = openerp.web.ListView.List.extend({
KEY_RETURN: 13,
// blurring caused by hitting the [Return] key, should skip the
// autosave-on-blur and let the handler for [Return] do its thing
__return_blur: false,
render_row_as_form: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
$(self.edition_form).bind('form-blur', function () {
if (self.__return_blur) {
delete self.__return_blur;
return;
}
if (!self.edition_form.widget_is_stopped) {
self.view.ensure_saved();
}
});
});
},
on_row_keyup: function (e) {
if (e.which === this.KEY_RETURN) {
this.__return_blur = true;
}
this._super(e);
}
});
openerp.web.form.One2ManyFormView = openerp.web.FormView.extend({