fix: do not sort by number of connections
This commit is contained in:
parent
a48b23e6a5
commit
b6715189fb
@ -24,7 +24,6 @@ def get_children(parent=None, company=None):
|
|||||||
employee.connections = get_connections(employee.id)
|
employee.connections = get_connections(employee.id)
|
||||||
employee.expandable = 1 if is_expandable else 0
|
employee.expandable = 1 if is_expandable else 0
|
||||||
|
|
||||||
employees.sort(key=lambda x: x['connections'], reverse=True)
|
|
||||||
return employees
|
return employees
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ erpnext.HierarchyChart = class {
|
|||||||
}
|
}
|
||||||
}).then(r => {
|
}).then(r => {
|
||||||
if (r.message.length) {
|
if (r.message.length) {
|
||||||
|
let expand_node = undefined;
|
||||||
let node = undefined;
|
let node = undefined;
|
||||||
let first_root = undefined;
|
|
||||||
|
|
||||||
$.each(r.message, (i, data) => {
|
$.each(r.message, (i, data) => {
|
||||||
node = new me.Node({
|
node = new me.Node({
|
||||||
@ -151,11 +151,11 @@ erpnext.HierarchyChart = class {
|
|||||||
is_root: true
|
is_root: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (i == 0)
|
if (!expand_node && data.connections)
|
||||||
first_root = node;
|
expand_node = node;
|
||||||
});
|
});
|
||||||
|
|
||||||
me.expand_node(first_root);
|
me.expand_node(expand_node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user