[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'
def validate_name_with_item_group(self):
# causes problem with tree build
if webnotes.conn.exists("Item Group", self.doc.name):
webnotes.msgprint("An item group exists with same name (%s), \
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")]:
pr = webnotes.bean(make_purchase_receipt(po))
pr.doc.posting_date = current_date
pr.doc.fiscal_year = "2013"
pr.doc.fiscal_year = current_date.year
pr.insert()
try:
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")]:
dn = webnotes.bean(make_delivery_note(so))
dn.doc.posting_date = current_date
dn.doc.fiscal_year = "2013"
dn.doc.fiscal_year = current_date.year
dn.insert()
try:
dn.submit()
@ -192,7 +192,7 @@ def run_purchase(current_date):
mr = webnotes.new_bean("Material Request")
mr.doc.material_request_type = "Purchase"
mr.doc.transaction_date = current_date
mr.doc.fiscal_year = "2013"
mr.doc.fiscal_year = current_date.year
mr.doclist.append({
"doctype": "Material Request Item",
"parentfield": "indent_details",
@ -211,7 +211,7 @@ def run_purchase(current_date):
if row[0] != "Total":
sq = webnotes.bean(make_supplier_quotation(row[0]))
sq.doc.transaction_date = current_date
sq.doc.fiscal_year = "2013"
sq.doc.fiscal_year = current_date.year
sq.insert()
sq.submit()
webnotes.conn.commit()
@ -224,7 +224,7 @@ def run_purchase(current_date):
if row[0] != "Total":
po = webnotes.bean(make_purchase_order(row[0]))
po.doc.transaction_date = current_date
po.doc.fiscal_year = "2013"
po.doc.fiscal_year = current_date.year
po.insert()
po.submit()
webnotes.conn.commit()
@ -283,7 +283,7 @@ def make_stock_entry_from_pro(pro_id, purpose, current_date):
try:
st = webnotes.bean(make_stock_entry(pro_id, purpose))
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"}):
d.expense_account = "Stock Adjustment - " + company_abbr
d.cost_center = "Main - " + company_abbr
@ -303,7 +303,7 @@ def make_quotation(current_date):
"customer": get_random("Customer"),
"order_type": "Sales",
"transaction_date": current_date,
"fiscal_year": "2013"
"fiscal_year": current_date.year
}])
add_random_children(b, {