Merge pull request #1118 from rmehta/chinese

[language] Added zh-cn and zh-tw webnotes/erpnext#1099
diff --git a/README.md b/README.md
index 7572337..2b7119c 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,8 @@
 
 ERPNext is built on [wnframework](https://github.com/webnotes/wnframework)
 
-- [User Guide](https://erpnext.org/docs.user.html)
-- [Getting Help](https://erpnext.org/docs.user.help.html)
+- [User Guide](http://erpnext.org/user-guide.html)
+- [Getting Help](http://erpnext.org/getting-help.html)
 - [Developer Forum](http://groups.google.com/group/erpnext-developer-forum)
 - [User Forum](http://groups.google.com/group/erpnext-user-forum)
 
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
index 992c4dc..cae2028 100644
--- a/accounts/doctype/account/account.py
+++ b/accounts/doctype/account/account.py
@@ -38,9 +38,12 @@
 		
 	def validate_master_name(self):
 		"""Remind to add master name"""
-		if (self.doc.master_type == 'Customer' or self.doc.master_type == 'Supplier') \
-				and not self.doc.master_name:
-			msgprint("Message: Please enter Master Name once the account is created.")
+		if self.doc.master_type in ('Customer', 'Supplier') or self.doc.account_type == "Warehouse":
+			if not self.doc.master_name:
+				msgprint(_("Please enter Master Name once the account is created."))
+			elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type, 
+					self.doc.master_name):
+				webnotes.throw(_("Invalid Master Name"))
 			
 	def validate_parent(self):
 		"""Fetch Parent Details and validation for account not to be created under ledger"""
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 1cdc7a7..7784005 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -38,7 +38,7 @@
 		// if document is POS then change default print format to "POS Invoice"
 		if(cur_frm.doc.is_pos && cur_frm.doc.docstatus===1) {
 			locals.DocType[cur_frm.doctype].default_print_format = "POS Invoice";
-			cur_frm.setup_print();
+			cur_frm.setup_print_layout();
 		}
 	},
 	
diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js
index 40ee326..69c7da1 100644
--- a/accounts/page/accounts_home/accounts_home.js
+++ b/accounts/page/accounts_home/accounts_home.js
@@ -241,13 +241,8 @@
 				doctype: "Journal Voucher"
 			},
 			{
-				"label":wn._("Payment Collection With Ageing"),
-				route: "query-report/Payment Collection With Ageing",
-				doctype: "Journal Voucher"
-			},
-			{
-				"label":wn._("Payment Made With Ageing"),
-				route: "query-report/Payment Made With Ageing",
+				"label":wn._("Payment Period Based On Invoice Date"),
+				route: "query-report/Payment Period Based On Invoice Date",
 				doctype: "Journal Voucher"
 			},
 			{
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js
deleted file mode 100644
index 6773a0e..0000000
--- a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-wn.query_reports["Payment Collection With Ageing"] = {
-	"filters": [
-		{
-			"fieldname": "from_date",
-			"label": wn._("From Date"),
-			"fieldtype": "Date",
-			"default": wn.defaults.get_user_default("year_start_date"),
-			"width": "80"
-		},
-		{
-			"fieldname":"to_date",
-			"label": wn._("To Date"),
-			"fieldtype": "Date",
-			"default": get_today()
-		},
-		{
-			"fieldname":"account",
-			"label": wn._("Customer Account"),
-			"fieldtype": "Link",
-			"options": "Account",
-			"get_query": function() {
-				var company = wn.query_report.filters_by_name.company.get_value();
-				return {
-					"query": "accounts.utils.get_account_list", 
-					"filters": {
-						"is_pl_account": "No",
-						"debit_or_credit": "Debit",
-						"company": company,
-						"master_type": "Customer"
-					}
-				}
-			}
-		},
-		{
-			"fieldname":"company",
-			"label": wn._("Company"),
-			"fieldtype": "Link",
-			"options": "Company",
-			"default": wn.defaults.get_default("company")
-		},
-	]
-}
\ No newline at end of file
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py
deleted file mode 100644
index 3529aee..0000000
--- a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
-from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
-
-def execute(filters=None):
-	if not filters: filters = {}
-	
-	columns = get_columns()
-	entries = get_entries(filters)
-	si_posting_date_map = get_si_posting_date_map()
-	
-	data = []
-	for d in entries:
-		against_invoice_date = d.against_invoice and si_posting_date_map[d.against_invoice] or ""
-		
-		row = [d.name, d.account, d.posting_date, d.against_invoice, against_invoice_date, 
-			d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
-			
-		if d.against_invoice:
-			row += get_ageing_data(d.posting_date, against_invoice_date, d.credit or -1*d.debit)
-		else:
-			row += ["", "", "", "", ""]
-			
-		data.append(row)
-	
-	return columns, data
-	
-def get_columns():
-	return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", 
-		"Posting Date:Date:100", "Against Invoice:Link/Sales Invoice:130", 
-		"Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120", 
-		"Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40", 
-		"0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
-	]
-
-def get_conditions(filters):
-	conditions = ""
-	
-	customer_accounts = []
-	if filters.get("account"):
-		customer_accounts = [filters["account"]]
-	else:
-		cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
-		customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount` 
-			where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" % cond)
-	
-	if customer_accounts:
-		conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(customer_accounts)))
-	else:
-		msgprint(_("No Customer Accounts found. Customer Accounts are identified based on \
-			'Master Type' value in account record."), raise_exception=1)
-		
-	if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"]
-	if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"]
-	
-	return conditions, customer_accounts
-	
-def get_entries(filters):
-	conditions, customer_accounts = get_conditions(filters)
-	entries =  webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
-		jvd.against_invoice, jvd.debit, jvd.credit, jv.cheque_no, jv.cheque_date, jv.remark
-		from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
-		where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" % 
-		(conditions), tuple(customer_accounts), as_dict=1)
-		
-	return entries
-	
-def get_si_posting_date_map():
-	si_posting_date_map = {}
-	for t in webnotes.conn.sql("""select name, posting_date from `tabSales Invoice`"""):
-		si_posting_date_map[t[0]] = t[1]
-		
-	return si_posting_date_map
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt
deleted file mode 100644
index 3405d19..0000000
--- a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
-  "creation": "2013-05-02 12:09:51", 
-  "docstatus": 0, 
-  "modified": "2013-05-02 12:09:51", 
-  "modified_by": "Administrator", 
-  "owner": "Administrator"
- }, 
- {
-  "add_total_row": 1, 
-  "doctype": "Report", 
-  "is_standard": "Yes", 
-  "name": "__common__", 
-  "ref_doctype": "Journal Voucher", 
-  "report_name": "Payment Collection With Ageing", 
-  "report_type": "Script Report"
- }, 
- {
-  "doctype": "Report", 
-  "name": "Payment Collection With Ageing"
- }
-]
\ No newline at end of file
diff --git a/accounts/report/payment_made_with_ageing/__init__.py b/accounts/report/payment_made_with_ageing/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/accounts/report/payment_made_with_ageing/__init__.py
+++ /dev/null
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py
deleted file mode 100644
index a70ce1b..0000000
--- a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import webnotes
-from webnotes import msgprint, _
-from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
-
-def execute(filters=None):
-	if not filters: filters = {}
-	
-	columns = get_columns()
-	entries = get_entries(filters)
-	pi_posting_date_map = get_pi_posting_date_map()
-	
-	data = []
-	for d in entries:
-		against_voucher_date = d.against_voucher and pi_posting_date_map[d.against_voucher] or ""
-		
-		row = [d.name, d.account, d.posting_date, d.against_voucher, against_voucher_date, 
-			d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
-			
-		if d.against_voucher:
-			row += get_ageing_data(d.posting_date, against_voucher_date, d.debit or -1*d.credit)
-		else:
-			row += ["", "", "", "", ""]
-			
-		data.append(row)
-	
-	return columns, data
-	
-def get_columns():
-	return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", 
-		"Posting Date:Date:100", "Against Invoice:Link/Purchase Invoice:130", 
-		"Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120", 
-		"Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40", 
-		"0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
-	]
-
-def get_conditions(filters):
-	conditions = ""
-	supplier_accounts = []
-	if filters.get("account"):
-		supplier_accounts = [filters["account"]]
-	else:
-		cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
-		supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount` 
-			where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" % cond)
-	
-	if supplier_accounts:
-		conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
-	else:
-		msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \
-			'Master Type' value in account record."), raise_exception=1)
-		
-	if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"]
-	if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"]
-
-	return conditions, supplier_accounts
-	
-def get_entries(filters):
-	conditions, supplier_accounts = get_conditions(filters)
-	entries =  webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
-		jvd.against_voucher, jvd.debit, jvd.credit, jv.cheque_no, jv.cheque_date, jv.remark
-		from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
-		where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" % 
-		(conditions), tuple(supplier_accounts), as_dict=1)
-		
-	return entries
-	
-def get_pi_posting_date_map():
-	pi_posting_date_map = {}
-	for t in webnotes.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
-		pi_posting_date_map[t[0]] = t[1]
-		
-	return pi_posting_date_map
diff --git a/accounts/report/payment_collection_with_ageing/__init__.py b/accounts/report/payment_period_based_on_invoice_date/__init__.py
similarity index 100%
rename from accounts/report/payment_collection_with_ageing/__init__.py
rename to accounts/report/payment_period_based_on_invoice_date/__init__.py
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.js b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
similarity index 77%
rename from accounts/report/payment_made_with_ageing/payment_made_with_ageing.js
rename to accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
index 2d27b8e..57d8931 100644
--- a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.js
+++ b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-wn.query_reports["Payment Made With Ageing"] = {
+wn.query_reports["Payment Period Based On Invoice Date"] = {
 	"filters": [
 		{
 			fieldname: "from_date",
@@ -16,8 +16,15 @@
 			default: get_today()
 		},
 		{
+			fieldname:"payment_type",
+			label: wn._("Payment Type"),
+			fieldtype: "Select",
+			options: "Incoming\nOutgoing",
+			default: "Incoming"
+		},
+		{
 			fieldname:"account",
-			label: wn._("Supplier Account"),
+			label: wn._("Account"),
 			fieldtype: "Link",
 			options: "Account",
 			get_query: function() {
@@ -25,9 +32,7 @@
 					query: "accounts.utils.get_account_list", 
 					filters: {
 						is_pl_account: "No",
-						debit_or_credit: "Credit",
-						company: wn.query_report.filters_by_name.company.get_value(),
-						master_type: "Supplier"
+						company: wn.query_report.filters_by_name.company.get_value()
 					}
 				}
 			}
diff --git a/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
new file mode 100644
index 0000000..1273360
--- /dev/null
+++ b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
@@ -0,0 +1,95 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+from webnotes import msgprint, _
+from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
+
+def execute(filters=None):
+	if not filters: filters = {}
+	
+	columns = get_columns()
+	entries = get_entries(filters)
+	invoice_posting_date_map = get_invoice_posting_date_map(filters)
+	against_date = ""
+	outstanding_amount = 0.0
+	
+	data = []
+	for d in entries:
+		if d.against_voucher:
+			against_date = d.against_voucher and invoice_posting_date_map[d.against_voucher] or ""
+			outstanding_amount = d.debit or -1*d.credit
+		else:
+			against_date = d.against_invoice and invoice_posting_date_map[d.against_invoice] or ""
+			outstanding_amount = d.credit or -1*d.debit
+		
+		row = [d.name, d.account, d.posting_date, d.against_voucher or d.against_invoice, 
+			against_date, d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
+			
+		if d.against_voucher or d.against_invoice:
+			row += get_ageing_data(d.posting_date, against_date, outstanding_amount)
+		else:
+			row += ["", "", "", "", ""]
+			
+		data.append(row)
+	
+	return columns, data
+	
+def get_columns():
+	return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140", 
+		"Posting Date:Date:100", "Against Invoice:Link/Purchase Invoice:130", 
+		"Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120", 
+		"Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40", 
+		"0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
+	]
+
+def get_conditions(filters):
+	conditions = ""
+	party_accounts = []
+	
+	if filters.get("account"):
+		party_accounts = [filters["account"]]
+	else:
+		cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
+		
+		if filters.get("payment_type") == "Incoming":
+			cond += " and master_type = 'Customer'"
+		else:
+			cond += " and master_type = 'Supplier'"
+
+		party_accounts = webnotes.conn.sql_list("""select name from `tabAccount` 
+			where ifnull(master_name, '')!='' and docstatus < 2 %s""" % cond)
+	
+	if party_accounts:
+		conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(party_accounts)))
+	else:
+		msgprint(_("No Customer or Supplier Accounts found. Accounts are identified based on \
+			'Master Type' value in account record."), raise_exception=1)
+		
+	if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"]
+	if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"]
+
+	return conditions, party_accounts
+	
+def get_entries(filters):
+	conditions, party_accounts = get_conditions(filters)
+	entries =  webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date, 
+		jvd.against_voucher, jvd.against_invoice, jvd.debit, jvd.credit, 
+		jv.cheque_no, jv.cheque_date, jv.remark 
+		from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv 
+		where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" % 
+		(conditions), tuple(party_accounts), as_dict=1)
+		
+	return entries
+	
+def get_invoice_posting_date_map(filters):
+	invoice_posting_date_map = {}
+	if filters.get("payment_type") == "Incoming":
+		for t in webnotes.conn.sql("""select name, posting_date from `tabSales Invoice`"""):
+			invoice_posting_date_map[t[0]] = t[1]
+	else:
+		for t in webnotes.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
+			invoice_posting_date_map[t[0]] = t[1]
+
+	return invoice_posting_date_map
\ No newline at end of file
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.txt
similarity index 61%
rename from accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt
rename to accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.txt
index c5c85da..4080602 100644
--- a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt
+++ b/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.txt
@@ -1,8 +1,8 @@
 [
  {
-  "creation": "2013-05-02 12:10:21", 
+  "creation": "2013-12-02 17:06:37", 
   "docstatus": 0, 
-  "modified": "2013-05-02 12:10:21", 
+  "modified": "2013-12-02 17:06:39", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -12,11 +12,11 @@
   "is_standard": "Yes", 
   "name": "__common__", 
   "ref_doctype": "Journal Voucher", 
-  "report_name": "Payment Made With Ageing", 
+  "report_name": "Payment Period Based On Invoice Date", 
   "report_type": "Script Report"
  }, 
  {
   "doctype": "Report", 
-  "name": "Payment Made With Ageing"
+  "name": "Payment Period Based On Invoice Date"
  }
 ]
\ No newline at end of file
diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js
index 5c5668e..811ed6f 100644
--- a/buying/page/buying_home/buying_home.js
+++ b/buying/page/buying_home/buying_home.js
@@ -155,6 +155,11 @@
 				route: "query-report/Supplier Addresses and Contacts",
 				doctype: "Supplier"
 			},
+			{
+				"label":wn._("Supplier-Wise Sales Analytics"),
+				route: "query-report/Supplier-Wise Sales Analytics",
+				doctype: "Stock Ledger Entry"
+			}
 		]
 	}
 ]
