YATLS (Yet another tree-like structure) question

Hello and “Happy new year” to everyone,

I am playing with a local installation of ERPNext for a few months now for testing and I want to ask the community what would be a good approach for the following problem: I need to keep a tree-like structure of orders, units and sub-units coming from the customers. (Please ignore the fact that these are called “orders” or “units” etc.; thay could be called anyway you want.). The Orders would contain Units and each unit would contain SubUnits like in the structure below:


Each leaf from the tree structure above has to have also other properties; for example an Order would have a name, a date; a Unit would have a name, a version number, a status, etc.


My first approach was to create inside the manufacturing module three different doc types: Orders, Units (as a child table of orders) and SubUnits (as a child table of units).
The Units doc type was intended to be displayed as a table inside the Orders and the SubUnits as a table inside the Units table. As you may already guessed it did not quite worked. Displaying a doct type as a table inside another doc type works but going deeper than one level does not. Makes sense.


The second approach was to create the same three different doc types but, instead of displaying them as nested tables, I thought of creating links from SubUnits to Units and from Units to Orders. This approach kinda works but I feel it is a little harder to find the information and to maintain it throughout the doc types.


To put the cherry on top I would have liked to have the tree structure displayed in ERPNext displayed in the left (like in the windows explorer) but I couldn’t find a way. I also tried to play a little bit with the tree structure from the Chart of Accounts and to find a way to adapt it somehow to my needs but with no avail.

Could you please guide me on how would be the best way to accomplish the tree-like structure I need?

Thank you in advance,
Sorin

1 Like

@sorin.negulescu Happy new year to you too and welcome to the forum?

Can you be more specific? Do you want this for standard orders or a completely new concept?

If you want it in standard doctypes, one way would be to script the list views e.g. desk/#List/Sales Order and extend them to be “expandable”

Overall, the philosophy of Frappe is to be extremely standardized in the UI and use metadata as the way to design the views.

Hello,

I would need this for a new concept / not for the standard orders.
Hopefully the solution wouldn’t involve coding (I am a very good python programmer but I haven’t had the time to dig into the ERPNext’s code). I also read your answer in this thread: Warehouse hierarchy [Tree/Nested Set] - #4 by rmehta

Let me put the problem in another way (3rd approach): take the Project, Project Task and Task doc types.
I saw that while creating a new task in the Project it will also be visible in Task (and I presume that behind the scenes it is actually initially created in Project Task which has the is child table check-box checked.).

In the same way I would need to create an Unit inside Order but I would need the Units to be editable also from outside the Orders page (like tasks can be edited both inside the projects and outside the projects page). I think that this approach requires 3 doc types one of which would be a child table (not editable directtly).

Thank you,
Sorin

The Project / Task table is actually a hack: erpnext/project.py at develop · frappe/erpnext · GitHub && erpnext/project.py at develop · frappe/erpnext · GitHub

Maybe this pattern could be standard, but we have not seen enough use cases though!

Hello and thank you for your prompt response!

4th approach: suppose we have the following (logical) structure:

Orders: (doc type)

  • title (data)
  • number (data)
  • date (date)
  • units list (???)

Units: (doc type)

  • name (data)
  • type (data)
  • status (data)
  • order id (link)
  • subunits list (???)

SubUnits: (doc type)

  • name (data)
  • type (data)
  • unit id (link)

So, the SubUnits would have a link to Unit id and the Units would have a link to Order id. Is there a way to have the Orders display a list of linked Units and the Units display a list of linked SubUnits?

Thank you,

@sorin.negulescu not out of the box. you might have to do hacks.

Create an HTML type field to create a place holder and then build your custom UI.

Depending on the use case, I would still recommend ways of using the standard frappe ui, so it works well on all devices.

Hello @rmehta,

I would like to use the standard frappe user interface so everything looks homogeneous (and I also like it very much).

But is there a way to have this 3rd level of nesting (imbrication)?

Not as of now!