mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-09 23:39:28 +00:00
[enhance] warehouse browser page for warehouse tree
This commit is contained in:
@@ -87,15 +87,22 @@ class Company(Document):
|
||||
.format(self.country.lower()))(self)
|
||||
|
||||
def create_default_warehouses(self):
|
||||
for whname in (_("Stores"), _("Work In Progress"), _("Finished Goods")):
|
||||
if not frappe.db.exists("Warehouse", whname + " - " + self.abbr):
|
||||
for wh_detail in [{"warehouse_name": _("All Warehouses"), "is_group": "Yes"},
|
||||
{"warehouse_name": _("Stores"), "is_group": "No"},
|
||||
{"warehouse_name": _("Work In Progress"), "is_group": "No"},
|
||||
{"warehouse_name": _("Finished Goods"), "is_group": "No"}]:
|
||||
|
||||
if not frappe.db.exists("Warehouse", "{0} - {1}".format(wh_detail["warehouse_name"], self.abbr)):
|
||||
stock_group = frappe.db.get_value("Account", {"account_type": "Stock",
|
||||
"is_group": 1, "company": self.name})
|
||||
if stock_group:
|
||||
warehouse = frappe.get_doc({
|
||||
"doctype":"Warehouse",
|
||||
"warehouse_name": whname,
|
||||
"warehouse_name": wh_detail["warehouse_name"],
|
||||
"is_group": wh_detail["is_group"],
|
||||
"company": self.name,
|
||||
"parent_warehouse": "" if wh_detail["is_group"] == "Yes" \
|
||||
else "{0} - {1}".format(_("All Warehouses"), self.abbr),
|
||||
"create_account_under": stock_group
|
||||
})
|
||||
warehouse.flags.ignore_permissions = True
|
||||
|
||||
Reference in New Issue
Block a user