[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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user