From 2b8b828867205186f5debe2cdc5e5953c6106cc9 Mon Sep 17 00:00:00 2001 From: RomainLibert Date: Thu, 18 Jul 2019 15:46:03 +0000 Subject: [PATCH] [FIX] website_form: replace False and None by "" In python false is written `False` however JSON only support the notation `false` otherwise JSON.parse fails Again in python a null value is written `None` however `None` is `null` in JSON notation A solution to this incompatibility problem between python and javascript can be to replace `False` and `None`by empty strings on the javascript side. closes odoo/odoo#34995 Signed-off-by: Romain Libert (rli) --- addons/website_form/static/src/js/website_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_form/static/src/js/website_form.js b/addons/website_form/static/src/js/website_form.js index 2469372005c..4fdbf0fd2c1 100644 --- a/addons/website_form/static/src/js/website_form.js +++ b/addons/website_form/static/src/js/website_form.js @@ -57,7 +57,7 @@ odoo.define('website_form.animation', function (require) { // Because, using t-att- inside form make it non-editable var $values = $('[data-for=' + this.$target.attr('id') + ']'); if ($values.length) { - var values = JSON.parse($values.data('values').replace(/'/g, '"')); + var values = JSON.parse($values.data('values').replace('False', '""').replace('None', '""').replace(/'/g, '"')); var fields = _.pluck(this.$target.serializeArray(), 'name'); _.each(fields, function (field) { if (_.has(values, field)) {