From 9fbed63406702b43e41262da24d68f63feb582f0 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 26 Jun 2017 15:40:09 +0200 Subject: [FIX] web: FieldSelection on m2o: unset value When the value of a many2one field with widget selection was unset, it's value wasn't actually set to false in the BasicModel. It was set to a virtual id like 'virtual_294' instead. This caused a traceback when this value was sent to the server, obviously. This was for example the case of the Register Payment form view (accessible from a customer invoice), when the user selected a payment journal, and then unselected it (the virtual id was then sent to the onchange RPC). --- 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 1001ac73857..811e3632975 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1001,7 +1001,7 @@ var BasicModel = AbstractModel.extend({ */ _applyMany2OneChange: function (record, fieldName, data) { var self = this; - if (!data) { + if (!data || data.id === false) { record._changes[fieldName] = false; return $.when(); } -- cgit v1.2.3