Fixes in Make Demo
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index a39702b..1768b9b 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -320,12 +320,9 @@
item = webnotes.conn.sql("select name,is_asset_item,is_sales_item from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% d.item_code)
acc = webnotes.conn.sql("select account_type from `tabAccount` where name = '%s' and docstatus != 2" % d.income_account)
if not acc:
- msgprint("Account: "+d.income_account+" does not exist in the system")
- raise Exception
+ msgprint("Account: "+d.income_account+" does not exist in the system", raise_exception=True)
elif item and item[0][1] == 'Yes' and not acc[0][0] == 'Fixed Asset Account':
- msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code)
- raise Exception
-
+ msgprint("Please select income head with account type 'Fixed Asset Account' as Item %s is an asset item" % d.item_code, raise_exception=True)
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {
diff --git a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt
index 49c7478..4d3558c 100644
--- a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt
+++ b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt
@@ -2,7 +2,7 @@
{
"creation": "2013-05-13 16:10:02",
"docstatus": 0,
- "modified": "2013-05-13 16:21:07",
+ "modified": "2014-01-24 18:19:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -11,7 +11,7 @@
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
- "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Ordered Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc",
+ "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc",
"ref_doctype": "Purchase Order",
"report_name": "Requested Items To Be Ordered",
"report_type": "Query Report"
diff --git a/utilities/demo/demo_docs/Fiscal_Year.csv b/utilities/demo/demo_docs/Fiscal_Year.csv
index d56b1b9..1a06e87 100644
--- a/utilities/demo/demo_docs/Fiscal_Year.csv
+++ b/utilities/demo/demo_docs/Fiscal_Year.csv
@@ -20,4 +20,5 @@
Start entering data below this line,,,,
,,2009,01-01-2009,31-12-2009,No
,,2010,01-01-2010,31-12-2010,No
-,,2011,01-01-2011,31-12-2011,No
\ No newline at end of file
+,,2011,01-01-2011,31-12-2011,No
+,,2012,01-01-2012,31-12-2012,No
\ No newline at end of file
diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py
index b98fd7a..99c3e8b 100644
--- a/utilities/demo/make_demo.py
+++ b/utilities/demo/make_demo.py
@@ -19,7 +19,7 @@
country = "United States"
currency = "USD"
time_zone = "America/New_York"
-start_date = '2013-01-01'
+start_date = '2014-01-01'
bank_name = "Citibank"
runs_for = None
prob = {
@@ -105,6 +105,10 @@
for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Sales Invoice")]:
si = webnotes.bean(make_sales_invoice(so))
si.doc.posting_date = current_date
+ for d in si.doclist.get({"parentfield": "entries"}):
+ if not d.income_account:
+ d.income_account = "Sales - {}".format(company_abbr)
+
si.insert()
si.submit()
webnotes.conn.commit()
@@ -170,6 +174,9 @@
dn = webnotes.bean(make_delivery_note(so))
dn.doc.posting_date = current_date
dn.doc.fiscal_year = current_date.year
+ for d in dn.doclist.get({"parentfield": "delivery_note_details"}):
+ d.expense_account = "Cost of Goods Sold - {}".format(company_abbr)
+
dn.insert()
try:
dn.submit()
@@ -236,7 +243,7 @@
ppt = webnotes.bean("Production Planning Tool", "Production Planning Tool")
ppt.doc.company = company
ppt.doc.use_multi_level_bom = 1
- ppt.doc.purchase_request_for_warehouse = "Stores - WP"
+ ppt.doc.purchase_request_for_warehouse = "Stores - {}".format(company_abbr)
ppt.run_method("get_open_sales_orders")
ppt.run_method("get_items_from_so")
ppt.run_method("raise_production_order")
@@ -380,8 +387,8 @@
setup_account({
"first_name": "Test",
"last_name": "User",
- "fy_start_date": "2013-01-01",
- "fy_end_date": "2013-12-31",
+ "fy_start_date": "2014-01-01",
+ "fy_end_date": "2014-12-31",
"industry": "Manufacturing",
"company_name": company,
"company_abbr": company_abbr,