From 5ab5ccba40ad16aaa2a1f01a7b87c53eb804baaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 25 Oct 2018 07:51:00 +0000 Subject: [PATCH] [REF] web: remove useless code The utility function xml_to_json, which is mainly used by the views to parse their arch (from string to xml tree) had a peculiar behaviour: it tried to process some attributes as json. If by chance, these attributes are valid json, then they are replaced by their parsed value. It is difficult to say why it could be useful. Maybe this was done to prevent using pyeval many times later on. But if that is the case, it should be done by the view code and not the utility function (the view can precompute all attributes once). Also, this behaviour is annoying for code later in the chain, which needs to check if what it gets is an object or a string. With this change, attributes are always returned as string (at this point). closes odoo/odoo#28133 --- addons/web/static/src/js/core/utils.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js index f4031fccec9..5d707d951bb 100644 --- a/addons/web/static/src/js/core/utils.js +++ b/addons/web/static/src/js/core/utils.js @@ -427,13 +427,6 @@ var utils = { return (strip_whitespace && node.data.trim() === '') ? undefined : node.data; case 1: var attrs = $(node).getAttributes(); - _.each(['domain', 'filter_domain', 'context', 'default_get'], function (key) { - if (attrs[key]) { - try { - attrs[key] = JSON.parse(attrs[key]); - } catch(e) { } - } - }); return { tag: node.tagName.toLowerCase(), attrs: attrs,