From cbc63ca8696d8a89c97a88f73743fb0bd5a7c1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 30 Mar 2017 16:28:19 +0200 Subject: [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. --- addons/web/static/src/js/views/basic/basic_model.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'addons/web/static/src') 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, -- cgit v1.2.3