[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
This commit is contained in:
Xavier Morel
2011-12-05 16:38:13 +01:00
parent d39e30130b
commit b7aa4e4712
+1
View File
@@ -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;});