summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-02-05 12:54:29 +0000
committerVincent Schippefilt <vsc@odoo.com>2019-02-06 11:57:58 +0000
commit7d1957da8f563d096514b587ec96aede5b204007 (patch)
treeedae6ee8605d5f50581424cff262168881eacab8 /addons/web/static/src/js
parent930839c76bd78fb983f1ea819c49ad20d65cff07 (diff)
[FIX] web: hang when saving then discarding
When editing a record, if it cannot be saved (b.e. due to required fields) and the user clicks on save, then on discard Before this fix, the window did nothing (seems like it is unresponsive) After this fix, the user is able to discard the form. task-id: 1937142 closes odoo/odoo#30871
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_controller.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js
index 01bbd9cd2fe..16204c83163 100644
--- a/addons/web/static/src/js/views/basic/basic_controller.js
+++ b/addons/web/static/src/js/views/basic/basic_controller.js
@@ -188,12 +188,18 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
// mutex-protected as commitChanges function of x2m has to be aware of
// all final changes made to a row.
var self = this;
- this.savingDef = this.mutex.getUnlockedDef().then(function () {
- return self.renderer.commitChanges(recordID || self.handle).then(function () {
+ var savingDef = $.Deferred();
+ this.savingDef = savingDef;
+
+ return this.mutex.getUnlockedDef()
+ .then(function () {
+ return self.renderer.commitChanges(recordID || self.handle);
+ })
+ .then(function () {
return self.mutex.exec(self._saveRecord.bind(self, recordID, options));
- });
- });
- return this.savingDef;
+ })
+ .then(savingDef.resolve.bind(savingDef))
+ .fail(savingDef.resolve.bind(savingDef));
},
/**
* @override