[FIX] web: editable list view waits for record to be loaded

The editable list view method 'edit' is supposed to wait for the
record to be completely loaded.  But when loading the defaults values,
it ignored the actual loading and completed too early.  This commit
chains the deferred with the form record.
This commit is contained in:
Géry Debongnie
2016-04-06 12:30:30 +02:00
parent 6e6e8ea185
commit c4e0562144
@@ -83,16 +83,18 @@ var Editor = Widget.extend({
return (this.is_editing() && !this.record.id);
},
edit: function (record, configureField) {
var self = this;
// TODO: specify sequence of edit calls
var loaded;
if(record) {
this.form.trigger('load_record', _.extend({}, record));
loaded = this.form.record_loaded;
} else {
loaded = this.form.load_defaults();
loaded = this.form.load_defaults().then(function() {
return self.form.record_loaded;
});
}
var self = this;
return loaded.then(function () {
return self.do_show({reload: false});
}).then(function () {