Organizational Chart

Is this Organization Chart control generic enough to be used for other hierarchical doctypes ?

1 Like

Hi Guimorin,

I haven’t read the full code yet and analyzed it, but looks like it is tied to the “reports to” field and the ‘Employee’ DocType.

So I don’t believe it’s generic yet.

Yes I understand, this file is the page in hr module.

But I was hoping the file hierarchy_chart_desktop.js to be generic and reusable, yet I see a breadcrumb ‘HR’ added here, so I am not sure:

Does not appear to be generic. There are references to “HR” as you pointed out as well as “Employee” in the code.

Perhaps you can duplicate the Doctype along with it’s scripts and try to maneuver your way around this breadcrumb… possibly even posting back here…

I was thinking something in the line of adding a field for reference doctype, from which a specific hierarchy can be obtained

also there is a reference to Employee.‘reports_to’ field:

IMO: Best thing would be to extract what this Functionality needs and define a Interface or use Dependency Injection/Inversion of Control to dry this and let other objects implement it.

I have not spent enough time looking at some other core functionality code to determine what has been the framework’s approach to it.

Thanks for your inputs, but I am not referencing the organizational_chart custom page in the HR module you are all posting about.

I’m speaking of the HierarchyChart, which seems mostly generic, except for the HR breadcrumbs reference. I’ll ask on github why it’s there, probably an error.

Great idea to reuse the organizational chart for other hierarchical doctypes!