[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) <rli@odoo.com>
This commit is contained in:
RomainLibert
2019-07-19 08:36:48 +00:00
parent 234d877914
commit 2b8b828867
@@ -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)) {