[demo] [minor] fixes
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index ab361e9..a96f664 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -26,6 +26,10 @@
def make(domain='Manufacturing'):
frappe.flags.domain = domain
setup_data()
+ site = frappe.local.site
+ frappe.destroy()
+ frappe.init(site)
+ frappe.connect()
simulate()
def simulate():
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index 9430677..ff40e74 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -104,11 +104,14 @@
mr.material_request_type = "Purchase"
mr.transaction_date = frappe.flags.current_date
+
+ moq = frappe.db.get_value('Item', item_code, 'min_order_qty')
+
mr.append("items", {
"doctype": "Material Request Item",
"schedule_date": frappe.utils.add_days(mr.transaction_date, 7),
"item_code": item_code,
- "qty": qty
+ "qty": qty if qty > moq else moq
})
mr.insert()
mr.submit()
diff --git a/erpnext/demo/user/stock.py b/erpnext/demo/user/stock.py
index d2a7254..46657fd 100644
--- a/erpnext/demo/user/stock.py
+++ b/erpnext/demo/user/stock.py
@@ -29,7 +29,10 @@
pr.posting_date = frappe.flags.current_date
pr.insert()
- pr.submit()
+ try:
+ pr.submit()
+ except NegativeStockError:
+ pass
frappe.db.commit()
def make_delivery_note():