mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
company name picked up dynamically, domainification
This commit is contained in:
@@ -5,7 +5,7 @@ import erpnext
|
|||||||
import frappe.utils
|
import frappe.utils
|
||||||
from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset
|
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.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
|
Make a demo
|
||||||
|
|
||||||
@@ -29,6 +29,8 @@ def make(domain='Manufacturing', days=100):
|
|||||||
setup_data.setup(domain)
|
setup_data.setup(domain)
|
||||||
if domain== 'Manufacturing':
|
if domain== 'Manufacturing':
|
||||||
manufacture.setup_data()
|
manufacture.setup_data()
|
||||||
|
elif domain == "Retail":
|
||||||
|
retail.setup_data()
|
||||||
elif domain== 'Education':
|
elif domain== 'Education':
|
||||||
education.setup_data()
|
education.setup_data()
|
||||||
elif domain== 'Healthcare':
|
elif domain== 'Healthcare':
|
||||||
@@ -78,10 +80,10 @@ def simulate(domain='Manufacturing', days=100):
|
|||||||
stock.work()
|
stock.work()
|
||||||
accounts.work()
|
accounts.work()
|
||||||
projects.run_projects(current_date)
|
projects.run_projects(current_date)
|
||||||
|
sales.work(domain)
|
||||||
# run_messages()
|
# run_messages()
|
||||||
|
|
||||||
if domain=='Manufacturing':
|
if domain=='Manufacturing':
|
||||||
sales.work()
|
|
||||||
manufacturing.work()
|
manufacturing.work()
|
||||||
elif domain=='Education':
|
elif domain=='Education':
|
||||||
edu.work()
|
edu.work()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
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.utils.make_random import how_many, get_random
|
||||||
from frappe.desk import query_report
|
from frappe.desk import query_report
|
||||||
from erpnext.setup.utils import get_exchange_rate
|
from erpnext.setup.utils import get_exchange_rate
|
||||||
@@ -51,8 +51,8 @@ def work():
|
|||||||
# get supplier details
|
# get supplier details
|
||||||
supplier = get_random("Supplier")
|
supplier = get_random("Supplier")
|
||||||
|
|
||||||
company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
|
company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
|
||||||
party_account_currency = get_party_account_currency("Supplier", supplier, "Wind Power LLC")
|
party_account_currency = get_party_account_currency("Supplier", supplier, erpnext.get_default_company())
|
||||||
if company_currency == party_account_currency:
|
if company_currency == party_account_currency:
|
||||||
exchange_rate = 1
|
exchange_rate = 1
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -3,23 +3,23 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import frappe, random
|
import frappe, random, erpnext
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
from frappe.utils.make_random import add_random_children, get_random
|
from frappe.utils.make_random import add_random_children, get_random
|
||||||
from erpnext.setup.utils import get_exchange_rate
|
from erpnext.setup.utils import get_exchange_rate
|
||||||
from erpnext.accounts.party import get_party_account_currency
|
from erpnext.accounts.party import get_party_account_currency
|
||||||
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request, make_payment_entry
|
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'))
|
frappe.set_user(frappe.db.get_global('demo_sales_user_2'))
|
||||||
|
|
||||||
for i in range(random.randint(1,7)):
|
for i in range(random.randint(1,7)):
|
||||||
if random.random() < 0.5:
|
if random.random() < 0.5:
|
||||||
make_opportunity()
|
make_opportunity(domain)
|
||||||
|
|
||||||
for i in range(random.randint(1,3)):
|
for i in range(random.randint(1,3)):
|
||||||
if random.random() < 0.5:
|
if random.random() < 0.5:
|
||||||
make_quotation()
|
make_quotation(domain)
|
||||||
|
|
||||||
# lost quotations / inquiries
|
# lost quotations / inquiries
|
||||||
if random.random() < 0.3:
|
if random.random() < 0.3:
|
||||||
@@ -53,7 +53,7 @@ def work():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def make_opportunity():
|
def make_opportunity(domain):
|
||||||
b = frappe.get_doc({
|
b = frappe.get_doc({
|
||||||
"doctype": "Opportunity",
|
"doctype": "Opportunity",
|
||||||
"enquiry_from": "Customer",
|
"enquiry_from": "Customer",
|
||||||
@@ -65,13 +65,13 @@ def make_opportunity():
|
|||||||
|
|
||||||
add_random_children(b, "items", rows=4, randomize = {
|
add_random_children(b, "items", rows=4, randomize = {
|
||||||
"qty": (1, 5),
|
"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")
|
}, unique="item_code")
|
||||||
|
|
||||||
b.insert()
|
b.insert()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def make_quotation():
|
def make_quotation(domain):
|
||||||
# get open opportunites
|
# get open opportunites
|
||||||
opportunity = get_random("Opportunity", {"status": "Open", "with_items": 1})
|
opportunity = get_random("Opportunity", {"status": "Open", "with_items": 1})
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ def make_quotation():
|
|||||||
# get customer, currency and exchange_rate
|
# get customer, currency and exchange_rate
|
||||||
customer = get_random("Customer")
|
customer = get_random("Customer")
|
||||||
|
|
||||||
company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
|
company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
|
||||||
party_account_currency = get_party_account_currency("Customer", customer, "Wind Power LLC")
|
party_account_currency = get_party_account_currency("Customer", customer, erpnext.get_default_company())
|
||||||
if company_currency == party_account_currency:
|
if company_currency == party_account_currency:
|
||||||
exchange_rate = 1
|
exchange_rate = 1
|
||||||
else:
|
else:
|
||||||
@@ -108,7 +108,7 @@ def make_quotation():
|
|||||||
|
|
||||||
add_random_children(qtn, "items", rows=3, randomize = {
|
add_random_children(qtn, "items", rows=3, randomize = {
|
||||||
"qty": (1, 5),
|
"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")
|
}, unique="item_code")
|
||||||
|
|
||||||
qtn.insert()
|
qtn.insert()
|
||||||
|
|||||||
Reference in New Issue
Block a user