feat: Demo data creation
diff --git a/erpnext/setup/demo.py b/erpnext/setup/demo.py
new file mode 100644
index 0000000..95e8a4d
--- /dev/null
+++ b/erpnext/setup/demo.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import json
+import os
+
+import frappe
+
+
+@frappe.whitelist()
+def setup_demo_data():
+ create_demo_company()
+ process_demo_data()
+ make_transactions()
+
+
+def create_demo_company():
+ company = frappe.db.get_value("Company", {"docstatus": 0})
+ company_doc = frappe.get_doc("Company", company)
+
+ # Make a dummy company
+ new_company = frappe.new_doc("Company")
+ new_company.company_name = company_doc.company_name + " (Demo)"
+ new_company.abbr = company_doc.abbr + "D"
+ new_company.enable_perpetual_inventory = 1
+ new_company.default_currency = company_doc.default_currency
+ new_company.country = company_doc.country
+ new_company.chart_of_accounts_based_on = "Standard Template"
+ new_company.chart_of_accounts = company_doc.chart_of_accounts
+ new_company.insert()
+
+
+def process_demo_data():
+ demo_doctypes = frappe.get_hooks("demo_doctypes") or []
+ path = os.path.join(os.path.dirname(__file__), "demo_data")
+ for doctype in demo_doctypes:
+ with open(os.path.join(path, doctype + ".json"), "r") as f:
+ data = f.read()
+ if data:
+ for item in json.loads(data):
+ create_demo_record(item)
+
+
+def create_demo_record(doctype):
+ frappe.get_doc(doctype).insert(ignore_permissions=True)
+
+
+def make_transactions():
+ pass
diff --git a/erpnext/setup/demo_data/items.json b/erpnext/setup/demo_data/items.json
new file mode 100644
index 0000000..fed36e2
--- /dev/null
+++ b/erpnext/setup/demo_data/items.json
@@ -0,0 +1,62 @@
+[
+ {
+ "doctype": "Item",
+ "item_code": "SKU001",
+ "item_name": "T-shirt",
+ "image": "https://www.shutterstock.com/image-photo/close-man-blank-tshirt-140861086"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU002",
+ "item_name": "Laptop",
+ "image": "https://www.shutterstock.com/image-photo/laptop-computer-blank-screen-isolated-on-1721445466"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU003",
+ "item_name": "Book",
+ "image": "https://www.shutterstock.com/image-vector/blank-vertical-book-cover-template-pages-172777709"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU004",
+ "item_name": "Smartphone",
+ "image": "https://www.shutterstock.com/image-vector/realistic-smartphone-mockup-front-back-1450789832"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU005",
+ "item_name": "Sneakers",
+ "image": "https://www.shutterstock.com/image-photo/white-sneaker-sport-shoe-on-purple-2155395817"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU006",
+ "item_name": "Coffee Mug",
+ "image": "https://www.shutterstock.com/image-vector/realistic-white-cup-isolated-on-transparent-585104080"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU007",
+ "item_name": "Television",
+ "image": "https://www.shutterstock.com/image-photo/tv-flat-screen-lcd-plasma-realistic-314401364"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU008",
+ "item_name": "Backpack",
+ "image": "https://www.shutterstock.com/image-photo/school-backpack-on-white-background-1440715766"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU009",
+ "item_name": "Headphones",
+ "image": "https://www.shutterstock.com/image-illustration/3d-rendering-yellow-headphones-isolated-on-1833307018"
+ },
+ {
+ "doctype": "Item",
+ "item_code": "SKU010",
+ "item_name": "Camera",
+ "image": "https://www.shutterstock.com/image-photo/camera-610909205"
+ }
+]
\ No newline at end of file