Merge branch 'responsive' of git://github.com/webnotes/erpnext into responsive
diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js
index db50ff6..c12c2d6 100644
--- a/accounts/doctype/account/account.js
+++ b/accounts/doctype/account/account.js
@@ -82,7 +82,7 @@
 // -----------------------------------------
 cur_frm.cscript.add_toolbar_buttons = function(doc) {
 	cur_frm.add_custom_button('Chart of Accounts', 
-		function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-list')
+		function() { wn.set_route("Accounts Browser", "Account"); }, 'icon-sitemap')
 
 	if (cstr(doc.group_or_ledger) == 'Group') {
 		cur_frm.add_custom_button('Convert to Ledger', 
@@ -92,7 +92,12 @@
 			function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet')
 			
 		cur_frm.add_custom_button('View Ledger', function() {
-			wn.set_route("general-ledger", "account=" + doc.name);
+			wn.route_options = {
+				"account": doc.name,
+				"from_date": sys_defaults.year_start_date,
+				"to_date": sys_defaults.year_end_date
+			};
+			wn.set_route("general-ledger");
 		});
 	}
 }
diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js
index e63fa04..2a98a96 100644
--- a/accounts/doctype/cost_center/cost_center.js
+++ b/accounts/doctype/cost_center/cost_center.js
@@ -28,6 +28,9 @@
 	
 	cur_frm.toggle_display('sb1', doc.group_or_ledger=='Ledger')
 	cur_frm.set_intro(intro_txt);
+	
+	cur_frm.add_custom_button('Chart of Cost Centers', 
+		function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap')
 }
 
 //Account filtering for cost center
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 78956bf..dbe6668 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -23,7 +23,14 @@
 	erpnext.hide_naming_series();
 	cur_frm.cscript.voucher_type(doc);
 	if(doc.docstatus==1) { 
-		cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
+		cur_frm.add_custom_button('View Ledger', function() {
+			wn.route_options = {
+				"voucher_no": doc.name,
+				"from_date": doc.posting_date,
+				"to_date": doc.posting_date,
+			};
+			wn.set_route("general-ledger");
+		});
 	}
 }
 
@@ -49,8 +56,6 @@
 	if (doc.is_opening == 'Yes') unhide_field('aging_date');
 }
 
-//Set debit and credit to zero on adding new row
-//----------------------------------------------
 cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
 	var d = locals[cdt][cdn];
 	if(d.idx == 1){
@@ -59,9 +64,6 @@
 	}
 }
 
-// Get Outstanding of Payable & Sales Invoice
-// -----------------------------------------------
-
 cur_frm.cscript.against_voucher = function(doc,cdt,cdn) {
 	var d = locals[cdt][cdn];
 	if (d.against_voucher && !flt(d.debit)) {
@@ -131,18 +133,24 @@
 		cur_frm.pformat.print_heading = "Journal Voucher";
 }
 
-cur_frm.cscript.view_ledger_entry = function(doc,cdt,cdn){
-	wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);	
-}
-
-
 cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
 	cur_frm.set_df_property("cheque_no", "reqd", doc.voucher_type=="Bank Voucher");
 	cur_frm.set_df_property("cheque_date", "reqd", doc.voucher_type=="Bank Voucher");
+
+	if(wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length!==0 // too late
+		|| !doc.company) // too early
+		return;
 	
-	if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type) 
-		&& doc.company
-		&& wn.model.get("Journal Voucher Detail", {"parent":doc.name}).length==0) {
+	var update_jv_details = function(doc, r) {
+		$.each(r.message, function(i, d) {
+			var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
+			jvdetail.account = d.account;
+			jvdetail.balance = d.balance;
+		});
+		refresh_field("entries");
+	}
+	
+	if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
 		wn.call({
 			type: "GET",
 			method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
@@ -152,14 +160,26 @@
 			},
 			callback: function(r) {
 				if(r.message) {
-					var jvdetail = wn.model.add_child(doc, "Journal Voucher Detail", "entries");
-					jvdetail.account = r.message.account;
-					// this is a data field????
-					jvdetail.balance = format_currency(r.message.balance);
-					refresh_field("entries");
+					update_jv_details(doc, r);
 				}
 			}
 		})
