[minor] [demo] added commits
This commit is contained in:
parent
c4dde9bd99
commit
6ca903f62a
@ -59,8 +59,6 @@ def simulate():
|
|||||||
run_manufacturing(current_date)
|
run_manufacturing(current_date)
|
||||||
run_stock(current_date)
|
run_stock(current_date)
|
||||||
|
|
||||||
webnotes.conn.commit()
|
|
||||||
|
|
||||||
def run_sales(current_date):
|
def run_sales(current_date):
|
||||||
if can_make("Quotation"):
|
if can_make("Quotation"):
|
||||||
for i in xrange(how_many("Quotation")):
|
for i in xrange(how_many("Quotation")):
|
||||||
@ -81,6 +79,7 @@ def run_stock(current_date):
|
|||||||
pr.doc.fiscal_year = "2010"
|
pr.doc.fiscal_year = "2010"
|
||||||
pr.insert()
|
pr.insert()
|
||||||
pr.submit()
|
pr.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
# make delivery notes (if possible)
|
# make delivery notes (if possible)
|
||||||
if can_make("Delivery Note"):
|
if can_make("Delivery Note"):
|
||||||
@ -92,6 +91,7 @@ def run_stock(current_date):
|
|||||||
dn.doc.fiscal_year = "2010"
|
dn.doc.fiscal_year = "2010"
|
||||||
dn.insert()
|
dn.insert()
|
||||||
dn.submit()
|
dn.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
|
|
||||||
def run_purchase(current_date):
|
def run_purchase(current_date):
|
||||||
@ -106,6 +106,7 @@ def run_purchase(current_date):
|
|||||||
sq.doc.fiscal_year = "2010"
|
sq.doc.fiscal_year = "2010"
|
||||||
sq.insert()
|
sq.insert()
|
||||||
sq.submit()
|
sq.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
# make purchase orders
|
# make purchase orders
|
||||||
if can_make("Purchase Order"):
|
if can_make("Purchase Order"):
|
||||||
@ -118,8 +119,12 @@ def run_purchase(current_date):
|
|||||||
po.doc.fiscal_year = "2010"
|
po.doc.fiscal_year = "2010"
|
||||||
po.insert()
|
po.insert()
|
||||||
po.submit()
|
po.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
def run_manufacturing(current_date):
|
def run_manufacturing(current_date):
|
||||||
|
from stock.stock_ledger import NegativeStockError
|
||||||
|
from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError
|
||||||
|
|
||||||
ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool")
|
ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool")
|
||||||
ppt.doc.company = company
|
ppt.doc.company = company
|
||||||
ppt.doc.use_multi_level_bom = 1
|
ppt.doc.use_multi_level_bom = 1
|
||||||
@ -128,17 +133,20 @@ def run_manufacturing(current_date):
|
|||||||
ppt.run_method("get_items_from_so")
|
ppt.run_method("get_items_from_so")
|
||||||
ppt.run_method("raise_production_order")
|
ppt.run_method("raise_production_order")
|
||||||
ppt.run_method("raise_purchase_request")
|
ppt.run_method("raise_purchase_request")
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
# submit production orders
|
# submit production orders
|
||||||
for pro in webnotes.conn.get_values("Production Order", {"docstatus": 0}):
|
for pro in webnotes.conn.get_values("Production Order", {"docstatus": 0}):
|
||||||
b = webnotes.bean("Production Order", pro[0])
|
b = webnotes.bean("Production Order", pro[0])
|
||||||
b.doc.wip_warehouse = "Work in Progress - WP"
|
b.doc.wip_warehouse = "Work in Progress - WP"
|
||||||
b.submit()
|
b.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
# submit material requests
|
# submit material requests
|
||||||
for pro in webnotes.conn.get_values("Material Request", {"docstatus": 0}):
|
for pro in webnotes.conn.get_values("Material Request", {"docstatus": 0}):
|
||||||
b = webnotes.bean("Material Request", pro[0])
|
b = webnotes.bean("Material Request", pro[0])
|
||||||
b.submit()
|
b.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
# stores -> wip
|
# stores -> wip
|
||||||
if can_make("Stock Entry for WIP"):
|
if can_make("Stock Entry for WIP"):
|
||||||
@ -154,6 +162,7 @@ def run_manufacturing(current_date):
|
|||||||
for st in webnotes.conn.get_values("Stock Entry", {"docstatus":0}):
|
for st in webnotes.conn.get_values("Stock Entry", {"docstatus":0}):
|
||||||
try:
|
try:
|
||||||
webnotes.bean("Stock Entry", st[0]).submit()
|
webnotes.bean("Stock Entry", st[0]).submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
except NegativeStockError: pass
|
except NegativeStockError: pass
|
||||||
except IncorrectValuationRateError: pass
|
except IncorrectValuationRateError: pass
|
||||||
|
|
||||||
@ -170,7 +179,9 @@ def make_stock_entry_from_pro(pro_id, purpose, current_date):
|
|||||||
st.doc.expense_adjustment_account = "Stock in Hand - WP"
|
st.doc.expense_adjustment_account = "Stock in Hand - WP"
|
||||||
try:
|
try:
|
||||||
st.insert()
|
st.insert()
|
||||||
|
webnotes.conn.commit()
|
||||||
st.submit()
|
st.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
except NegativeStockError: pass
|
except NegativeStockError: pass
|
||||||
except IncorrectValuationRateError: pass
|
except IncorrectValuationRateError: pass
|
||||||
|
|
||||||
@ -194,7 +205,9 @@ def make_quotation(current_date):
|
|||||||
}, unique="item_code")
|
}, unique="item_code")
|
||||||
|
|
||||||
b.insert()
|
b.insert()
|
||||||
|
webnotes.conn.commit()
|
||||||
b.submit()
|
b.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
def make_sales_order(current_date):
|
def make_sales_order(current_date):
|
||||||
q = get_random("Quotation", {"status": "Submitted"})
|
q = get_random("Quotation", {"status": "Submitted"})
|
||||||
@ -204,7 +217,9 @@ def make_sales_order(current_date):
|
|||||||
so.doc.transaction_date = current_date
|
so.doc.transaction_date = current_date
|
||||||
so.doc.delivery_date = webnotes.utils.add_days(current_date, 10)
|
so.doc.delivery_date = webnotes.utils.add_days(current_date, 10)
|
||||||
so.insert()
|
so.insert()
|
||||||
|
webnotes.conn.commit()
|
||||||
so.submit()
|
so.submit()
|
||||||
|
webnotes.conn.commit()
|
||||||
|
|
||||||
def add_random_children(bean, template, rows, randomize, unique=None):
|
def add_random_children(bean, template, rows, randomize, unique=None):
|
||||||
for i in xrange(random.randrange(1, rows)):
|
for i in xrange(random.randrange(1, rows)):
|
||||||
|
Loading…
Reference in New Issue
Block a user