[enhancement] warehouse tree structure

This commit is contained in:
Saurabh
2016-05-24 07:49:00 +05:30
parent b72a2955ac
commit dfbcdeb8a0
4 changed files with 182 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
import frappe
from frappe import _
def execute():
if not frappe.db.exists("Warehouse", {"warehouse_name": _("All Warehouses")}):
parent_warehouse = frappe.get_doc({
"doctype": "Warehouse",
"warehouse_name": _("All Warehouses"),
"is_group": "Yes"
}).insert(ignore_permissions=True)
for warehouse in frappe.db.sql_list("""select name from tabWarehouse
where name != %s order by name asc""", "All Warehouses - SI"):
print warehouse
warehouse = frappe.get_doc("Warehouse", warehouse)
warehouse.is_group = "No"
warehouse.parent_warehouse = parent_warehouse.name
warehouse.save(ignore_permissions=True)