Warehouse hierarchy [Tree/Nested Set]

  • 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

2 Likes