From 1db0e02521ef26f3fd07adf386f75e7508aec2b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 31 Oct 2021 10:42:08 +0100 Subject: [PATCH] Do not try to expand pseudo-children of reference field Since issue5667 the export dialog adds pseudo children to reference fields but they are not children nodes but just sibling. So we must not try to expand the node of the reference field when loading an predefined export. issue10875 review383511003 (grafted from 0fb9992f455702540f0aa4ef82ec3260a06907a1) --HG-- branch : 6.0 --- src/window.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/window.js b/src/window.js index ff3998893c..8fdccc5e11 100644 --- a/src/window.js +++ b/src/window.js @@ -1345,7 +1345,7 @@ }.bind(this)); }, children_expand: function(node) { - if (jQuery.isEmptyObject(node.children)) { + if (jQuery.isEmptyObject(node.children) && node.relation) { this.model_populate( this._get_fields(node.relation), node.children, node.field + '/', node.name + '/'); @@ -1415,9 +1415,10 @@ if (field.name == (prefix + parents[i]) || field.field == (prefix + parents[i])) { this.children_expand(field); - fields = field.children; prefix += parents[i] + '/'; - this._traverse(fields, prefix, parents, ++i); + if (field.children) { + this._traverse(field.children, prefix, parents, ++i); + } break; } } @@ -1720,7 +1721,7 @@ }.bind(this)); }, children_expand: function(node) { - if (jQuery.isEmptyObject(node.children)) { + if (jQuery.isEmptyObject(node.children) && node.relation) { this.model_populate( this._get_fields(node.relation), node.children, node.path + '/', node.long_string + '/'); @@ -1865,9 +1866,10 @@ field = fields[names[item]]; if (field.path == (prefix + parents[i])) { this.children_expand(field); - fields = field.children; prefix += parents[i] + '/'; - this._traverse(fields, prefix, parents, ++i); + if (field.children) { + this._traverse(field.children, prefix, parents, ++i); + } break; } }