From fd7b767637cd9563e9869adf537150867925f120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Mon, 20 Nov 2017 15:17:23 +0100 Subject: [FIX] web: empty field char should be set to false With the new views, empty char fields were sent to the server as '' (empty string) instead of false. This is not the correct behaviour, and actually cause some problems. For example, if you have a char field with a unicity constraint, then you cannot set it to '', since there is only one record that can take that value. --- addons/web/static/src/js/views/basic/basic_model.js | 2 ++ 1 file changed, 2 insertions(+) (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 ed18be034af..e8f4a3993fa 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2499,6 +2499,8 @@ var BasicModel = AbstractModel.extend({ changes[fieldName] = value ? this.localData[value].model + ',' + this.localData[value].res_id : false; + } else if (type === 'char' && changes[fieldName] === '') { + changes[fieldName] = false; } else if (changes[fieldName] === null) { changes[fieldName] = false; } -- cgit v1.2.3