From 2bd4497b494e6d3dece46026283cce75beb1da91 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 1 Mar 2017 09:47:39 +0100 Subject: [FIX] web: apply onchange even if warning The onchange route returns field values, but it can also return a warning, that needs to be displayed in a dialog. When it does, the new values must be applied anyway, which wasn't the case before this rev. We generalized the 'warning' custom event handled by the webclient so that it can display a warning in a dialog (and not only through the NotificationManager). --- addons/web/static/src/js/views/basic/basic_model.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic') 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 5f1e6ccbb9c..b16bf1e10b0 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -969,7 +969,11 @@ var BasicModel = AbstractModel.extend({ var args = [idList, currentData, fields, onchange_spec, context]; return self.performModelRPC(record.model, 'onchange', args, {}).then(function (result) { if (result.warning) { - return $.Deferred().reject(result.warning); + self.trigger_up('warning', { + message: result.warning.message, + title: result.warning.title, + type: 'dialog', + }); } var defs = []; _.each(result.value, function (val, name) { -- cgit v1.2.3