From 1d57f89380b3b23aed9404fdd70a63274d3ca99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 26 May 2017 14:19:09 +0200 Subject: [FIX] web: properly react when save operation fails (form) Before this commit, the save method in the basic model did not properly react when the rpc fails. In that case, the returned deferred stayed indefinitely in the 'pending' state. This is a big problem, because the basic controller put that deferred in a mutex. As a result, every subsequent operations (including field changes!) were indefinitely delayed. To reproduce the issue, you can find any form view where some python business logic will cause a fail in some cases. For example, create a new inventory adjustement, click on 'Start inventory', then add a line in the x2many with the same product as another line. Saving that record will fail, but then, the form view is broken: no interaction will work. --- addons/web/static/src/js/views/basic/basic_model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 84ae999ac88..9af32adda93 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -778,7 +778,7 @@ var BasicModel = AbstractModel.extend({ _.extend(record.data, _changes); def.resolve(changedFields); } - }); + }).fail(def.reject.bind(def)); } else { def.resolve(changedFields); } -- cgit v1.2.3