changeset 6016ad384588 in sao:5.8
details: https://hg.tryton.org/sao?cmd=changeset&node=6016ad384588
description:
        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)
diffstat:

 src/window.js |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 15149d6981b1 -r 6016ad384588 src/window.js
--- a/src/window.js     Sun Oct 31 10:24:32 2021 +0100
+++ b/src/window.js     Sun Oct 31 10:42:08 2021 +0100
@@ -1309,7 +1309,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 + '/');
@@ -1379,9 +1379,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;
                 }
             }
@@ -1671,7 +1672,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 + '/');
@@ -1816,9 +1817,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;
                 }
             }

Reply via email to