From b7aa4e4712e86a0acc23488ee5842e4c6a2a079b Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 5 Dec 2011 16:38:13 +0100 Subject: [PATCH] [FIX] ensure o2m widget has saved its sub-views before it returns its value to its parent form view This is currently highly faillible as saving a form or a list view can be an async operation, yet the FormView's `Widget#get_value` call can only be synchronous. As a result, there are cases where saving a form view can fail to get the correct value for its o2m fields. Ideally, `Widget#get_value` should be an async API (or a sync/async API) bzr revid: xmo@openerp.com-20111205153813-nvgy5413oyf5zsla --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e24455917d9..a4355e1575b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2249,6 +2249,7 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ var self = this; if (!this.dataset) return []; + this.save_any_view(); var val = this.dataset.delete_all ? [commands.delete_all()] : []; val = val.concat(_.map(this.dataset.ids, function(id) { var alter_order = _.detect(self.dataset.to_create, function(x) {return x.id === id;});