diff --git a/hr/doctype/salary_manager/salary_manager.js b/hr/doctype/salary_manager/salary_manager.js
index 498d596..032c29e 100644
--- a/hr/doctype/salary_manager/salary_manager.js
+++ b/hr/doctype/salary_manager/salary_manager.js
@@ -18,10 +18,6 @@
 	return $c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
 }
 
-
-
-//Submit salary slip
-//-----------------------
 cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
 	var check = confirm(wn._("Do you really want to Submit all Salary Slip for month : ") + doc.month+ wn._(" and fiscal year : ")+doc.fiscal_year);
 	if(check){
@@ -33,23 +29,21 @@
 	}
 }
 
-// Make Bank Voucher
-//-----------------------
 cur_frm.cscript.make_bank_voucher = function(doc,cdt,cdn){
-  if(doc.month && doc.fiscal_year){
-  	cur_frm.cscript.make_jv(doc, cdt, cdn);
-  }
+    if(doc.company && doc.month && doc.fiscal_year){
+    	cur_frm.cscript.make_jv(doc, cdt, cdn);
+    } else {
+  	  msgprint(wn._("Company, Month and Fiscal Year is mandatory"));
+    }
 }
 
-
-// Make JV
-//-----------------------
 cur_frm.cscript.make_jv = function(doc, dt, dn) {
-	var call_back = function(r,rt){
+	var call_back = function(r, rt){
 		var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
 		jv = locals['Journal Voucher'][jv];
 		jv.voucher_type = 'Bank Voucher';
-		jv.user_remark = wn._('Payment of salary for the month: ') + doc.month + wn._('and fiscal year: ') + doc.fiscal_year;
+		jv.user_remark = wn._('Payment of salary for the month: ') + doc.month + 
+			wn._('and fiscal year: ') + doc.fiscal_year;
 		jv.fiscal_year = doc.fiscal_year;
 		jv.company = doc.company;
 		jv.posting_date = dateutil.obj_to_str(new Date());
@@ -61,10 +55,9 @@
 
 		// debit to salary account
 		var d2 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
-		d2.account = r.message['default_salary_account'];
 		d2.debit = r.message['amount']
 
 		loaddoc('Journal Voucher', jv.name);
 	}
-	return $c_obj(make_doclist(dt,dn),'get_acc_details','',call_back);
+	return $c_obj(make_doclist(dt, dn), 'get_acc_details', '', call_back);
 }
diff --git a/hr/doctype/salary_manager/salary_manager.py b/hr/doctype/salary_manager/salary_manager.py
index 9eab5f3..29b13ae 100644
--- a/hr/doctype/salary_manager/salary_manager.py
+++ b/hr/doctype/salary_manager/salary_manager.py
@@ -3,17 +3,10 @@
 
 from __future__ import unicode_literals
 import webnotes
-
 from webnotes.utils import cint, flt
-from webnotes.model import db_exists
-from webnotes.model.doc import Document
-from webnotes.model.bean import getlist, copy_doclist
 from webnotes.model.code import get_obj
 from webnotes import msgprint
 
-	
-
-
 class DocType:
 	def __init__(self, doc, doclist):
 		self.doc = doc
@@ -198,14 +191,12 @@
 			get default bank account,default salary acount from company
 		"""
 		amt = self.get_total_salary()
-		com = webnotes.conn.sql("select default_bank_account from `tabCompany` where name = '%s'" % self.doc.company)
-		
-		if not com[0][0] or not com[0][1]:
+		default_bank_account = webnotes.conn.get_value("Company", self.doc.company, 
+			"default_bank_account")
+		if not default_bank_account:
 			msgprint("You can set Default Bank Account in Company master.")
 
-		ret = {
-			'def_bank_acc' : com and com[0][0] or '',
-			'def_sal_acc' : com and com[0][1] or '',
+		return {
+			'default_bank_account' : default_bank_account,
 			'amount' : amt
-		}
-		return ret
+		}
\ No newline at end of file
diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js
index 64298a9..a43e5da 100644
--- a/manufacturing/doctype/bom/bom.js
+++ b/manufacturing/doctype/bom/bom.js
@@ -25,7 +25,7 @@
 
 cur_frm.cscript.with_operations = function(doc) {
 	cur_frm.fields_dict["bom_materials"].grid.set_column_disp("operation_no", doc.with_operations);
-	cur_frm.fields_dict["bom_materials"].grid.toggle_reqd("operation_no", doc.with_operations)
+	cur_frm.fields_dict["bom_materials"].grid.toggle_reqd("operation_no", doc.with_operations);
 }
 
 cur_frm.cscript.operation_no = function(doc, cdt, cdn) {
diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt
index 9f69cb0..68553fb 100644
--- a/manufacturing/doctype/bom/bom.txt
+++ b/manufacturing/doctype/bom/bom.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-22 15:11:38", 
   "docstatus": 0, 
-  "modified": "2013-11-02 14:23:28", 
+  "modified": "2013-12-04 11:51:36", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -129,7 +129,6 @@
   "options": "Specify the operations, operating cost and give a unique Operation no to your operations."
  }, 
  {
-  "depends_on": "with_operations", 
   "doctype": "DocField", 
   "fieldname": "bom_operations", 
   "fieldtype": "Table", 
diff --git a/manufacturing/doctype/bom_operation/bom_operation.txt b/manufacturing/doctype/bom_operation/bom_operation.txt
index 01d7d00..cffdf4c 100644
--- a/manufacturing/doctype/bom_operation/bom_operation.txt
+++ b/manufacturing/doctype/bom_operation/bom_operation.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:49", 
   "docstatus": 0, 
-  "modified": "2013-07-22 15:28:28", 
+  "modified": "2013-12-04 11:18:59", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
diff --git a/patches/1311/p04_update_comments.py b/patches/1311/p04_update_comments.py
index aefb7e7..b076475 100644
--- a/patches/1311/p04_update_comments.py
+++ b/patches/1311/p04_update_comments.py
@@ -3,6 +3,8 @@
 
 def execute():
 	import webnotes
+	webnotes.conn.auto_commit_on_many_writes = True
 	for name in webnotes.conn.sql_list("""select name from tabComment"""):
 		webnotes.get_obj("Comment", name).update_comment_in_doc()
-	
\ No newline at end of file
+	webnotes.conn.auto_commit_on_many_writes = False
+	
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 80b84de..9400e08 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -249,10 +249,13 @@
 	"execute:webnotes.reload_doc('website', 'doctype', 'website_sitemap_config') #2013-11-20",
 	"execute:webnotes.reload_doc('website', 'doctype', 'website_sitemap') #2013-11-20",
 	"execute:webnotes.bean('Style Settings').save() #2013-11-20",
-    "execute:webnotes.get_module('website.doctype.website_sitemap_config.website_sitemap_config').rebuild_website_sitemap_config()",
-    "patches.1311.p04_update_year_end_date_of_fiscal_year",
+	"execute:webnotes.get_module('website.doctype.website_sitemap_config.website_sitemap_config').rebuild_website_sitemap_config()",
+	"patches.1311.p04_update_year_end_date_of_fiscal_year",
 	"patches.1311.p04_update_comments",
 	"patches.1311.p05_website_brand_html",
 	"patches.1311.p06_fix_report_columns",
 	"execute:webnotes.delete_doc('DocType', 'Documentation Tool')",
+	"execute:webnotes.delete_doc('Report', 'Stock Ledger') #2013-11-29",
+	"execute:webnotes.delete_doc('Report', 'Payment Collection With Ageing')",
+	"execute:webnotes.delete_doc('Report', 'Payment Made With Ageing')",
 ]
\ No newline at end of file
diff --git a/public/js/startup.js b/public/js/startup.js
index 0369170..166c379 100644
--- a/public/js/startup.js
+++ b/public/js/startup.js
@@ -26,7 +26,7 @@
 	var msg = "";
 	if (0 <= diff && diff <= 10) {
 		var expiry_string = diff==0 ? "today" : repl("in %(diff)s day(s)", { diff: diff });
-		msg = repl(wn._('Your ERPNext subscription will')+'<b>expire %(expiry_string)s</b>. %(payment_link)s',
+		msg = repl(wn._('Your ERPNext subscription will')+' <b>expire %(expiry_string)s</b>. %(payment_link)s',
 			{ expiry_string: expiry_string, payment_link: payment_link });
 	} else if (diff < 0) {
 		msg = repl(wn._('This ERPNext subscription')+'<b>'+wn._('has expired')+'</b>. %(payment_link)s', {payment_link: payment_link});
diff --git a/selling/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py
index f2b00c6..f6cfafa 100644
--- a/selling/doctype/sales_bom/sales_bom.py
+++ b/selling/doctype/sales_bom/sales_bom.py
@@ -3,8 +3,6 @@
 
 from __future__ import unicode_literals
 import webnotes
-from webnotes.utils import flt
-from webnotes.model.utils import getlist
 
 class DocType:
 	def __init__(self,d,dl):
@@ -14,8 +12,6 @@
 		self.doc.name = self.doc.new_item_code
 	
 	def validate(self):
-		# check for duplicate
-		self.check_duplicate()
 		self.validate_main_item()
 
 		from utilities.transaction_base import validate_uom_is_integer
@@ -36,40 +32,6 @@
 			'uom': det and det[0][1] or ''
 		}
 
-	def check_duplicate(self, finder=0):
-		il = getlist(self.doclist, "sales_bom_items")
-		if not il:
-			webnotes.msgprint("Add atleast one item")
-			return
-		
-		# get all Sales BOM that have the first item	
-		sbl = webnotes.conn.sql("""select distinct parent from `tabSales BOM Item` where item_code=%s 
-			and parent != %s and docstatus != 2""", (il[0].item_code, self.doc.name))
-		
-		# check all siblings
-		sub_items = [[d.item_code, flt(d.qty)] for d in il]
-		
-		for s in sbl:
-			t = webnotes.conn.sql("""select item_code, qty from `tabSales BOM Item` where parent=%s and 
-				docstatus != 2""", s[0])
-			t = [[d[0], flt(d[1])] for d in t]
-	
-			if self.has_same_items(sub_items, t):
-				webnotes.msgprint("%s has the same Sales BOM details" % s[0])
-				raise Exception
-		if finder:
-			webnotes.msgprint("There is no Sales BOM present with the following Combination.")
-
-	def has_same_items(self, l1, l2):
-		if len(l1)!=len(l2): return 0
-		for l in l2:
-			if l not in l1:
-				return 0
-		for l in l1:
-			if l not in l2:
-				return 0
-		return 1
-
 def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
 	from controllers.queries import get_match_cond
 	
diff --git a/selling/utils/cart.py b/selling/utils/cart.py
index c4c0b72..3cd7b3c 100644
--- a/selling/utils/cart.py
+++ b/selling/utils/cart.py
@@ -310,7 +310,7 @@
 	quotation.run_method("set_price_list_and_item_details")
 	
 	# set it in cookies for using in product page
-	webnotes.cookies[b"selling_price_list"] = quotation.doc.selling_price_list
+	webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list)
 	
 def set_taxes(quotation, cart_settings, billing_territory):
 	"""set taxes based on billing territory"""
diff --git a/selling/utils/product.py b/selling/utils/product.py
index d218979..32ff85a 100644
--- a/selling/utils/product.py
+++ b/selling/utils/product.py
@@ -16,7 +16,7 @@
 	
 	cart_quotation = _get_cart_quotation()
 	
-	price_list = webnotes.cookies.get("selling_price_list").value
+	price_list = webnotes.local.request.cookies.get("selling_price_list")
 
 	warehouse = webnotes.conn.get_value("Item", item_code, "website_warehouse")
 	if warehouse:
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index 121226a..a4985e9 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -207,6 +207,7 @@
 		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" % 
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index cbfc3fc..4be5a46 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -138,7 +138,8 @@
 		items: [
 			{
 				"label":wn._("Stock Ledger"),
-				page: "stock-ledger"
+				doctype: "Delivery Note",
+				route: "query-report/Stock Ledger"
 			},
 			{
 				"label":wn._("Stock Balance"),
@@ -171,11 +172,6 @@
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Stock Ledger"),
-				route: "Report/Stock Ledger Entry/Stock Ledger",
-				doctype: "Stock Ledger Entry"
-			},
-			{
 				"label":wn._("Ordered Items To Be Delivered"),
 				route: "query-report/Ordered Items To Be Delivered",
 				doctype: "Delivery Note"
diff --git a/stock/report/stock_ledger/stock_ledger.js b/stock/report/stock_ledger/stock_ledger.js
new file mode 100644
index 0000000..0e323eb
--- /dev/null
+++ b/stock/report/stock_ledger/stock_ledger.js
@@ -0,0 +1,58 @@
+// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+wn.query_reports["Stock Ledger"] = {
+	"filters": [
+		{
+			"fieldname":"company",
+			"label": wn._("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": wn.defaults.get_user_default("company"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"from_date",
+			"label": wn._("From Date"),
+			"fieldtype": "Date",
+			"default": wn.defaults.get_user_default("year_start_date"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"to_date",
+			"label": wn._("To Date"),
+			"fieldtype": "Date",
+			"default": wn.defaults.get_user_default("year_end_date"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"warehouse",
+			"label": wn._("Warehouse"),
+			"fieldtype": "Link",
+			"options": "Warehouse"
+		},
+		{
+			"fieldname":"item_code",
+			"label": wn._("Item"),
+			"fieldtype": "Link",
+			"options": "Item"
+		},
+		{
+			"fieldname":"brand",
+			"label": wn._("Brand"),
+			"fieldtype": "Link",
+			"options": "Brand"
+		},
+		{
+			"fieldname":"voucher_no",
+			"label": wn._("Voucher #"),
+			"fieldtype": "Data"
+		}
+	]
+}
+
+// $(function() {
+// 	$(wrapper).bind("show", function() {
+// 		wn.query_report.load();
+// 	});
+// });
\ No newline at end of file
diff --git a/stock/report/stock_ledger/stock_ledger.py b/stock/report/stock_ledger/stock_ledger.py
new file mode 100644
index 0000000..3ae9135
--- /dev/null
+++ b/stock/report/stock_ledger/stock_ledger.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+def execute(filters=None):
+	columns = ["Date:Datetime:95", "Item:Link/Item:100", "Item Name::100", 
+		"Item Group:Link/Item Group:100", "Brand:Link/Brand:100",
+		"Description::200", "Warehouse:Link/Warehouse:100",
+		"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:80", 
+		"Balance Value:Currency:100", "Voucher Type::100", "Voucher #::100",
+		"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
+
+	data = webnotes.conn.sql("""select concat_ws(" ", posting_date, posting_time),
+			item.name, item.item_name, item.item_group, brand, description, warehouse, sle.stock_uom,
+			actual_qty, qty_after_transaction, stock_value, voucher_type, voucher_no, 
+			batch_no, serial_no, company
+		from `tabStock Ledger Entry` sle,
+			(select name, item_name, description, stock_uom, brand, item_group
+				from `tabItem` {item_conditions}) item
+		where item_code = item.name and
+			company = %(company)s and
+			posting_date between %(from_date)s and %(to_date)s
+			{sle_conditions}
+			order by posting_date desc, posting_time desc, sle.name desc"""\
+		.format(item_conditions=get_item_conditions(filters),
+			sle_conditions=get_sle_conditions(filters)),
+		filters)
+
+	return columns, data
+	
+def get_item_conditions(filters):
+	conditions = []
+	if filters.get("item_code"):
+		conditions.append("item_code=%(item_code)s")
+	if filters.get("brand"):
+		conditions.append("brand=%(brand)s")
+	
+	return "where {}".format(" and ".join(conditions)) if conditions else ""
+	
+def get_sle_conditions(filters):
+	conditions = []
+	if filters.get("warehouse"):
+		conditions.append("warehouse=%(warehouse)s")
+	if filters.get("voucher_no"):
+		conditions.append("voucher_no=%(voucher_no)s")
+	
+	return "and {}".format(" and ".join(conditions)) if conditions else ""
\ No newline at end of file
diff --git a/stock/report/stock_ledger/stock_ledger.txt b/stock/report/stock_ledger/stock_ledger.txt
index a40be1d..aadf323 100644
--- a/stock/report/stock_ledger/stock_ledger.txt
+++ b/stock/report/stock_ledger/stock_ledger.txt
@@ -1,19 +1,18 @@
 [
  {
-  "creation": "2013-01-14 15:26:21", 
+  "creation": "2013-11-29 17:08:23", 
   "docstatus": 0, 
-  "modified": "2013-08-20 11:53:43", 
+  "modified": "2013-11-29 17:28:15", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doctype": "Report", 
   "is_standard": "Yes", 
-  "json": "{\"filters\":[],\"columns\":[[\"item_code\",\"Stock Ledger Entry\"],[\"warehouse\",\"Stock Ledger Entry\"],[\"posting_date\",\"Stock Ledger Entry\"],[\"posting_time\",\"Stock Ledger Entry\"],[\"actual_qty\",\"Stock Ledger Entry\"],[\"qty_after_transaction\",\"Stock Ledger Entry\"],[\"voucher_type\",\"Stock Ledger Entry\"],[\"voucher_no\",\"Stock Ledger Entry\"]],\"sort_by\":\"Stock Ledger Entry.posting_date\",\"sort_order\":\"desc\",\"sort_by_next\":\"Stock Ledger Entry.posting_time\",\"sort_order_next\":\"desc\"}", 
   "name": "__common__", 
   "ref_doctype": "Stock Ledger Entry", 
   "report_name": "Stock Ledger", 
-  "report_type": "Report Builder"
+  "report_type": "Script Report"
  }, 
  {
   "doctype": "Report", 
diff --git a/accounts/report/payment_collection_with_ageing/__init__.py b/stock/report/supplier_wise_sales_analytics/__init__.py
similarity index 100%
copy from accounts/report/payment_collection_with_ageing/__init__.py
copy to stock/report/supplier_wise_sales_analytics/__init__.py
diff --git a/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
new file mode 100644
index 0000000..4384b70
--- /dev/null
+++ b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.js
@@ -0,0 +1,28 @@
+// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+wn.query_reports["Supplier-Wise Sales Analytics"] = {
+	"filters": [
+		{
+			"fieldname":"supplier",
+			"label": wn._("Supplier"),
+			"fieldtype": "Link",
+			"options": "Supplier",
+			"width": "80"
+		},
+		{
+			"fieldname":"from_date",
+			"label": wn._("From Date"),
+			"fieldtype": "Date",
+			"width": "80",
+			"default": wn.datetime.month_start()
+		},
+		{
+			"fieldname":"to_date",
+			"label": wn._("To Date"),
+			"fieldtype": "Date",
+			"width": "80",
+			"default": wn.datetime.month_end()
+		},
+	]
+}
\ No newline at end of file
diff --git a/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
new file mode 100644
index 0000000..254bd90
--- /dev/null
+++ b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
@@ -0,0 +1,95 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+from webnotes.utils import flt
+
+def execute(filters=None):
+	columns = get_columns(filters)
+	consumed_details = get_consumed_details(filters)
+	supplier_details = get_suppliers_details(filters)
+	material_transfer_vouchers = get_material_transfer_vouchers()
+	data = []
+
+	for item_code, suppliers in supplier_details.items():
+		consumed_qty = consumed_amount = delivered_qty = delivered_amount = 0.0
+		total_qty = total_amount = 0.0
+		if consumed_details.get(item_code):
+			for cd in consumed_details.get(item_code):
+				
+				if (cd.voucher_no not in material_transfer_vouchers):
+					if cd.voucher_type=="Delivery Note":
+						delivered_qty += abs(flt(cd.actual_qty))
+						delivered_amount += abs(flt(cd.stock_value_difference))
+					elif cd.voucher_type!="Delivery Note":
+						consumed_qty += abs(flt(cd.actual_qty))
+						consumed_amount += abs(flt(cd.stock_value_difference))
+
+			if consumed_qty or consumed_amount or delivered_qty or delivered_amount:
+				total_qty += delivered_qty + consumed_qty
+				total_amount += delivered_amount + consumed_amount
+
+				row = [cd.item_code, cd.item_name, cd.description, cd.stock_uom, \
+					consumed_qty, consumed_amount, delivered_qty, delivered_amount, \
+					total_qty, total_amount, list(set(suppliers))]
+				data.append(row)
+
+	return columns, data
+
+def get_columns(filters):
+	"""return columns based on filters"""
+	
+	columns = ["Item:Link/Item:100"] + ["Item Name::100"] + \
+	["Description::150"] + ["UOM:Link/UOM:90"] + \
+	["Consumed Qty:Float:110"] + ["Consumed Amount:Currency:130"] + \
+	["Delivered Qty:Float:110"] + ["Delivered Amount:Currency:130"] + \
+	["Total Qty:Float:110"] + ["Total Amount:Currency:130"] + \
+	["Supplier(s)::250"]
+
+	return columns
+
+def get_conditions(filters):
+	conditions = ""
+	values = []
+
+	if filters.get('from_date') and filters.get('to_date'):
+		conditions = "and sle.posting_date>=%s and sle.posting_date<=%s"
+		values = [filters.get('from_date'), filters.get('to_date')]
+
+	return conditions, values
+
+def get_consumed_details(filters):
+	conditions, values = get_conditions(filters)
+	consumed_details = {}
+
+	for d in webnotes.conn.sql("""select sle.item_code, i.item_name, i.description, 
+		i.stock_uom, sle.actual_qty, sle.stock_value_difference, 
+		sle.voucher_no, sle.voucher_type
+		from `tabStock Ledger Entry` sle, `tabItem` i 
+		where sle.item_code=i.name and sle.actual_qty < 0 %s""" % conditions, values, as_dict=1):
+			consumed_details.setdefault(d.item_code, []).append(d)
+
+	return consumed_details
+
+def get_suppliers_details(filters):
+	item_supplier_map = {}
+	supplier = filters.get('supplier')
+
+	for d in webnotes.conn.sql("""select pr.supplier, pri.item_code from 
+		`tabPurchase Receipt` pr, `tabPurchase Receipt Item` pri 
+		where pr.name=pri.parent and pr.docstatus=1 and 
+		pri.item_code=(select name from `tabItem` where 
+			ifnull(is_stock_item, 'Yes')='Yes' and name=pri.item_code)""", as_dict=1):
+			item_supplier_map.setdefault(d.item_code, []).append(d.supplier)
+	
+	if supplier:
+		for item_code, suppliers in item_supplier_map.items():
+			if supplier not in suppliers:
+				del item_supplier_map[item_code]
+	
+	return item_supplier_map
+
+def get_material_transfer_vouchers():
+	return webnotes.conn.sql_list("""select name from `tabStock Entry` where 
+		purpose='Material Transfer' and docstatus=1""")
\ No newline at end of file
diff --git a/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.txt b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.txt
new file mode 100644
index 0000000..936292c
--- /dev/null
+++ b/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.txt
@@ -0,0 +1,22 @@
+[
+ {
+  "creation": "2013-11-29 15:45:39", 
+  "docstatus": 0, 
+  "modified": "2013-11-29 15:45:40", 
+  "modified_by": "Administrator", 
+  "owner": "Administrator"
+ }, 
+ {
+  "add_total_row": 1, 
+  "doctype": "Report", 
+  "is_standard": "Yes", 
+  "name": "__common__", 
+  "ref_doctype": "Stock Ledger Entry", 
+  "report_name": "Supplier-Wise Sales Analytics", 
+  "report_type": "Script Report"
+ }, 
+ {
+  "doctype": "Report", 
+  "name": "Supplier-Wise Sales Analytics"
+ }
+]
\ No newline at end of file
diff --git a/stock/stock_ledger.py b/stock/stock_ledger.py
index 469fa53..8702744 100644
--- a/stock/stock_ledger.py
+++ b/stock/stock_ledger.py
@@ -1,5 +1,6 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
 
 import webnotes
 from webnotes import msgprint
diff --git a/utilities/demo/make_demo.py b/utilities/demo/make_demo.py
index 67e163f..b98fd7a 100644
--- a/utilities/demo/make_demo.py
+++ b/utilities/demo/make_demo.py
@@ -153,7 +153,7 @@
 		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 @@
 		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 @@
 			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 @@
 			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 @@
 			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 @@
 	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 @@
 		"customer": get_random("Customer"),
 		"order_type": "Sales",
 		"transaction_date": current_date,
-		"fiscal_year": "2013"
+		"fiscal_year": current_date.year
 	}])
 	
 	add_random_children(b, {