Warehouse hierarchy [Tree/Nested Set]

I need nested set/tree for warehouse just like accounts and sales person tree.

Can someone guide how to go about that?

Only if you promise to send a pull request :smile:

Sure thing :wink:

  • Add properties parent_warehouse
  • Add properties old_parent, lft (int) and rgt (int) see “Account” DocType
  • In Warehouse class, set nsm_parent_field as parent_warehouse [1]
  • In on_update and on_trash call update_nsm (see Account class)
  • That will build the nested set tree for you.
  • You can also extend sales_browser to include Warehouse along with Item Group, Customer Group etc for the Tree View (I can help you with that)
  • Add entries in stock.py similar to Item Group

You will also need to create reports for that?

[1] erpnext/account.py at develop · frappe/erpnext · GitHub

[2] erpnext/account.py at develop · frappe/erpnext · GitHub

1 Like

I am there, we can now tree out warehouses. But requirement is for the tree to be more like Account/Cost center i.e. filtered by company.

Should we create a “Warehouse Browser” or extend Account Browser?

Yes, need to update reports too.


But name it warehouse-browser though. The earlier ones were badly named

You might also want to set an is_group property so that entries are not made against that and also validate while making an Stock Ledger Entry

You will also need to give the user an option to switch between is_group or not based on conditions.

@rmehta, Im not sure if other users requested a hierarchy of customers and suppliers.

We have a requirement in our business (that im going to try to update in erpnext) that needs to have a hierarchy of customers linking “Group” company and branches (which are also seperate customers) and then sub divisions etc. All this is for reporting purposes and managing a more “match” reality CRM with contact etc.

Same will apply to suppliers.

I will attempt this myself, but im super slow as im still learning my way around frappe and erpment. But I dont want to continue if this is already on the roadmap.

Also, I think I need some more info regarding git, as I will need that when im ready to share it back to the rest of the team.

Await your thoughts.


@hpema108 its on the roadmap, but not scheduled, so please go ahead.

Lot of git help is available at : https://help.github.com/articles/using-pull-requests/

@rmehta @BhupeshGupta was this project ever finished? I couldn’t find any pull requests.

@rmehta I am attempting to follow these instructions. I have done everything up to extending the sales_browser and adding entries in stock.py, I’m not sure how to do that. Any assistance is appreciated. I can send a pull request now, or if you tell me how to extend the sales browser (or create the warehouse browser) then I can do that as well and send it all at once.

@Christopher_Gregory_ Thanks for taking this up!. Please send your pull request. We can review it.

sales_browser is not very well written. You will have to add an extension like Item Group, Customer Group.

Push your code, we can also fix issues at our end.

Warehouses in Tree Form is available to all? I could not find it out.

This was never finished.

This has been fixed in V7. Closing.