+	} else if(doc.voucher_type=="Opening Entry") {
+		wn.call({
+			type:"GET",
+			method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
+			args: {
+				"company": doc.company
+			},
+			callback: function(r) {
+				wn.model.clear_table("Journal Voucher Detail", "Journal Voucher", 
+					doc.name, "entries");
+				if(r.message) {
+					update_jv_details(doc, r);
+				}
+				cur_frm.set_value("is_opening", "Yes")
+			}
+		})
 	}
 }
 
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
index 2c5cd4f..77fec8e 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -352,11 +352,20 @@
 	account = webnotes.conn.get_value("Company", company,
 		voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
 	if account:
-		return {
+		return [{
 			"account": account,
 			"balance": get_balance_on(account)
-		}
+		}]
 
+@webnotes.whitelist()
+def get_opening_accounts(company):
+	"""get all balance sheet accounts for opening entry"""
+	from accounts.utils import get_balance_on
+	accounts = webnotes.conn.sql_list("""select name from tabAccount 
+		where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)
+	
+	return [{"account": a, "balance": get_balance_on(a)} for a in accounts]
+	
 def get_against_purchase_invoice(doctype, txt, searchfield, start, page_len, filters):
 	return webnotes.conn.sql("""select name, credit_to, outstanding_amount, bill_no, bill_date 
 		from `tabPurchase Invoice` where credit_to = %s and docstatus = 1 
diff --git a/accounts/doctype/journal_voucher/journal_voucher.txt b/accounts/doctype/journal_voucher/journal_voucher.txt
index d0163e6..603eb99 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.txt
+++ b/accounts/doctype/journal_voucher/journal_voucher.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-03-25 10:53:52", 
   "docstatus": 0, 
-  "modified": "2013-06-11 16:04:20", 
+  "modified": "2013-06-28 14:27:11", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -68,7 +68,7 @@
   "label": "Voucher Type", 
   "oldfieldname": "voucher_type", 
   "oldfieldtype": "Select", 
-  "options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher", 
+  "options": "\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nOpening Entry", 
   "print_hide": 0, 
   "read_only": 0, 
   "search_index": 1
diff --git a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
index 68019cb..9946bfb 100644
--- a/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
+++ b/accounts/doctype/journal_voucher_detail/journal_voucher_detail.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-02-22 01:27:39", 
   "docstatus": 0, 
-  "modified": "2013-04-17 14:05:18", 
+  "modified": "2013-07-01 13:53:33", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -74,11 +74,12 @@
  {
   "doctype": "DocField", 
   "fieldname": "balance", 
-  "fieldtype": "Data", 
+  "fieldtype": "Currency", 
   "label": "Account Balance", 
   "no_copy": 1, 
   "oldfieldname": "balance", 
   "oldfieldtype": "Data", 
+  "options": "Company:company:default_currency", 
   "read_only": 1
  }, 
  {
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 665fbb7..cf308e3 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -42,7 +42,14 @@
 			this.frm.add_custom_button('Make Payment Entry', this.make_bank_voucher);
 
 		if(doc.docstatus==1) { 
-			this.frm.add_custom_button('View Ledger', this.view_ledger_entry);
+			cur_frm.add_custom_button('View Ledger', function() {
+				wn.route_options = {
+					"voucher_no": doc.name,
+					"from_date": doc.posting_date,
+					"to_date": doc.posting_date,
+				};
+				wn.set_route("general-ledger");
+			});
 		}
 		
 		this.is_opening(doc);
@@ -226,8 +233,4 @@
 	}
 	else
 		cur_frm.pformat.print_heading = "Purchase Invoice";
-}
-
-cur_frm.cscript.view_ledger_entry = function(){
-	wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
-}
+}
\ No newline at end of file
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index ab10534..ca4ca92 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -45,7 +45,15 @@
 		cur_frm.cscript.is_opening(doc, dt, dn);
 
 		if(doc.docstatus==1) {
-			cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
+			cur_frm.add_custom_button('View Ledger', function() {
+				wn.route_options = {
+					"voucher_no": doc.name,
+					"from_date": doc.posting_date,
+					"to_date": doc.posting_date,
+				};
+				wn.set_route("general-ledger");
+			});
+
 			cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
 
 			if(doc.is_pos==1 && doc.update_stock!=1)
@@ -381,11 +389,6 @@
 }
 
 
