company name picked up dynamically, domainification
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index 8cafd40..e89b689 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -5,7 +5,7 @@
import frappe.utils
from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset
from erpnext.demo.user import education as edu
-from erpnext.demo.setup import education, manufacture, setup_data, healthcare
+from erpnext.demo.setup import education, manufacture, setup_data, healthcare, retail
"""
Make a demo
@@ -29,6 +29,8 @@
setup_data.setup(domain)
if domain== 'Manufacturing':
manufacture.setup_data()
+ elif domain == "Retail":
+ retail.setup_data()
elif domain== 'Education':
education.setup_data()
elif domain== 'Healthcare':
@@ -78,10 +80,10 @@
stock.work()
accounts.work()
projects.run_projects(current_date)
+ sales.work(domain)
# run_messages()
if domain=='Manufacturing':
- sales.work()
manufacturing.work()
elif domain=='Education':
edu.work()
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index 822a4fc..6993044 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
-import frappe, random, json
+import frappe, random, json, erpnext
from frappe.utils.make_random import how_many, get_random
from frappe.desk import query_report
from erpnext.setup.utils import get_exchange_rate
@@ -51,8 +51,8 @@
# get supplier details
supplier = get_random("Supplier")
- company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
- party_account_currency = get_party_account_currency("Supplier", supplier, "Wind Power LLC")
+ company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
+ party_account_currency = get_party_account_currency("Supplier", supplier, erpnext.get_default_company())
if company_currency == party_account_currency:
exchange_rate = 1
else:
diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py
index fbeeff4..69ba900 100644
--- a/erpnext/demo/user/sales.py
+++ b/erpnext/demo/user/sales.py
@@ -3,23 +3,23 @@
from __future__ import unicode_literals
-import frappe, random
+import frappe, random, erpnext
from frappe.utils import flt
from frappe.utils.make_random import add_random_children, get_random
from erpnext.setup.utils import get_exchange_rate
from erpnext.accounts.party import get_party_account_currency
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request, make_payment_entry
-def work():
+def work(domain="Manufacturing"):
frappe.set_user(frappe.db.get_global('demo_sales_user_2'))
for i in range(random.randint(1,7)):
if random.random() < 0.5:
- make_opportunity()
+ make_opportunity(domain)
for i in range(random.randint(1,3)):
if random.random() < 0.5:
- make_quotation()
+ make_quotation(domain)
# lost quotations / inquiries
if random.random() < 0.3:
@@ -53,7 +53,7 @@
except Exception:
pass
-def make_opportunity():
+def make_opportunity(domain):
b = frappe.get_doc({
"doctype": "Opportunity",
"enquiry_from": "Customer",
@@ -65,13 +65,13 @@
add_random_children(b, "items", rows=4, randomize = {
"qty": (1, 5),
- "item_code": ("Item", {"has_variants": 0, "is_fixed_asset": 0})
+ "item_code": ("Item", {"has_variants": 0, "is_fixed_asset": 0, "domain": domain})
}, unique="item_code")
b.insert()
frappe.db.commit()
-def make_quotation():
+def make_quotation(domain):
# get open opportunites
opportunity = get_random("Opportunity", {"status": "Open", "with_items": 1})
@@ -88,8 +88,8 @@
# get customer, currency and exchange_rate
customer = get_random("Customer")
- company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
- party_account_currency = get_party_account_currency("Customer", customer, "Wind Power LLC")
+ company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
+ party_account_currency = get_party_account_currency("Customer", customer, erpnext.get_default_company())
if company_currency == party_account_currency:
exchange_rate = 1
else:
@@ -108,7 +108,7 @@
add_random_children(qtn, "items", rows=3, randomize = {
"qty": (1, 5),
- "item_code": ("Item", {"has_variants": "0", "is_fixed_asset": 0})
+ "item_code": ("Item", {"has_variants": "0", "is_fixed_asset": 0, "domain": domain})
}, unique="item_code")
qtn.insert()