From e9921d62df5c7811aeaa83225b6e5a1877ca4df0 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 9 Jul 2012 13:01:12 +0200 Subject: [PATCH] [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 --- addons/web/static/src/js/view_form.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 2620694b74b..14fa87e5be5 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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(); }); } });