diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index bfea0bb5a0..0538323561 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -261,13 +261,11 @@ class DocType(BuyingController): if d.purchase_order: submitted = sql("select name from `tabPurchase Order` where docstatus = 1 and name = '%s'" % d.purchase_order) if not submitted: - msgprint("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted") - raise Exception , "Validation Error." + webnotes.throw("Purchase Order : "+ cstr(d.purchase_order) +" is not submitted") if d.purchase_receipt: submitted = sql("select name from `tabPurchase Receipt` where docstatus = 1 and name = '%s'" % d.purchase_receipt) if not submitted: - msgprint("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted") - raise Exception , "Validation Error." + webnotes.throw("Purchase Receipt : "+ cstr(d.purchase_receipt) +" is not submitted") def update_against_document_in_jv(self): diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py index fc0776740e..7600b2b5fe 100644 --- a/utilities/demo/make_demo.py +++ b/utilities/demo/make_demo.py @@ -266,11 +266,11 @@ def make_stock_entry_from_pro(pro_id, purpose, current_date): from stock.stock_ledger import NegativeStockError from stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, DuplicateEntryForProductionOrderError - st = webnotes.bean(make_stock_entry(pro_id, purpose)) - st.doc.posting_date = current_date - st.doc.fiscal_year = "2013" - st.doc.expense_adjustment_account = "Stock in Hand - WP" try: + st = webnotes.bean(make_stock_entry(pro_id, purpose)) + st.doc.posting_date = current_date + st.doc.fiscal_year = "2013" + st.doc.expense_adjustment_account = "Stock in Hand - WP" st.insert() webnotes.conn.commit() st.submit() @@ -278,7 +278,7 @@ def make_stock_entry_from_pro(pro_id, purpose, current_date): except NegativeStockError: pass except IncorrectValuationRateError: pass except DuplicateEntryForProductionOrderError: pass - + def make_quotation(current_date): b = webnotes.bean([{ "creation": current_date, diff --git a/utilities/demo/make_erpnext_demo.py b/utilities/demo/make_erpnext_demo.py index 0a8a9351d8..b6c22c2b90 100644 --- a/utilities/demo/make_erpnext_demo.py +++ b/utilities/demo/make_erpnext_demo.py @@ -73,7 +73,7 @@ def make_demo_on_login_script(): s.doc.script = dfile.read() if __name__=="__main__": - webnotes.connect() + # webnotes.connect() webnotes.mute_emails = 1 make_demo_app() make_demo_user()