[minor] demo and item

This commit is contained in:
Anand Doshi 2013-11-29 14:53:56 +05:30
parent 974203b1f3
commit da07ed0ae8
2 changed files with 8 additions and 7 deletions

View File

@ -207,6 +207,7 @@ class DocType(DocListController, WebsiteGenerator):
return sle and 'exists' or 'not exists' return sle and 'exists' or 'not exists'
def validate_name_with_item_group(self): def validate_name_with_item_group(self):
# causes problem with tree build
if webnotes.conn.exists("Item Group", self.doc.name): if webnotes.conn.exists("Item Group", self.doc.name):
webnotes.msgprint("An item group exists with same name (%s), \ webnotes.msgprint("An item group exists with same name (%s), \
please change the item name or rename the item group" % please change the item name or rename the item group" %

View File

@ -153,7 +153,7 @@ def run_stock(current_date):
for po in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Purchase Receipt")]: for po in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Purchase Receipt")]:
pr = webnotes.bean(make_purchase_receipt(po)) pr = webnotes.bean(make_purchase_receipt(po))
pr.doc.posting_date = current_date pr.doc.posting_date = current_date
pr.doc.fiscal_year = "2013" pr.doc.fiscal_year = current_date.year
pr.insert() pr.insert()
try: try:
pr.submit() pr.submit()
@ -169,7 +169,7 @@ def run_stock(current_date):
for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Delivery Note")]: for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Delivery Note")]:
dn = webnotes.bean(make_delivery_note(so)) dn = webnotes.bean(make_delivery_note(so))
dn.doc.posting_date = current_date dn.doc.posting_date = current_date
dn.doc.fiscal_year = "2013" dn.doc.fiscal_year = current_date.year
dn.insert() dn.insert()
try: try:
dn.submit() dn.submit()
@ -192,7 +192,7 @@ def run_purchase(current_date):
mr = webnotes.new_bean("Material Request") mr = webnotes.new_bean("Material Request")
mr.doc.material_request_type = "Purchase" mr.doc.material_request_type = "Purchase"
mr.doc.transaction_date = current_date mr.doc.transaction_date = current_date
mr.doc.fiscal_year = "2013" mr.doc.fiscal_year = current_date.year
mr.doclist.append({ mr.doclist.append({
"doctype": "Material Request Item", "doctype": "Material Request Item",
"parentfield": "indent_details", "parentfield": "indent_details",
@ -211,7 +211,7 @@ def run_purchase(current_date):
if row[0] != "Total": if row[0] != "Total":
sq = webnotes.bean(make_supplier_quotation(row[0])) sq = webnotes.bean(make_supplier_quotation(row[0]))
sq.doc.transaction_date = current_date sq.doc.transaction_date = current_date
sq.doc.fiscal_year = "2013" sq.doc.fiscal_year = current_date.year
sq.insert() sq.insert()
sq.submit() sq.submit()
webnotes.conn.commit() webnotes.conn.commit()
@ -224,7 +224,7 @@ def run_purchase(current_date):
if row[0] != "Total": if row[0] != "Total":
po = webnotes.bean(make_purchase_order(row[0])) po = webnotes.bean(make_purchase_order(row[0]))
po.doc.transaction_date = current_date po.doc.transaction_date = current_date
po.doc.fiscal_year = "2013" po.doc.fiscal_year = current_date.year
po.insert() po.insert()
po.submit() po.submit()
webnotes.conn.commit() webnotes.conn.commit()
@ -283,7 +283,7 @@ def make_stock_entry_from_pro(pro_id, purpose, current_date):
try: try:
st = webnotes.bean(make_stock_entry(pro_id, purpose)) st = webnotes.bean(make_stock_entry(pro_id, purpose))
st.doc.posting_date = current_date st.doc.posting_date = current_date
st.doc.fiscal_year = "2013" st.doc.fiscal_year = current_date.year
for d in st.doclist.get({"parentfield": "mtn_details"}): for d in st.doclist.get({"parentfield": "mtn_details"}):
d.expense_account = "Stock Adjustment - " + company_abbr d.expense_account = "Stock Adjustment - " + company_abbr
d.cost_center = "Main - " + company_abbr d.cost_center = "Main - " + company_abbr
@ -303,7 +303,7 @@ def make_quotation(current_date):
"customer": get_random("Customer"), "customer": get_random("Customer"),
"order_type": "Sales", "order_type": "Sales",
"transaction_date": current_date, "transaction_date": current_date,
"fiscal_year": "2013" "fiscal_year": current_date.year
}]) }])
add_random_children(b, { add_random_children(b, {