-/****************** Get Accounting Entry *****************/
-cur_frm.cscript.view_ledger_entry = function(){	
-	wn.set_route('Report', 'GL Entry', 'General Ledger', 'Voucher No='+cur_frm.doc.name);
-}
-
 cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
 	if(cint(wn.boot.notification_settings.sales_invoice)) {
 		cur_frm.email_doc(wn.boot.notification_settings.sales_invoice_message);
diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js
index f7e476a..3ca51b8 100644
--- a/accounts/page/accounts_home/accounts_home.js
+++ b/accounts/page/accounts_home/accounts_home.js
@@ -3,6 +3,7 @@
 
 wn.module_page["Accounts"] = [
 	{
+		top: true,
 		title: wn._("Documents"),
 		icon: "icon-copy",
 		items: [
diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js
index 1f8618f..769812f 100644
--- a/accounts/page/general_ledger/general_ledger.js
+++ b/accounts/page/general_ledger/general_ledger.js
@@ -22,10 +22,7 @@
 	});
 	
 	erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
-	
-	wrapper.appframe.add_home_breadcrumb()
 	wrapper.appframe.add_module_icon("Accounts")
-	wrapper.appframe.add_breadcrumb("icon-bar-chart")
 
 }
 
@@ -110,7 +107,7 @@
 		// filter accounts options by company
 		this.filter_inputs.company.change(function() {
 			me.setup_account_filter(this);
-			me.set_route()
+			me.refresh()
 		});
 		
 		this.filter_inputs.account.change(function() {
@@ -220,13 +217,15 @@
 					}
 				}
 				
-				if(date < from_date || item.is_opening=="Yes") {
+				if(!me.voucher_no && (date < from_date || item.is_opening=="Yes")) {
 					opening.debit += item.debit;
 					opening.credit += item.credit;
 
 					grouped_ledgers[item.account].opening.debit += item.debit;
 					grouped_ledgers[item.account].opening.credit += item.credit;
+
 				} else if(date <= to_date) {
+
 					totals.debit += item.debit;
 					totals.credit += item.credit;
 
@@ -242,7 +241,7 @@
 						+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
 				}
 
-				if(me.apply_filters(item) && item.is_opening=="No") {
+				if(me.apply_filters(item) && (me.voucher_no || item.is_opening=="No")) {
 					out.push(item);
 					grouped_ledgers[item.account].entries.push(item);
 					
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.js b/accounts/page/voucher_import_tool/voucher_import_tool.js
index bf6b065..48216b8 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.js
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.js
@@ -9,11 +9,11 @@
 		<p class="help">Import multiple accounting entries via CSV (spreadsheet) file:</p>\
 		<h3>1. Download Template</h3><br>\
 		<div style="padding-left: 30px;">\
-			<button class="btn btn-download-two-accounts">Download</button>\
+			<button class="btn btn-default btn-download-two-accounts">Download</button>\
 			<p class="help">Import multiple vouchers with one debit and one credit entry</p>\
 		</div>\
 		<div style="padding-left: 30px;">\
-			<button class="btn btn-download-multiple-accounts">Download</button>\
+			<button class="btn btn-default btn-download-multiple-accounts">Download</button>\
 			<p class="help">Import multiple vouchers with multiple accounts</p>\
 		</div>\
 		<hr>\
diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js
index 0151a60..1db8d41 100644
--- a/buying/page/buying_home/buying_home.js
+++ b/buying/page/buying_home/buying_home.js
@@ -4,6 +4,7 @@
 wn.module_page["Buying"] = [
 	{
 		title: wn._("Documents"),
+		top: true,
 		icon: "icon-copy",
 		items: [
 			{
diff --git a/buying/utils.py b/buying/utils.py
index 3c8f693..23d5593 100644
--- a/buying/utils.py
+++ b/buying/utils.py
@@ -51,6 +51,9 @@
 	
 	out.supplier_part_no = _get_supplier_part_no(args, item_bean)
 	
+	if not out.warehouse:
+		out.warehouse = item_bean.doc.default_warehouse
+	
 	if out.warehouse:
 		out.projected_qty = get_projected_qty(item.name, out.warehouse)
 	
diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js
index bee05f6..517fb77 100644
--- a/hr/page/hr_home/hr_home.js
+++ b/hr/page/hr_home/hr_home.js
@@ -3,10 +3,16 @@
 
 wn.module_page["HR"] = [
 	{
-		title: wn._("Documents"),
+		title: wn._("Top"),
+		top: true,
 		icon: "icon-copy",
 		items: [
 			{
+				label: wn._("Employee"),
+				description: wn._("Employee records."),
+				doctype:"Employee"
+			},
+			{
 				label: wn._("Leave Application"),
 				description: wn._("Applications for leave."),
 				doctype:"Leave Application"
@@ -17,6 +23,17 @@
 				doctype:"Expense Claim"
 			},
 			{
+				label: wn._("Job Applicant"),
+				description: wn._("Applicant for a Job."),
+				doctype:"Job Applicant"
+			},
+		]
+	},
+	{
+		title: wn._("Documents"),
+		icon: "icon-copy",
+		items: [
+			{
 				label: wn._("Attendance"),
 				description: wn._("Attendance record."),
 				doctype:"Attendance"
@@ -31,22 +48,6 @@
 				description: wn._("Performance appraisal."),
 				doctype:"Appraisal"
 			},
-			{
-				label: wn._("Job Applicant"),
-				description: wn._("Applicant for a Job."),
-				doctype:"Job Applicant"
-			},
-		]
-	},
-	{
-		title: wn._("Masters"),
-		icon: "icon-book",
-		items: [
-			{
-				label: wn._("Employee"),
-				description: wn._("Employee records."),
-				doctype:"Employee"
-			},
 		]
 	},
 	{
diff --git a/manufacturing/page/manufacturing_home/manufacturing_home.js b/manufacturing/page/manufacturing_home/manufacturing_home.js
index d4841df..7085f9a 100644
--- a/manufacturing/page/manufacturing_home/manufacturing_home.js
+++ b/manufacturing/page/manufacturing_home/manufacturing_home.js
@@ -4,9 +4,15 @@
 wn.module_page["Manufacturing"] = [
 	{
 		title: wn._("Documents"),
+		top: true,
 		icon: "icon-copy",
 		items: [
 			{
+				label: wn._("Bill of Materials"),
+				description: wn._("Bill of Materials (BOM)"),
+				doctype:"BOM"
+			},
+			{
 				label: wn._("Production Order"),
 				description: wn._("Orders released for production."),
 				doctype:"Production Order"
@@ -30,11 +36,6 @@
 		icon: "icon-book",
 		items: [
 			{
-				label: wn._("Bill of Materials"),
-				description: wn._("Bill of Materials (BOM)"),
-				doctype:"BOM"
-			},
-			{
 				label: wn._("Item"),
 				description: wn._("All Products or Services."),
 				doctype:"Item"
diff --git a/master.sql.gz b/master.sql.gz
deleted file mode 100644
index 030ee05..0000000
--- a/master.sql.gz
+++ /dev/null
Binary files differ
diff --git a/projects/page/projects_home/projects_home.js b/projects/page/projects_home/projects_home.js
index fd13a67..ea078e8 100644
--- a/projects/page/projects_home/projects_home.js
+++ b/projects/page/projects_home/projects_home.js
@@ -3,8 +3,9 @@
 
 wn.module_page["Projects"] = [
 	{
-		title: wn._("Documents"),
+		title: wn._("Top"),
 		icon: "icon-copy",
+		top: true,
 		items: [
 			{
 				label: wn._("Task"),
@@ -21,6 +22,12 @@
 				description: wn._("Time Log for tasks."),
 				doctype:"Time Log"
 			},
+		]
+	},
+	{
+		title: wn._("Documents"),
+		icon: "icon-copy",
+		items: [
 			{
 				label: wn._("Time Log Batch"),
 				description: wn._("Batch Time Logs for billing."),
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index 15d34e0..3021d75 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -20,13 +20,12 @@
 	show_stock_ledger: function() {
 		var me = this;
 		this.frm.add_custom_button("Show Stock Ledger", function() {
-			var args = {
-				voucher_no: cur_frm.doc.name,
-				from_date: wn.datetime.str_to_user(cur_frm.doc.posting_date),
-				to_date: wn.datetime.str_to_user(cur_frm.doc.posting_date)
-			};	
-			wn.set_route('stock-ledger', 
-				$.map(args, function(val, key) { return key+"="+val; }).join("&&"));
+			wn.route_options = {
+				voucher_no: me.frm.doc.name,
+				from_date: cur_frm.doc.posting_date,
+				to_date: cur_frm.doc.posting_date
+			};
+			wn.set_route('stock-ledger');
 		}, "icon-bar-chart");
 	}
 });
\ No newline at end of file
diff --git a/selling/page/selling_home/selling_home.js b/selling/page/selling_home/selling_home.js
index 388fa42..8eae737 100644
--- a/selling/page/selling_home/selling_home.js
+++ b/selling/page/selling_home/selling_home.js
@@ -3,6 +3,7 @@
 
 wn.module_page["Selling"] = [
 	{
+		top: true,
 		title: wn._("Documents"),
 		icon: "icon-copy",
 		items: [
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index 54a293f..446d602 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -201,8 +201,8 @@
 		
 		for a in accounts:
 			account_name = accounts[a] + " - " + self.doc.abbr
-			if not self.doc.fields[a] and webnotes.conn.exists("Account", account_name):
-				webnotes.conn.set(self.doc, account_name)
+			if not self.doc.fields.get(a) and webnotes.conn.exists("Account", account_name):
+				webnotes.conn.set(self.doc, a, account_name)
 
 		if not self.doc.stock_adjustment_cost_center:
 				webnotes.conn.set(self.doc, "stock_adjustment_cost_center", self.doc.cost_center)
diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py
index 8b44f7e..a4af7f8 100644
--- a/setup/doctype/setup_control/setup_control.py
+++ b/setup/doctype/setup_control/setup_control.py
@@ -61,13 +61,20 @@
 			WHERE name=%(name)s AND docstatus<2""", args)
 	
 	def create_fiscal_year_and_company(self, args):
-		curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
-		# Fiscal Year
+		curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'), True)
 		webnotes.bean([{
 			"doctype":"Fiscal Year",
 			'year': curr_fiscal_year,
 			'year_start_date': fy_start_date,
 		}]).insert()
+
+		curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
+		webnotes.bean([{
+			"doctype":"Fiscal Year",
+			'year': curr_fiscal_year,
+			'year_start_date': fy_start_date,
+		}]).insert()
+
 		
 		# Company
 		webnotes.bean([{
@@ -198,13 +205,15 @@
 		
 	# Get Fiscal year Details
 	# ------------------------
-	def get_fy_details(self, fy_start):
+	def get_fy_details(self, fy_start, last_year=False):
 		st = {'1st Jan':'01-01','1st Apr':'04-01','1st Jul':'07-01', '1st Oct': '10-01'}
 		curr_year = getdate(nowdate()).year
+		if last_year:
+			curr_year = curr_year - 1
 		if cint(getdate(nowdate()).month) < cint((st[fy_start].split('-'))[0]):
 			curr_year = getdate(nowdate()).year - 1
 		stdt = cstr(curr_year)+'-'+cstr(st[fy_start])
-		#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
+
 		if(fy_start == '1st Jan'):
 			fy = cstr(getdate(nowdate()).year)
 			abbr = cstr(fy)[-2:]
diff --git a/setup/page/setup/setup.py b/setup/page/setup/setup.py
index 10fc2a4..348fce9 100644
--- a/setup/page/setup/setup.py
+++ b/setup/page/setup/setup.py
@@ -93,6 +93,19 @@
 	{ "doctype": "Purchase Taxes and Charges Master" },
 	{
 		"type": "Section",
+		"title": "Opening Accounts and Stock",
+		"icon": "icon-eye-open"
+	},
+	{ "doctype": "Stock Reconciliation" },
+	{ 
+		"doctype": "Journal Voucher",
+		"title": "Opening Accounting Entries",
+		"filter": {
+			"is_opening": "Yes"
+		}
+	},
+	{
+		"type": "Section",
 		"title": "Human Resource",
 		"icon": "icon-group"
 	},
@@ -150,19 +163,6 @@
 	},
 	{
 		"type": "Section",
-		"title": "Opening Accounts and Stock",
-		"icon": "icon-eye-open"
-	},
-	{ "doctype": "Stock Reconciliation" },
-	{ 
-		"doctype": "Journal Voucher",
-		"title": "Opening Accounting Entries",
-		"filter": {
-			"is_opening": "Yes"
-		}
-	},
-	{
-		"type": "Section",
 		"title": "Customization",
 		"icon": "icon-glass"
 	},
@@ -244,8 +244,8 @@
 	elif "filter" in item:
 		key = item["filter"].keys()[0]
 		item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where
-			%s = %s""" % (item["doctype"], key, "%s"),
+			%s = %s and docstatus < 2""" % (item["doctype"], key, "%s"),
 			item["filter"][key])[0][0]
 	elif "doctype" in item:
-		item["count"] = webnotes.conn.sql("select count(*) from `tab%s`" \
+		item["count"] = webnotes.conn.sql("select count(*) from `tab%s` where docstatus<2" \
 			% item["doctype"])[0][0]
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index d6c1f52..cd1f37c 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -25,6 +25,7 @@
 from webnotes.model.controller import DocListController
 
 class PriceListCurrencyMismatch(Exception): pass
+class WarehouseNotSet(Exception): pass
 
 class DocType(DocListController):
 	def autoname(self):
@@ -39,7 +40,8 @@
 	def validate(self):
 		if not self.doc.stock_uom:
 			msgprint(_("Please enter Default Unit of Measure"), raise_exception=1)
-			
+		
+		self.check_warehouse_is_set_for_stock_item()
 		self.check_stock_uom_with_bin()
 		self.validate_conversion_factor()
 		self.add_default_uom_in_conversion_factor_table()
@@ -60,6 +62,11 @@
 		self.validate_name_with_item_group()
 		self.update_website()
 
+	def check_warehouse_is_set_for_stock_item(self):
+		if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
+			webnotes.msgprint(_("Default Warehouse is mandatory for Stock Item."),
+				raise_exception=WarehouseNotSet)
+			
 	def add_default_uom_in_conversion_factor_table(self):
 		uom_conv_list = [d.uom for d in self.doclist.get({"parentfield": "uom_conversion_details"})]
 		if self.doc.stock_uom not in uom_conv_list:
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index 1273b12..d5fcb9e 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-05-03 10:45:46", 
   "docstatus": 0, 
-  "modified": "2013-06-26 21:39:46", 
+  "modified": "2013-07-01 11:45:59", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -205,11 +205,11 @@
  }, 
  {
   "depends_on": "eval:doc.is_stock_item==\"Yes\"", 
-  "description": "Mandatory if Stock Item is \"Yes\"", 
+  "description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.", 
   "doctype": "DocField", 
   "fieldname": "default_warehouse", 
   "fieldtype": "Link", 
-  "label": "Default Reserved Warehouse", 
+  "label": "Default Warehouse", 
   "oldfieldname": "default_warehouse", 
   "oldfieldtype": "Link", 
   "options": "Warehouse", 
diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py
index 2145631..35cad9d 100644
--- a/stock/doctype/item/test_item.py
+++ b/stock/doctype/item/test_item.py
@@ -35,6 +35,13 @@
 		item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD"
 		self.assertRaises(PriceListCurrencyMismatch, item.insert)
 
+	def test_default_warehouse(self):
+		from stock.doctype.item.item import WarehouseNotSet
+		item = webnotes.bean(copy=test_records[0])
+		item.doc.is_stock_item = "Yes"
+		item.doc.default_warehouse = None
+		self.assertRaises(WarehouseNotSet, item.insert)
+		
 
 test_records = [
 	[{
@@ -77,6 +84,7 @@
 		"item_name": "_Test Item Home Desktop 100",
 		"description": "_Test Item Home Desktop 100",
 		"item_group": "_Test Item Group Desktops",
+		"default_warehouse": "_Test Warehouse",
 		"is_stock_item": "Yes",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -101,6 +109,7 @@
 		"item_name": "_Test Item Home Desktop 200",
 		"description": "_Test Item Home Desktop 200",
 		"item_group": "_Test Item Group Desktops",
+		"default_warehouse": "_Test Warehouse",
 		"is_stock_item": "Yes",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
@@ -140,6 +149,7 @@
 		"description": "_Test FG Item",
 		"item_group": "_Test Item Group Desktops",
 		"is_stock_item": "Yes",
+		"default_warehouse": "_Test Warehouse",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
 		"has_serial_no": "No",
@@ -178,6 +188,7 @@
 		"description": "_Test Serialized Item",
 		"item_group": "_Test Item Group Desktops",
 		"is_stock_item": "Yes",
+		"default_warehouse": "_Test Warehouse",
 		"is_asset_item": "No",
 		"has_batch_no": "No",
 		"has_serial_no": "Yes",
diff --git a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index 3492931..b2a1085 100644
--- a/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -121,8 +121,6 @@
 			self.doc.posting_time = '00:00'
 			
 	def on_doctype_update(self):
-		webnotes.msgprint(webnotes.conn.sql("""show index from `tabStock Ledger Entry` 
-			where Key_name="posting_sort_index" """))
 		if not webnotes.conn.sql("""show index from `tabStock Ledger Entry` 
 			where Key_name="posting_sort_index" """):
 			webnotes.conn.commit()
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.js b/stock/doctype/stock_reconciliation/stock_reconciliation.js
index cf6821e..dd49683 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -48,8 +48,6 @@
 				return {
 					"query": "accounts.utils.get_account_list", 
 					"filters": {
-						"is_pl_account": "Yes",
-						"debit_or_credit": "Debit",
 						"company": me.frm.doc.company
 					}
 				}
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index c92c6fe..b17784f 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -4,6 +4,7 @@
 wn.module_page["Stock"] = [
 	{
 		title: wn._("Documents"),
+		top: true,
 		icon: "icon-copy",
 		items: [
 			{
diff --git a/stock/page/stock_ledger/stock_ledger.js b/stock/page/stock_ledger/stock_ledger.js
index 438f132..3ca27c5 100644
--- a/stock/page/stock_ledger/stock_ledger.js
+++ b/stock/page/stock_ledger/stock_ledger.js
@@ -22,10 +22,7 @@
 	});
 	
 	new erpnext.StockLedger(wrapper);
-	
-	wrapper.appframe.add_home_breadcrumb()
 	wrapper.appframe.add_module_icon("Stock")
-	wrapper.appframe.add_breadcrumb("icon-bar-chart")
 }
 
 wn.require("app/js/stock_grid_report.js");
diff --git a/support/page/support_home/support_home.js b/support/page/support_home/support_home.js
index 65ea4b8..ea8474c 100644
--- a/support/page/support_home/support_home.js
+++ b/support/page/support_home/support_home.js
@@ -3,7 +3,8 @@
 
 wn.module_page["Support"] = [
 	{
-		title: wn._("Documents"),
+		title: wn._("Top"),
+		top: true,
 		icon: "icon-copy",
 		items: [
 			{
@@ -16,6 +17,13 @@
 				description: wn._("Customer Issue against Serial No."),
 				doctype:"Customer Issue"
 			},
+		]
+	},
+
+	{
+		title: wn._("Documents"),
+		icon: "icon-copy",
+		items: [
 			{
 				label: wn._("Maintenance Schedule"),
 				description: wn._("Plan for maintenance visits."),
diff --git a/utilities/doctype/address/address.py b/utilities/doctype/address/address.py
index c475da1..4020766 100644
--- a/utilities/doctype/address/address.py
+++ b/utilities/doctype/address/address.py
@@ -27,13 +27,13 @@
 
 	def autoname(self):
 		if not self.doc.address_title:
-			self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner or self.doc.lead
-			
+			self.doc.address_title = self.doc.customer \
+				or self.doc.supplier or self.doc.sales_partner or self.doc.lead
+				
 		if self.doc.address_title:
 			self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip()
-			
 		else:
-			webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True)
+			webnotes.msgprint("""Address Title is mandatory.""" + self.doc.customer, raise_exception=True)
 		
 	def validate(self):
 		self.validate_primary_address()
diff --git a/utilities/doctype/address/address.txt b/utilities/doctype/address/address.txt
index ed39c75..827331d 100644
--- a/utilities/doctype/address/address.txt
+++ b/utilities/doctype/address/address.txt
@@ -2,7 +2,7 @@
  {
   "creation": "2013-01-10 16:34:32", 
   "docstatus": 0, 
-  "modified": "2013-06-28 17:06:32", 
+  "modified": "2013-07-01 15:56:39", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
@@ -59,7 +59,7 @@
   "fieldname": "address_title", 
   "fieldtype": "Data", 
   "label": "Address Title", 
-  "reqd": 1
+  "reqd": 0
  }, 
  {
   "doctype": "DocField", 
diff --git a/website/page/website_home/website_home.js b/website/page/website_home/website_home.js
index fb612df..bdedcc9 100644
--- a/website/page/website_home/website_home.js
+++ b/website/page/website_home/website_home.js
@@ -5,6 +5,7 @@
 	{
 		title: wn._("Web Content"),
 		icon: "icon-copy",
+		top: true,
 		items: [
 			{
 				label: wn._("Web Page"),
@@ -12,20 +13,20 @@
 				doctype:"Web Page"
 			},
 			{
-				label: wn._("Website Slideshow"),
-				description: wn._("Embed image slideshows in website pages."),
-				doctype:"Website Slideshow"
+				label: wn._("Blog Post"),
+				description: wn._("Single Post (article)."),
+				doctype:"Blog Post"
 			},
 		]
 	},
 	{
-		title: wn._("Blog"),
+		title: wn._("Documents"),
 		icon: "icon-edit",
 		items: [
 			{
-				label: wn._("Blog Post"),
-				description: wn._("Single Post (article)."),
-				doctype:"Blog Post"
+				label: wn._("Website Slideshow"),
+				description: wn._("Embed image slideshows in website pages."),
+				doctype:"Website Slideshow"
 			},
 			{
 				label: wn._("Blogger"),