[FIX] ensures the o2m is correctly saved before activating action buttons, even when a row is being edited

bzr revid: xmo@openerp.com-20120709110112-dgpm1jhb9o2lmweg
This commit is contained in:
Xavier Morel 2012-07-09 13:01:12 +02:00
parent d51c9a8590
commit e9921d62df
1 changed files with 11 additions and 5 deletions

View File

@ -3243,11 +3243,17 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
readonly: self.o2m.get("effective_readonly")
});
},
do_button_action: function (name, id, callback) {
var _super = _.bind(this._super, this);
this.o2m.view.do_save().then(function () {
_super(name, id, callback);
/**
* Ensures the o2m is saved and committed to db before returning: executes
* the super-method (saves the current edition to the buffered dataset)
* then saves the parent form.
*
* @returns {jQuery.Deferred}
*/
ensureSaved: function () {
var parent_form = this.o2m.view;
return this._super().pipe(function () {
return parent_form.do_save();
});
}
});