summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-03-30 16:28:19 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commitcbc63ca8696d8a89c97a88f73743fb0bd5a7c1ec (patch)
tree7bca5c2e9696fea738847c8557e1954713683001 /addons/web/static/src
parente3f84e592ea5b734201d0532253fe0790eab49a6 (diff)
[FIX] web: properly handle onchanges after discard
When an onchange is resolved after a discard, it caused a traceback. We now make sure that it does not happen. Note: I think that the test is quite neat.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js7
1 files changed, 7 insertions, 0 deletions
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 b2c061f49e7..b4d343d7eb0 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1049,6 +1049,13 @@ var BasicModel = AbstractModel.extend({
args: [idList, currentData, fields, onchange_spec, context],
})
.then(function (result) {
+ if (!record._changes) {
+ // if the _changes key does not exist anymore, it means that
+ // it was removed by discarding the changes after the rpc
+ // to onchange. So, in that case, the proper response is to
+ // ignore the onchange.
+ return;
+ }
if (result.warning) {
self.trigger_up('warning', {
message: result.warning.message,