In edit mode, in a *2many with many2many_tags, when adding a new tag when none was set, discarding the form let the new tags displayed while it shouldn't (only a display issue, the tag wasn't added in database)
Fixes #2926
this.mutating_mutex = new $.Mutex();
this.on_change_list = [];
this.save_list = [];
this.mutating_mutex = new $.Mutex();
this.on_change_list = [];
this.save_list = [];
+ this.render_value_defs = [];
this.reload_mutex = new $.Mutex();
this.__clicked_inside = false;
this.__blur_timeout = null;
this.reload_mutex = new $.Mutex();
this.__clicked_inside = false;
this.__blur_timeout = null;
} else if (mode === "create") {
mode = "edit";
}
} else if (mode === "create") {
mode = "edit";
}
+ this.render_value_defs = [];
this.set({actual_mode: mode});
},
check_actual_mode: function(source, options) {
this.set({actual_mode: mode});
},
check_actual_mode: function(source, options) {
});
},
on_button_cancel: function(event) {
});
},
on_button_cancel: function(event) {
if (this.can_be_discarded()) {
if (this.get('actual_mode') === 'create') {
this.trigger('history_back');
} else {
this.to_view_mode();
if (this.can_be_discarded()) {
if (this.get('actual_mode') === 'create') {
this.trigger('history_back');
} else {
this.to_view_mode();
- this.trigger('load_record', this.datarecord);
+ $.when.apply(null, this.render_value_defs).then(function(){
+ self.trigger('load_record', self.datarecord);
+ });
}
}
this.trigger('on_button_cancel');
}
}
this.trigger('on_button_cancel');
instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, {
reinitialize: function() {
instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this);
instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, {
reinitialize: function() {
instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this);
+ this.view.render_value_defs.push(this.render_value());
}
};
if (! values || values.length > 0) {
}
};
if (! values || values.length > 0) {
- this._display_orderer.add(dataset.name_get(values)).done(handle_names);
+ return this._display_orderer.add(dataset.name_get(values)).done(handle_names);
} else {
handle_names([]);
}
} else {
handle_names([]);
}