Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Org Chart fixes (backport #27290) #46183

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ erpnext.HierarchyChart = class {
let node = undefined;

$.each(r.message, (_i, data) => {
<<<<<<< HEAD
if ($(`[id="${data.id}"]`).length)
=======
if ($(`#${data.id}`).length)
>>>>>>> f828d853e3 (fix: Org Chart fixes (#27290))
return;

node = new me.Node({
Expand Down Expand Up @@ -351,13 +355,21 @@ erpnext.HierarchyChart = class {
}

get_all_nodes() {
<<<<<<< HEAD
let me = this;
=======
>>>>>>> f828d853e3 (fix: Org Chart fixes (#27290))
return new Promise(resolve => {
frappe.call({
method: 'erpnext.utilities.hierarchy_chart.get_all_nodes',
args: {
<<<<<<< HEAD
method: me.method,
company: me.company
=======
method: this.method,
company: this.company
>>>>>>> f828d853e3 (fix: Org Chart fixes (#27290))
},
callback: (r) => {
resolve(r.message);
Expand Down
8 changes: 8 additions & 0 deletions erpnext/utilities/hierarchy_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

@frappe.whitelist()
def get_all_nodes(method, company):
<<<<<<< HEAD
"""Recursively gets all data from nodes"""
=======
'''Recursively gets all data from nodes'''
>>>>>>> f828d853e3 (fix: Org Chart fixes (#27290))
method = frappe.get_attr(method)

if method not in frappe.whitelisted:
Expand All @@ -21,9 +25,13 @@ def get_all_nodes(method, company):
for root in root_nodes:
data = method(root.id, company)
result.append(dict(parent=root.id, parent_name=root.name, data=data))
<<<<<<< HEAD
nodes_to_expand.extend(
[{"id": d.get("id"), "name": d.get("name")} for d in data if d.get("expandable")]
)
=======
nodes_to_expand.extend([{'id': d.get('id'), 'name': d.get('name')} for d in data if d.get('expandable')])
>>>>>>> f828d853e3 (fix: Org Chart fixes (#27290))

while nodes_to_expand:
parent = nodes_to_expand.pop(0)
Expand Down
Loading