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
This commit is contained in:
Cédric Krier committed 2021-10-31 10:42:08 +01:00
1 parent cba86a2b53
commit 69883c4ef2
1 file changed
+8 -6
+8 -6
View File
@@ -1372,7 +1372,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 + '/');
@@ -1442,9 +1442,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;
}
}
@@ -1750,7 +1751,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 + '/');
@@ -1895,9 +1896,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;
}
}