From 6b638a196b8c1a6c5e0d732ae86f0c4baccc21dd Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sun, 23 Jan 2022 17:59:00 +0530 Subject: [PATCH] chore: drop dead sample code --- .../setup_wizard/operations/sample_data.py | 179 ------------------ erpnext/setup/setup_wizard/setup_wizard.py | 11 -- .../setup_wizard/tasks/education_masters.md | 9 - erpnext/setup/setup_wizard/tasks/explore.md | 7 - erpnext/setup/setup_wizard/tasks/go_live.md | 18 -- .../setup/setup_wizard/tasks/import_data.md | 5 - erpnext/setup/setup_wizard/tasks/masters.md | 7 - erpnext/setup/setup_wizard/tasks/purchase.md | 10 - erpnext/setup/setup_wizard/tasks/sales.md | 8 - .../setup_wizard/tasks/school_import_data.md | 5 - .../setup/setup_wizard/tasks/task_alert.json | 28 --- 11 files changed, 287 deletions(-) delete mode 100644 erpnext/setup/setup_wizard/operations/sample_data.py delete mode 100644 erpnext/setup/setup_wizard/tasks/education_masters.md delete mode 100644 erpnext/setup/setup_wizard/tasks/explore.md delete mode 100644 erpnext/setup/setup_wizard/tasks/go_live.md delete mode 100644 erpnext/setup/setup_wizard/tasks/import_data.md delete mode 100644 erpnext/setup/setup_wizard/tasks/masters.md delete mode 100644 erpnext/setup/setup_wizard/tasks/purchase.md delete mode 100644 erpnext/setup/setup_wizard/tasks/sales.md delete mode 100644 erpnext/setup/setup_wizard/tasks/school_import_data.md delete mode 100644 erpnext/setup/setup_wizard/tasks/task_alert.json diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py deleted file mode 100644 index 1685994774..0000000000 --- a/erpnext/setup/setup_wizard/operations/sample_data.py +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - - -import json -import os -import random - -import frappe -import frappe.utils -from frappe import _ -from frappe.utils.make_random import add_random_children - - -def make_sample_data(domains, make_dependent = False): - """Create a few opportunities, quotes, material requests, issues, todos, projects - to help the user get started""" - - if make_dependent: - items = frappe.get_all("Item", {'is_sales_item': 1}) - customers = frappe.get_all("Customer") - warehouses = frappe.get_all("Warehouse") - - if items and customers: - for i in range(3): - customer = random.choice(customers).name - make_opportunity(items, customer) - make_quote(items, customer) - - if items and warehouses: - make_material_request(frappe.get_all("Item")) - - make_projects(domains) - import_notification() - -def make_opportunity(items, customer): - b = frappe.get_doc({ - "doctype": "Opportunity", - "opportunity_from": "Customer", - "customer": customer, - "opportunity_type": _("Sales"), - "with_items": 1 - }) - - add_random_children(b, "items", rows=len(items), randomize = { - "qty": (1, 5), - "item_code": ["Item"] - }, unique="item_code") - - b.insert(ignore_permissions=True) - - b.add_comment('Comment', text="This is a dummy record") - -def make_quote(items, customer): - qtn = frappe.get_doc({ - "doctype": "Quotation", - "quotation_to": "Customer", - "party_name": customer, - "order_type": "Sales" - }) - - add_random_children(qtn, "items", rows=len(items), randomize = { - "qty": (1, 5), - "item_code": ["Item"] - }, unique="item_code") - - qtn.insert(ignore_permissions=True) - - qtn.add_comment('Comment', text="This is a dummy record") - -def make_material_request(items): - for i in items: - mr = frappe.get_doc({ - "doctype": "Material Request", - "material_request_type": "Purchase", - "schedule_date": frappe.utils.add_days(frappe.utils.nowdate(), 7), - "items": [{ - "schedule_date": frappe.utils.add_days(frappe.utils.nowdate(), 7), - "item_code": i.name, - "qty": 10 - }] - }) - mr.insert() - mr.submit() - - mr.add_comment('Comment', text="This is a dummy record") - - -def make_issue(): - pass - -def make_projects(domains): - current_date = frappe.utils.nowdate() - project = frappe.get_doc({ - "doctype": "Project", - "project_name": "ERPNext Implementation", - }) - - tasks = [ - { - "title": "Explore ERPNext", - "start_date": current_date, - "end_date": current_date, - "file": "explore.md" - }] - - if 'Education' in domains: - tasks += [ - { - "title": _("Setup your Institute in ERPNext"), - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 1), - "file": "education_masters.md" - }, - { - "title": "Setup Master Data", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 1), - "file": "education_masters.md" - }] - - else: - tasks += [ - { - "title": "Setup Your Company", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 1), - "file": "masters.md" - }, - { - "title": "Start Tracking your Sales", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 2), - "file": "sales.md" - }, - { - "title": "Start Managing Purchases", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 3), - "file": "purchase.md" - }, - { - "title": "Import Data", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 4), - "file": "import_data.md" - }, - { - "title": "Go Live!", - "start_date": current_date, - "end_date": frappe.utils.add_days(current_date, 5), - "file": "go_live.md" - }] - - for t in tasks: - with open (os.path.join(os.path.dirname(__file__), "tasks", t['file'])) as f: - t['description'] = frappe.utils.md_to_html(f.read()) - del t['file'] - - project.append('tasks', t) - - project.insert(ignore_permissions=True) - -def import_notification(): - '''Import notification for task start''' - with open (os.path.join(os.path.dirname(__file__), "tasks/task_alert.json")) as f: - notification = frappe.get_doc(json.loads(f.read())[0]) - notification.insert() - - # trigger the first message! - from frappe.email.doctype.notification.notification import trigger_daily_alerts - trigger_daily_alerts() - -def test_sample(): - frappe.db.sql('delete from `tabNotification`') - frappe.db.sql('delete from tabProject') - frappe.db.sql('delete from tabTask') - make_projects('Education') - import_notification() diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py index c9ed184e04..239e145352 100644 --- a/erpnext/setup/setup_wizard/setup_wizard.py +++ b/erpnext/setup/setup_wizard/setup_wizard.py @@ -7,7 +7,6 @@ from frappe import _ from .operations import company_setup from .operations import install_fixtures as fixtures -from .operations import sample_data def get_setup_stages(args=None): @@ -103,16 +102,6 @@ def fin(args): frappe.local.message_log = [] login_as_first_user(args) - make_sample_data(args.get('domains')) - -def make_sample_data(domains): - try: - sample_data.make_sample_data(domains) - except Exception: - # clear message - if frappe.message_log: - frappe.message_log.pop() - pass def login_as_first_user(args): if args.get("email") and hasattr(frappe.local, "login_manager"): diff --git a/erpnext/setup/setup_wizard/tasks/education_masters.md b/erpnext/setup/setup_wizard/tasks/education_masters.md deleted file mode 100644 index d0887d2d74..0000000000 --- a/erpnext/setup/setup_wizard/tasks/education_masters.md +++ /dev/null @@ -1,9 +0,0 @@ -Lets start making things in ERPNext that are representative of your institution. - -1. Make a list of **Programs** that you offer -1. Add a few **Courses** that your programs cover -1. Create **Academic Terms** and **Academic Years** -1. Start adding **Students** -1. Group your students into **Batches** - -Watch this video to learn more about ERPNext Education: https://www.youtube.com/watch?v=f6foQOyGzdA diff --git a/erpnext/setup/setup_wizard/tasks/explore.md b/erpnext/setup/setup_wizard/tasks/explore.md deleted file mode 100644 index ce6cb60673..0000000000 --- a/erpnext/setup/setup_wizard/tasks/explore.md +++ /dev/null @@ -1,7 +0,0 @@ -Thanks for checking this out! ❤️ - -If you are evaluating an ERP system for the first time, this is going to be quite a task! But don't worry, ERPNext is awesome. - -First, get familiar with the surroundings. ERPNext covers a *lot of features*, go to the home page and click on the "Explore" icon. - -All the best! \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/tasks/go_live.md b/erpnext/setup/setup_wizard/tasks/go_live.md deleted file mode 100644 index 0a934a436f..0000000000 --- a/erpnext/setup/setup_wizard/tasks/go_live.md +++ /dev/null @@ -1,18 +0,0 @@ -Ready to go live with ERPNext? 🏁🏁🏁 - -Here are the steps: - -1. Sync up your **Chart of Accounts** -3. Add your opening stock using **Stock Reconciliation** -4. Add your open invoices (both sales and purchase) -3. Add your opening account balances by making a **Journal Entry** - -If you need help for going live, sign up for an account at erpnext.com or find a partner to help you with this. - -Or you can watch these videos 📺: - -Setup your chart of accounts: https://www.youtube.com/watch?v=AcfMCT7wLLo - -Add Open Stock: https://www.youtube.com/watch?v=nlHX0ZZ84Lw - -Add Opening Balances: https://www.youtube.com/watch?v=nlHX0ZZ84Lw diff --git a/erpnext/setup/setup_wizard/tasks/import_data.md b/erpnext/setup/setup_wizard/tasks/import_data.md deleted file mode 100644 index c5b85c9673..0000000000 --- a/erpnext/setup/setup_wizard/tasks/import_data.md +++ /dev/null @@ -1,5 +0,0 @@ -Lets import some data! 💪💪 - -If you are already running a business, you most likely have your Items, Customers or Suppliers in some spreadsheet file somewhere, import it into ERPNext with the Data Import Tool. - -Watch this video to get started: https://www.youtube.com/watch?v=Ta2Xx3QoK3E diff --git a/erpnext/setup/setup_wizard/tasks/masters.md b/erpnext/setup/setup_wizard/tasks/masters.md deleted file mode 100644 index 6ade15907c..0000000000 --- a/erpnext/setup/setup_wizard/tasks/masters.md +++ /dev/null @@ -1,7 +0,0 @@ -Start building a model of your business in ERPNext by adding your Items and Customers. - -These videos 📺 will help you get started: - -Adding Customers and Suppliers: https://www.youtube.com/watch?v=zsrrVDk6VBs - -Adding Items and Prices: https://www.youtube.com/watch?v=FcOsV-e8ymE \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/tasks/purchase.md b/erpnext/setup/setup_wizard/tasks/purchase.md deleted file mode 100644 index 3f3bc3b274..0000000000 --- a/erpnext/setup/setup_wizard/tasks/purchase.md +++ /dev/null @@ -1,10 +0,0 @@ -How to manage your purchasing in ERPNext 🛒🛒🛒: - -1. Add a few **Suppliers** -2. Find out what you need by making **Material Requests**. -3. Now start placing orders via **Purchase Order**. -4. When your suppliers deliver, make **Purchase Receipts** - -Now never run out of stock again! 😎 - -Watch this video 📺 to get an overview: https://www.youtube.com/watch?v=4TN9kPyfIqM \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/tasks/sales.md b/erpnext/setup/setup_wizard/tasks/sales.md deleted file mode 100644 index 15268fa968..0000000000 --- a/erpnext/setup/setup_wizard/tasks/sales.md +++ /dev/null @@ -1,8 +0,0 @@ -Start managing your sales with ERPNext 🔔🔔🔔: - -1. Add potential business contacts as **Leads** -2. Udpate your deals in pipeline in **Opportunities** -3. Send proposals to your leads or customers with **Quotations** -4. Track confirmed orders with **Sales Orders** - -Watch this video 📺 to get an overview: https://www.youtube.com/watch?v=o9XCSZHJfpA diff --git a/erpnext/setup/setup_wizard/tasks/school_import_data.md b/erpnext/setup/setup_wizard/tasks/school_import_data.md deleted file mode 100644 index 1fbe04906e..0000000000 --- a/erpnext/setup/setup_wizard/tasks/school_import_data.md +++ /dev/null @@ -1,5 +0,0 @@ -Lets import some data! 💪💪 - -If you are already running a Institute, you most likely have your Students in some spreadsheet file somewhere. Import it into ERPNext with the Data Import Tool. - -Watch this video to get started: https://www.youtube.com/watch?v=Ta2Xx3QoK3E \ No newline at end of file diff --git a/erpnext/setup/setup_wizard/tasks/task_alert.json b/erpnext/setup/setup_wizard/tasks/task_alert.json deleted file mode 100644 index cac868a925..0000000000 --- a/erpnext/setup/setup_wizard/tasks/task_alert.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "attach_print": 0, - "condition": "doc.status in ('Open', 'Overdue')", - "date_changed": "exp_end_date", - "days_in_advance": 0, - "docstatus": 0, - "doctype": "Notification", - "document_type": "Task", - "enabled": 1, - "event": "Days After", - "is_standard": 0, - "message": "

Task due today:

\n\n
\n{{ doc.description }}\n
\n\n
\n

\nThis is a notification for a task that is due today, and a sample Notification. In ERPNext you can setup notifications on anything, Invoices, Orders, Leads, Opportunities, so you never miss a thing.\n
To edit this, and setup other alerts, just type Notification in the search bar.

", - "method": null, - "modified": "2017-03-09 07:34:58.168370", - "module": null, - "name": "Task Due Alert", - "recipients": [ - { - "cc": null, - "condition": null, - "email_by_document_field": "owner" - } - ], - "subject": "{{ doc.subject }}", - "value_changed": null - } -] \ No newline at end of file