[FIX] problem with list editable in o2m

bzr revid: nicolas.vanhoren@openerp.com-20121114103156-tzbz8sm4x54jgjvm
This commit is contained in:
niv-openerp 2012-11-14 11:31:56 +01:00
parent 9114457d71
commit 729eb0ff4f
1 changed files with 29 additions and 30 deletions

View File

@ -157,13 +157,7 @@ openerp.web.list_editable = function (instance) {
* @returns {$.Deferred}
*/
ensure_saved: function () {
var self = this;
return this.saving_mutex.exec(function() {
if (!self.editor.is_editing()) {
return $.when();
}
return self.save_edition();
});
return this.save_edition();
},
/**
* Builds a record with the provided id (``false`` for a creation),
@ -273,12 +267,16 @@ openerp.web.list_editable = function (instance) {
*/
save_edition: function () {
var self = this;
return this.with_event('save', {
editor: this.editor,
form: this.editor.form,
return self.saving_mutex.exec(function() {
if (!self.editor.is_editing()) {
return $.when();
}
return self.with_event('save', {
editor: self.editor,
form: self.editor.form,
cancel: false
}, function () {
return this.editor.save().then(function (attrs) {
return self.editor.save().then(function (attrs) {
var created = false;
var record = self.records.get(attrs.id);
if (!record) {
@ -298,6 +296,7 @@ openerp.web.list_editable = function (instance) {
return { created: created, record: record }; });
});
});
});
},
/**
* @param {Boolean} [force=false] discards the data even if the form has been edited