[IMP] web: multi-click on save on view form (no fp)
When clicking on save several time when editing a view form it can be
saved several times which can be an issue for one to many.
The normal happenstance when saving should be as follow:
-> save (click)
-> wait write result
-> received write result
-> reload the form with updated data and updates buttons
But when clicking several time, it could become:
-> save (click)
-> wait write result
-> received write result
-> save (click)
-> wait write result
-> received write result
-> reload the form with updated data and updates buttons
This commit only reinstate the saving feature once the form is reloaded.
related to opw-671793
backport of 8.0's dd714ac
note: no need to forward-port
This commit is contained in:
parent
f4cb884cdc
commit
ae9d57bc1e
|
@ -726,14 +726,16 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
||||||
$(e.target).attr("disabled", true);
|
$(e.target).attr("disabled", true);
|
||||||
return this.save().done(function(result) {
|
return this.save().done(function(result) {
|
||||||
self.trigger("save", result);
|
self.trigger("save", result);
|
||||||
self.reload().then(function() {
|
self.reload().always(function(){
|
||||||
|
$(e.target).attr("disabled", false);
|
||||||
|
}).then(function() {
|
||||||
self.to_view_mode();
|
self.to_view_mode();
|
||||||
var parent = self.ViewManager.ActionManager.getParent();
|
var parent = self.ViewManager.ActionManager.getParent();
|
||||||
if(parent){
|
if(parent){
|
||||||
parent.menu.do_reload_needaction();
|
parent.menu.do_reload_needaction();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).always(function(){
|
}).fail(function(){
|
||||||
$(e.target).attr("disabled", false);
|
$(e.target).attr("disabled", false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue