Merge pull request #2617 from neilLasrado/sales-order

sales order - allow same item to enter multiple times. Throws warning
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index b4e8f1d..972eece 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -16,3 +16,20 @@
 		};
 	});
 }
+
+frappe.ui.form.on("Bank Reconciliation", "update_clearance_date", function(frm) {
+	return frappe.call({
+		method: "update_details",
+		doc: frm.doc
+	})
+})
+
+frappe.ui.form.on("Bank Reconciliation", "get_relevant_entries", function(frm) {
+	return frappe.call({
+		method: "get_details",
+		doc: frm.doc,
+		callback: function(r, rt) {
+			frm.refresh()
+		}
+	})
+})
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
index 8e02873..c5a2a96 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.json
@@ -1,108 +1,108 @@
 {
- "allow_copy": 1,
- "allow_email": 1,
- "allow_print": 1,
- "creation": "2013-01-10 16:34:05",
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 1, 
+ "allow_email": 1, 
+ "allow_print": 1, 
+ "creation": "2013-01-10 16:34:05", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "description": "Select account head of the bank where cheque was deposited.",
-   "fieldname": "bank_account",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Bank Account",
-   "options": "Account",
-   "permlevel": 0,
+   "description": "Select account head of the bank where cheque was deposited.", 
+   "fieldname": "bank_account", 
+   "fieldtype": "Link", 
+   "in_list_view": 1, 
+   "label": "Bank Account", 
+   "options": "Account", 
+   "permlevel": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "fieldname": "company",
-   "fieldtype": "Link",
-   "hidden": 1,
-   "in_list_view": 1,
-   "label": "Company",
-   "options": "Company",
-   "permlevel": 0,
-   "print_hide": 1,
+   "fieldname": "company", 
+   "fieldtype": "Link", 
+   "hidden": 1, 
+   "in_list_view": 1, 
+   "label": "Company", 
+   "options": "Company", 
+   "permlevel": 0, 
+   "print_hide": 1, 
    "reqd": 0
-  },
+  }, 
   {
-   "fieldname": "from_date",
-   "fieldtype": "Date",
-   "in_list_view": 1,
-   "label": "From Date",
-   "permlevel": 0,
+   "fieldname": "from_date", 
+   "fieldtype": "Date", 
+   "in_list_view": 1, 
+   "label": "From Date", 
+   "permlevel": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "fieldname": "to_date",
-   "fieldtype": "Date",
-   "in_list_view": 1,
-   "label": "To Date",
-   "permlevel": 0,
+   "fieldname": "to_date", 
+   "fieldtype": "Date", 
+   "in_list_view": 1, 
+   "label": "To Date", 
+   "permlevel": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "fieldname": "include_reconciled_entries",
-   "fieldtype": "Check",
-   "in_list_view": 1,
-   "label": "Include Reconciled Entries",
+   "fieldname": "include_reconciled_entries", 
+   "fieldtype": "Check", 
+   "in_list_view": 1, 
+   "label": "Include Reconciled Entries", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "get_relevant_entries",
-   "fieldtype": "Button",
-   "label": "Get Relevant Entries",
-   "options": "get_details",
+   "fieldname": "get_relevant_entries", 
+   "fieldtype": "Button", 
+   "label": "Get Relevant Entries", 
+   "options": "", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "journal_entries",
-   "fieldtype": "Table",
-   "label": "Journal Entries",
-   "options": "Bank Reconciliation Detail",
+   "fieldname": "journal_entries", 
+   "fieldtype": "Table", 
+   "label": "Journal Entries", 
+   "options": "Bank Reconciliation Detail", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "update_clearance_date",
-   "fieldtype": "Button",
-   "label": "Update Clearance Date",
-   "options": "update_details",
+   "fieldname": "update_clearance_date", 
+   "fieldtype": "Button", 
+   "label": "Update Clearance Date", 
+   "options": "", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "total_amount",
-   "fieldtype": "Currency",
-   "label": "Total Amount",
-   "options": "Company:company:default_currency",
-   "permlevel": 0,
+   "fieldname": "total_amount", 
+   "fieldtype": "Currency", 
+   "label": "Total Amount", 
+   "options": "Company:company:default_currency", 
+   "permlevel": 0, 
    "read_only": 1
   }
- ],
- "hide_heading": 1,
- "hide_toolbar": 1,
- "icon": "icon-check",
- "idx": 1,
- "issingle": 1,
- "modified": "2014-12-25 13:16:16.711609",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Bank Reconciliation",
- "owner": "Administrator",
+ ], 
+ "hide_heading": 1, 
+ "hide_toolbar": 1, 
+ "icon": "icon-check", 
+ "idx": 1, 
+ "issingle": 1, 
+ "modified": "2015-01-19 07:49:15.830001", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Bank Reconciliation", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "permlevel": 0,
-   "read": 1,
-   "report": 0,
-   "role": "Accounts User",
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "permlevel": 0, 
+   "read": 1, 
+   "report": 0, 
+   "role": "Accounts User", 
+   "submit": 0, 
    "write": 1
   }
- ],
+ ], 
  "read_only": 1
-}
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json
index f8d59f8..20c5ca4 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.json
+++ b/erpnext/accounts/doctype/cost_center/cost_center.json
@@ -79,7 +79,7 @@
    "permlevel": 0
   }, 
   {
-   "description": "Select Budget Distribution, if you want to track based on seasonality.", 
+   "description": "Select Monthly Distribution, if you want to track based on seasonality.", 
    "fieldname": "distribution_id", 
    "fieldtype": "Link", 
    "label": "Distribution Id", 
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
index 095c64a..7d801dc 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
@@ -1,12 +1,12 @@
 {
  "autoname": "field:distribution_id", 
  "creation": "2013-01-10 16:34:05", 
- "description": "**Budget Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Budget Distribution** in the **Cost Center**", 
+ "description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "fields": [
   {
-   "description": "Name of the Budget Distribution", 
+   "description": "Name of the Monthly Distribution", 
    "fieldname": "distribution_id", 
    "fieldtype": "Data", 
    "in_list_view": 1, 
diff --git a/erpnext/accounts/doctype/monthly_distribution/test_records.json b/erpnext/accounts/doctype/monthly_distribution/test_records.json
index ffc6c68..8dbf210 100644
--- a/erpnext/accounts/doctype/monthly_distribution/test_records.json
+++ b/erpnext/accounts/doctype/monthly_distribution/test_records.json
@@ -1,8 +1,8 @@
 [{
-	"doctype": "Budget Distribution",
+	"doctype": "Monthly Distribution",
 	"distribution_id": "_Test Distribution",
 	"fiscal_year": "_Test Fiscal Year 2013",
-	"budget_distribution_details": [
+	"percentages": [
 		{
 			"month": "January",
 			"percentage_allocation": "8"
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index c2632bf..95bfad5 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -109,7 +109,7 @@
 	},
 
 	on_submit: function() {
-		$.each(this.frm.doc["items"], function(i, row) {
+		$.each(this.frm.doc["items"] || [], function(i, row) {
 			if(row.purchase_receipt) frappe.model.clear_doc("Purchase Receipt", row.purchase_receipt)
 		})
 	}
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_purchase_taxes_and_charges_master.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_purchase_taxes_and_charges_master.py
deleted file mode 100644
index 4f600bd..0000000
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_purchase_taxes_and_charges_master.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
-# See license.txt
-
-import frappe
-import unittest
-
-test_records = frappe.get_test_records('Purchase Taxes and Charges Master')
-
-class TestPurchaseTaxesandChargesMaster(unittest.TestCase):
-	pass
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_records.json b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_records.json
deleted file mode 100644
index e230c20..0000000
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/test_records.json
+++ /dev/null
@@ -1,6 +0,0 @@
-[
-	{
-		"doctype": "Purchase Taxes and Charges Master",
-		"name": "_Test Purchase Taxes and Charges Master 1"
-	}
-]
diff --git a/erpnext/accounts/page/accounts_browser/accounts_browser.js b/erpnext/accounts/page/accounts_browser/accounts_browser.js
index 98fc58e..6aa4c0f 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.js
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.js
@@ -7,7 +7,7 @@
 // edit node
 // see ledger
 
-pscript['onload_Accounts Browser'] = function(wrapper){
+frappe.pages["Accounts Browser"].on_page_load  = function(wrapper){
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		single_column: true
@@ -58,7 +58,6 @@
 			var ctype = frappe.get_route()[1] || 'Account';
 			erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(),
 				chart_area.get(0));
-			pscript.set_title(wrapper, ctype, $(this).val());
 		})
 
 	// load up companies
@@ -74,18 +73,13 @@
 	});
 }
 
-pscript.set_title = function(wrapper, ctype, val) {
-}
-
-pscript['onshow_Accounts Browser'] = function(wrapper){
+frappe.pages["Accounts Browser"].on_page_show = function(wrapper){
 	// set route
 	var ctype = frappe.get_route()[1] || 'Account';
 
 	if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
 		wrapper.$company_select.change();
 	}
-
-	pscript.set_title(wrapper, ctype);
 }
 
 erpnext.AccountsChart = Class.extend({
@@ -260,7 +254,7 @@
 		});
 
 		// show
-		d.onshow = function() {
+		d.on_page_show = function() {
 			$(fd.group_or_ledger.input).change();
 			$(fd.account_type.input).change();
 		}
diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.js b/erpnext/accounts/page/financial_analytics/financial_analytics.js
index aa08c92..631af15 100644
--- a/erpnext/accounts/page/financial_analytics/financial_analytics.js
+++ b/erpnext/accounts/page/financial_analytics/financial_analytics.js
@@ -3,7 +3,7 @@
 
 frappe.require("assets/erpnext/js/account_tree_grid.js");
 
-frappe.pages['financial-analytics'].onload = function(wrapper) {
+frappe.pages['financial-analytics'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Financial Analytics'),
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 7dceb64..c3b3c03 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1,4 +1,4 @@
-frappe.pages['pos'].onload = function(wrapper) {
+frappe.pages['pos'].on_page_load = function(wrapper) {
 	var page = frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Start POS'),
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 1651e15..544a17a 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -154,7 +154,7 @@
 	project_name: function(doc, cdt, cdn) {
 		var item = frappe.get_doc(cdt, cdn);
 		if(item.project_name) {
-			$.each(this.frm.doc["items"],
+			$.each(this.frm.doc["items"] || [],
 				function(i, other_item) {
 					if(!other_item.project_name) {
 						other_item.project_name = item.project_name;
@@ -180,7 +180,7 @@
 	calculate_item_values: function() {
 		var me = this;
 
-		$.each(this.frm.doc["items"], function(i, item) {
+		$.each(this.frm.doc["items"] || [], function(i, item) {
 			frappe.model.round_floats_in(item);
 			item.amount = flt(item.rate * item.qty, precision("amount", item));
 			item.item_tax_amount = 0.0;
@@ -196,7 +196,7 @@
 		var me = this;
 
 		this.frm.doc.net_total = this.frm.doc.net_total_import = 0.0;
-		$.each(this.frm.doc["items"], function(i, item) {
+		$.each(this.frm.doc["items"] || [], function(i, item) {
 			me.frm.doc.net_total += item.base_amount;
 			me.frm.doc.net_total_import += item.amount;
 		});
@@ -205,7 +205,7 @@
 	},
 
 	calculate_totals: function() {
-		var tax_count = this.frm.doc["taxes"].length;
+		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0;
 		this.frm.doc.grand_total = flt(tax_count ?
 			this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
 		this.frm.doc.grand_total_import = flt(tax_count ?
@@ -255,7 +255,7 @@
 
 		if(this.frm.doc["items"].length) {
 			if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) {
-				$.each(this.frm.doc["items"], function(i, item) {
+				$.each(this.frm.doc["items"] || [], function(i, item) {
 					delete item["item_tax_amount"];
 				});
 			}
@@ -263,7 +263,7 @@
 
 		if(this.frm.doc["taxes"].length) {
 			if(!frappe.meta.get_docfield(this.frm.doc["taxes"][0].doctype, "tax_amount_after_discount_amount", this.frm.doctype)) {
-				$.each(this.frm.doc["taxes"], function(i, tax) {
+				$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 					delete tax["tax_amount_after_discount_amount"];
 				});
 			}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index b43af26..e103196 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -117,7 +117,7 @@
    "report_hide": 0
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -775,7 +775,7 @@
  "icon": "icon-file-text", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-15 07:34:27.901777", 
+ "modified": "2015-01-30 04:20:42.103367", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 2c7363e..ff40070 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -1,244 +1,244 @@
 {
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "naming_series:",
- "creation": "2013-01-10 16:34:11",
- "description": "Supplier of Goods or Services.",
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Master",
+ "allow_import": 1, 
+ "allow_rename": 1, 
+ "autoname": "naming_series:", 
+ "creation": "2013-01-10 16:34:11", 
+ "description": "Supplier of Goods or Services.", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "Master", 
  "fields": [
   {
-   "fieldname": "basic_info",
-   "fieldtype": "Section Break",
-   "label": "Basic Info",
-   "oldfieldtype": "Section Break",
-   "options": "icon-user",
+   "fieldname": "basic_info", 
+   "fieldtype": "Section Break", 
+   "label": "Basic Info", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-user", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "naming_series",
-   "fieldtype": "Select",
-   "label": "Series",
-   "no_copy": 1,
-   "oldfieldname": "naming_series",
-   "oldfieldtype": "Select",
-   "options": "SUPP-",
+   "fieldname": "naming_series", 
+   "fieldtype": "Select", 
+   "label": "Series", 
+   "no_copy": 1, 
+   "oldfieldname": "naming_series", 
+   "oldfieldtype": "Select", 
+   "options": "SUPP-", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "supplier_name",
-   "fieldtype": "Data",
-   "in_list_view": 0,
-   "label": "Supplier Name",
-   "no_copy": 1,
-   "oldfieldname": "supplier_name",
-   "oldfieldtype": "Data",
-   "permlevel": 0,
+   "fieldname": "supplier_name", 
+   "fieldtype": "Data", 
+   "in_list_view": 0, 
+   "label": "Supplier Name", 
+   "no_copy": 1, 
+   "oldfieldname": "supplier_name", 
+   "oldfieldtype": "Data", 
+   "permlevel": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "fieldname": "column_break0",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
+   "fieldname": "column_break0", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "supplier_type",
-   "fieldtype": "Link",
-   "in_list_view": 1,
-   "label": "Supplier Type",
-   "oldfieldname": "supplier_type",
-   "oldfieldtype": "Link",
-   "options": "Supplier Type",
-   "permlevel": 0,
+   "fieldname": "supplier_type", 
+   "fieldtype": "Link", 
+   "in_list_view": 1, 
+   "label": "Supplier Type", 
+   "oldfieldname": "supplier_type", 
+   "oldfieldtype": "Link", 
+   "options": "Supplier Type", 
+   "permlevel": 0, 
    "reqd": 1
-  },
+  }, 
   {
-   "depends_on": "eval:!doc.__islocal",
-   "fieldname": "address_contacts",
-   "fieldtype": "Section Break",
-   "label": "Address & Contacts",
-   "oldfieldtype": "Column Break",
-   "options": "icon-map-marker",
+   "depends_on": "eval:!doc.__islocal", 
+   "fieldname": "address_contacts", 
+   "fieldtype": "Section Break", 
+   "label": "Address & Contacts", 
+   "oldfieldtype": "Column Break", 
+   "options": "icon-map-marker", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "address_html",
-   "fieldtype": "HTML",
-   "label": "Address HTML",
-   "permlevel": 0,
+   "fieldname": "address_html", 
+   "fieldtype": "HTML", 
+   "label": "Address HTML", 
+   "permlevel": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "column_break1",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
+   "fieldname": "column_break1", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "contact_html",
-   "fieldtype": "HTML",
-   "label": "Contact HTML",
-   "permlevel": 0,
+   "fieldname": "contact_html", 
+   "fieldtype": "HTML", 
+   "label": "Contact HTML", 
+   "permlevel": 0, 
    "read_only": 1
-  },
+  }, 
   {
-   "fieldname": "default_payable_accounts",
-   "fieldtype": "Section Break",
-   "label": "Default Payable Accounts",
+   "fieldname": "default_payable_accounts", 
+   "fieldtype": "Section Break", 
+   "label": "Default Payable Accounts", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "accounts",
-   "fieldtype": "Table",
-   "label": "Accounts",
-   "options": "Party Account",
+   "fieldname": "accounts", 
+   "fieldtype": "Table", 
+   "label": "Accounts", 
+   "options": "Party Account", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "more_info",
-   "fieldtype": "Section Break",
-   "label": "More Info",
-   "oldfieldtype": "Section Break",
-   "options": "icon-file-text",
+   "fieldname": "more_info", 
+   "fieldtype": "Section Break", 
+   "label": "More Info", 
+   "oldfieldtype": "Section Break", 
+   "options": "icon-file-text", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "default_currency",
-   "fieldtype": "Link",
-   "ignore_user_permissions": 1,
-   "label": "Default Currency",
-   "no_copy": 1,
-   "options": "Currency",
+   "fieldname": "default_currency", 
+   "fieldtype": "Link", 
+   "ignore_user_permissions": 1, 
+   "label": "Default Currency", 
+   "no_copy": 1, 
+   "options": "Currency", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "default_price_list",
-   "fieldtype": "Link",
-   "ignore_user_permissions": 1,
-   "label": "Price List",
-   "options": "Price List",
+   "fieldname": "default_price_list", 
+   "fieldtype": "Link", 
+   "ignore_user_permissions": 1, 
+   "label": "Price List", 
+   "options": "Price List", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "default_taxes_and_charges",
-   "fieldtype": "Link",
-   "ignore_user_permissions": 1,
-   "label": "Taxes and Charges",
-   "options": "Purchase Taxes and Charges Master",
+   "fieldname": "default_taxes_and_charges", 
+   "fieldtype": "Link", 
+   "ignore_user_permissions": 1, 
+   "label": "Taxes and Charges", 
+   "options": "Purchase Taxes and Charges Master", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "credit_days",
-   "fieldtype": "Int",
-   "label": "Credit Days",
+   "fieldname": "credit_days", 
+   "fieldtype": "Int", 
+   "label": "Credit Days", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "column_break2",
-   "fieldtype": "Column Break",
-   "permlevel": 0,
+   "fieldname": "column_break2", 
+   "fieldtype": "Column Break", 
+   "permlevel": 0, 
    "width": "50%"
-  },
+  }, 
   {
-   "fieldname": "website",
-   "fieldtype": "Data",
-   "label": "Website",
-   "oldfieldname": "website",
-   "oldfieldtype": "Data",
+   "fieldname": "website", 
+   "fieldtype": "Data", 
+   "label": "Website", 
+   "oldfieldname": "website", 
+   "oldfieldtype": "Data", 
    "permlevel": 0
-  },
+  }, 
   {
-   "description": "Statutory info and other general information about your Supplier",
-   "fieldname": "supplier_details",
-   "fieldtype": "Text",
-   "label": "Supplier Details",
-   "oldfieldname": "supplier_details",
-   "oldfieldtype": "Code",
+   "description": "Statutory info and other general information about your Supplier", 
+   "fieldname": "supplier_details", 
+   "fieldtype": "Text", 
+   "label": "Supplier Details", 
+   "oldfieldname": "supplier_details", 
+   "oldfieldtype": "Code", 
    "permlevel": 0
-  },
+  }, 
   {
-   "fieldname": "communications",
-   "fieldtype": "Table",
-   "hidden": 1,
-   "label": "Communications",
-   "options": "Communication",
-   "permlevel": 0,
+   "fieldname": "communications", 
+   "fieldtype": "Table", 
+   "hidden": 1, 
+   "label": "Communications", 
+   "options": "Communication", 
+   "permlevel": 0, 
    "print_hide": 1
   }
- ],
- "icon": "icon-user",
- "idx": 1,
- "modified": "2015-01-06 17:32:39.936580",
- "modified_by": "Administrator",
- "module": "Buying",
- "name": "Supplier",
- "owner": "Administrator",
+ ], 
+ "icon": "icon-user", 
+ "idx": 1, 
+ "modified": "2015-01-20 17:35:41.423211", 
+ "modified_by": "Administrator", 
+ "module": "Buying", 
+ "name": "Supplier", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
    "role": "Purchase User"
-  },
+  }, 
   {
-   "amend": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Purchase Manager",
-   "submit": 0,
+   "amend": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase Manager", 
+   "submit": 0, 
    "write": 0
-  },
+  }, 
   {
-   "amend": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Purchase Master Manager",
-   "submit": 0,
+   "amend": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Purchase Master Manager", 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "apply_user_permissions": 1,
-   "permlevel": 0,
-   "read": 1,
+   "apply_user_permissions": 1, 
+   "permlevel": 0, 
+   "read": 1, 
    "role": "Material User"
-  },
+  }, 
   {
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
    "role": "Material Manager"
-  },
+  }, 
   {
-   "apply_user_permissions": 1,
-   "permlevel": 0,
-   "read": 1,
+   "apply_user_permissions": 1, 
+   "permlevel": 0, 
+   "read": 1, 
    "role": "Accounts User"
-  },
+  }, 
   {
-   "email": 1,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
+   "email": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
    "role": "Accounts Manager"
   }
- ],
- "search_fields": "supplier_name,supplier_type",
+ ], 
+ "search_fields": "supplier_name, supplier_type", 
  "title_field": "supplier_name"
-}
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index a938481..a6c7ae7 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -117,7 +117,7 @@
    "report_hide": 0
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -575,7 +575,7 @@
  "icon": "icon-shopping-cart", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-15 07:34:12.734538", 
+ "modified": "2015-01-30 04:20:19.719720", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
index dea6a86..5ac7593 100644
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['purchase-analytics'].onload = function(wrapper) {
+frappe.pages['purchase-analytics'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Purchase Analytics'),
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 54f2044..2499a61 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -55,7 +55,8 @@
 		"erpnext.stock.reorder_item.reorder_item",
 		"erpnext.setup.doctype.email_digest.email_digest.send",
 		"erpnext.support.doctype.issue.issue.auto_close_tickets",
-		"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year"
+		"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
+		"erpnext.hr.doctype.employee.employee.send_birthday_reminders"
 	],
 	"daily_long": [
 		"erpnext.setup.doctype.backup_manager.backup_manager.take_backups_daily"
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index b5bb755..042dcd7 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -51,8 +51,6 @@
 			self.update_user()
 			self.update_user_permissions()
 
-		self.update_dob_event()
-
 	def update_user_permissions(self):
 		frappe.permissions.add_user_permission("Employee", self.name, self.user_id)
 		frappe.permissions.set_user_permission_if_allowed("Company", self.company, self.user_id)
@@ -136,8 +134,6 @@
 			throw(_("User {0} is already assigned to Employee {1}").format(self.user_id, employee[0]))
 
 	def validate_employee_leave_approver(self):
-		from erpnext.hr.doctype.leave_application.leave_application import InvalidLeaveApproverError
-
 		for l in self.get("leave_approvers")[:]:
 			if "Leave Approver" not in frappe.get_roles(l.leave_approver):
 				self.get("leave_approvers").remove(l)
@@ -147,39 +143,6 @@
 		if self.reports_to == self.name:
 			throw(_("Employee cannot report to himself."))
 
-	def update_dob_event(self):
-		if self.status == "Active" and self.date_of_birth \
-			and not cint(frappe.db.get_value("HR Settings", None, "stop_birthday_reminders")):
-			birthday_event = frappe.db.sql("""select name from `tabEvent` where repeat_on='Every Year'
-				and ref_type='Employee' and ref_name=%s""", self.name)
-
-			starts_on = self.date_of_birth + " 00:00:00"
-			ends_on = self.date_of_birth + " 00:15:00"
-
-			if birthday_event:
-				event = frappe.get_doc("Event", birthday_event[0][0])
-				event.starts_on = starts_on
-				event.ends_on = ends_on
-				event.save()
-			else:
-				frappe.get_doc({
-					"doctype": "Event",
-					"subject": _("Birthday") + ": " + self.employee_name,
-					"description": _("Happy Birthday!") + " " + self.employee_name,
-					"starts_on": starts_on,
-					"ends_on": ends_on,
-					"event_type": "Public",
-					"all_day": 1,
-					"send_reminder": 1,
-					"repeat_this_event": 1,
-					"repeat_on": "Every Year",
-					"ref_type": "Employee",
-					"ref_name": self.name
-				}).insert()
-		else:
-			frappe.db.sql("""delete from `tabEvent` where repeat_on='Every Year' and
-				ref_type='Employee' and ref_name=%s""", self.name)
-
 	def on_trash(self):
 		delete_events(self.doctype, self.name)
 
@@ -217,3 +180,31 @@
 	if "Employee" in [d.role for d in doc.get("user_roles")]:
 		employee = frappe.get_doc("Employee", {"user_id": doc.name})
 		employee.update_user_permissions()
+
+def send_birthday_reminders():
+	"""Send Employee birthday reminders if no 'Stop Birthday Reminders' is not set."""
+	if int(frappe.db.get_single_value("HR Settings", "stop_birthday_reminders") or 0):
+		return
+
+	from frappe.utils.user import get_enabled_system_users
+	users = None
+
+	birthdays = get_employees_who_are_born_today()
+
+	if birthdays:
+		if not users:
+			users = [u.email_id or u.name for u in get_enabled_system_users()]
+
+		for e in birthdays:
+			frappe.sendmail(recipients=filter(lambda u: u not in (e.company_email, e.personal_email), users),
+				subject=_("Birthday Reminder for {0}").format(e.employee_name),
+				message=_("""Today is {0}'s birthday!""").format(e.employee_name),
+				reply_to=e.company_email or e.personal_email,
+				bulk=True)
+
+def get_employees_who_are_born_today():
+	"""Get Employee properties whose birthday is today."""
+	return frappe.db.sql("""select name, personal_email, company_email, employee_name
+		from tabEmployee where day(date_of_birth) = day(curdate())
+		and month(date_of_birth) = month(curdate())
+		and status = 'Active'""", as_dict=True)
diff --git a/erpnext/hr/doctype/employee/test_employee.py b/erpnext/hr/doctype/employee/test_employee.py
index 699e439..8b2549d 100644
--- a/erpnext/hr/doctype/employee/test_employee.py
+++ b/erpnext/hr/doctype/employee/test_employee.py
@@ -3,4 +3,31 @@
 
 
 import frappe
-test_records = frappe.get_test_records('Employee')
\ No newline at end of file
+import unittest
+import frappe.utils
+
+test_records = frappe.get_test_records('Employee')
+
+class TestEmployee(unittest.TestCase):
+	def test_birthday_reminders(self):
+		employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
+		employee.date_of_birth = "1990" + frappe.utils.nowdate()[4:]
+		employee.company_email = "test@example.com"
+		employee.save()
+
+		from erpnext.hr.doctype.employee.employee import get_employees_who_are_born_today, send_birthday_reminders
+
+		self.assertTrue(employee.name in [e.name for e in get_employees_who_are_born_today()])
+
+		frappe.db.sql("delete from `tabBulk Email`")
+
+		hr_settings = frappe.get_doc("HR Settings", "HR Settings")
+		hr_settings.stop_birthday_reminders = 0
+		hr_settings.save()
+
+		send_birthday_reminders()
+
+		bulk_mails = frappe.db.sql("""select * from `tabBulk Email`""", as_dict=True)
+		self.assertTrue("Subject: Birthday Reminder for {0}".format(employee.employee_name) \
+			in bulk_mails[0].message)
+
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.py b/erpnext/hr/doctype/hr_settings/hr_settings.py
index 5cafbda..89614cb 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.py
@@ -6,30 +6,10 @@
 from __future__ import unicode_literals
 import frappe
 
-from frappe.utils import cint
-
 from frappe.model.document import Document
 
 class HRSettings(Document):
-		
 	def validate(self):
-		self.update_birthday_reminders()
-
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
-		set_by_naming_series("Employee", "employee_number", 
+		set_by_naming_series("Employee", "employee_number",
 			self.get("emp_created_by")=="Naming Series", hide_name_field=True)
-			
-	def update_birthday_reminders(self):
-		original_stop_birthday_reminders = cint(frappe.db.get_value("HR Settings", 
-			None, "stop_birthday_reminders"))
-
-		# reset birthday reminders
-		if cint(self.stop_birthday_reminders) != original_stop_birthday_reminders:
-			frappe.db.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
-		
-			if not self.stop_birthday_reminders:
-				for employee in frappe.db.sql_list("""select name from `tabEmployee` where status='Active' and 
-					ifnull(date_of_birth, '')!=''"""):
-					frappe.get_doc("Employee", employee).update_dob_event()
-					
-			frappe.msgprint(frappe._("Updated Birthday Reminders"))
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.py b/erpnext/hr/doctype/job_applicant/job_applicant.py
index ddbf97f..a0b2388 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.py
@@ -11,3 +11,7 @@
 class JobApplicant(Document):
 	def validate(self):
 		self.set_status()
+
+	def set_sender(self, sender):
+		"""Will be called by **Communication** when a Job Application is created from an incoming email."""
+		self.email_id = sender
diff --git a/erpnext/hr/doctype/salary_manager/salary_manager.js b/erpnext/hr/doctype/salary_manager/salary_manager.js
index 6e20bff..65667c9 100644
--- a/erpnext/hr/doctype/salary_manager/salary_manager.js
+++ b/erpnext/hr/doctype/salary_manager/salary_manager.js
@@ -2,9 +2,9 @@
 // License: GNU General Public License v3. See license.txt
 
 var display_activity_log = function(msg) {
-	if(!pscript.ss_html)
-		pscript.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
-	pscript.ss_html.innerHTML =
+	if(!cur_frm.ss_html)
+		cur_frm.ss_html = $a(cur_frm.fields_dict['activity_log'].wrapper,'div');
+	cur_frm.ss_html.innerHTML =
 		'<div class="panel"><div class="panel-heading">'+__("Activity Log:")+'</div>'+msg+'</div>';
 }
 
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index 19c3fcf..4f78c41 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -9,6 +9,9 @@
 	if (!doc.__islocal && doc.docstatus<2) {
 		cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
 			"icon-money", "btn-default");
+		
+		cur_frm.add_custom_button(__("Update Item Description"), cur_frm.cscript.update_item_desc,
+			"icon-tag", "btn-default");
 	}
 
 	cur_frm.cscript.with_operations(doc);
@@ -25,6 +28,16 @@
 	})
 }
 
+cur_frm.cscript.update_item_desc = function() {
+	return frappe.call({
+		doc: cur_frm.doc,
+		method: "update_item_desc",
+		callback: function(r) {
+			if(!r.exc) cur_frm.refresh_fields();
+		}
+	})
+}
+
 cur_frm.cscript.with_operations = function(doc) {
 	cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations);
 	cur_frm.fields_dict["items"].grid.toggle_reqd("operation", doc.with_operations);
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 636d86b..5c4a841 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -132,6 +132,16 @@
 			self.ignore_validate_update_after_submit = True
 			self.calculate_cost()
 		self.save()
+		
+	def update_item_desc(self):
+		if self.docstatus < 2:
+			self.ignore_validate_update_after_submit = True
+			self.description = frappe.db.get_value("Item", self.item, "description")
+			for d in self.get("items"):
+				d.description = frappe.db.get_value("Item", d.item_code, "description")
+			for d in self.get("exploded_items"):
+				d.description = frappe.db.get_value("Item", d.item_code, "description")
+			self.save()
 
 	def get_bom_unitcost(self, bom_no):
 		bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 9721646..ccbf676 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -104,3 +104,4 @@
 erpnext.patches.v5_0.recalculate_total_amount_in_jv
 erpnext.patches.v5_0.remove_shopping_cart_app
 erpnext.patches.v5_0.update_companywise_payment_account
+erpnext.patches.v5_0.remove_birthday_events
diff --git a/erpnext/patches/v5_0/remove_birthday_events.py b/erpnext/patches/v5_0/remove_birthday_events.py
new file mode 100644
index 0000000..589792a
--- /dev/null
+++ b/erpnext/patches/v5_0/remove_birthday_events.py
@@ -0,0 +1,6 @@
+import frappe
+
+def execute():
+	for e in frappe.db.sql_list("""select name from tabEvent where
+		repeat_on='Every Year' and ref_type='Employee'"""):
+		frappe.delete_doc("Event", e, force=True)
diff --git a/erpnext/projects/doctype/time_log/time_log.json b/erpnext/projects/doctype/time_log/time_log.json
index ebe09cf..0867c5b 100644
--- a/erpnext/projects/doctype/time_log/time_log.json
+++ b/erpnext/projects/doctype/time_log/time_log.json
@@ -76,7 +76,7 @@
    "options": "Activity Type", 
    "permlevel": 0, 
    "read_only": 0, 
-   "reqd": 0
+   "reqd": 1
   }, 
   {
    "depends_on": "eval:doc.time_log_for != 'Manufacturing'", 
@@ -199,7 +199,7 @@
  "icon": "icon-time", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-07 15:11:45.194002", 
+ "modified": "2015-01-29 07:36:29.343589", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Time Log", 
diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js
index 397c36b..b76cfae 100644
--- a/erpnext/public/js/conf.js
+++ b/erpnext/public/js/conf.js
@@ -7,7 +7,7 @@
 $(document).bind('toolbar_setup', function() {
 	frappe.app.name = "ERPNext";
 
-	$('.navbar-brand').html('<i class="octicon octicon-home visible-xs"></i><span class="hidden-xs">ERPNext</span>');
+	$('.navbar-home').html('ERPNext');
 
 	$('[data-link="docs"]').attr("href", "https://erpnext.com/user-guide")
 });
diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js
index d3ff49e..536f956 100644
--- a/erpnext/public/js/feature_setup.js
+++ b/erpnext/public/js/feature_setup.js
@@ -13,7 +13,8 @@
 		}
 	}
 // ====================================================================*/
-pscript.feature_dict = {
+frappe.provide("erpnext.feature_setup");
+erpnext.feature_setup.feature_dict = {
 	'fs_projects': {
 		'BOM': {'fields':['project_name']},
 		'Delivery Note': {'fields':['project_name']},
@@ -183,15 +184,16 @@
 }
 
 $(document).bind('form_refresh', function() {
+	var feature_dict = erpnext.feature_setup.feature_dict;
 	for(var sys_feat in sys_defaults) {
 		if(sys_defaults[sys_feat]=='0'
-			&& (sys_feat in pscript.feature_dict)) { //"Features to hide" exists
-			if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) {
-				for(var fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) {
+			&& (sys_feat in feature_dict)) { //"Features to hide" exists
+			if(cur_frm.doc.doctype in feature_dict[sys_feat]) {
+				for(var fort in feature_dict[sys_feat][cur_frm.doc.doctype]) {
 					if(fort=='fields') {
-						hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
+						hide_field(feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
 					} else if(cur_frm.fields_dict[fort]) {
-						cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);
+						cur_frm.fields_dict[fort].grid.set_column_disp(feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);
 					} else {
 						msgprint(__('Grid "')+fort+__('" does not exists'));
 					}
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index e5fef9c..bf10c15 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -363,7 +363,7 @@
 		if (item) {
 			append_item(item);
 		} else {
-			$.each(this.frm.doc["items"], function(i, d) {
+			$.each(this.frm.doc["items"] || [], function(i, d) {
 				append_item(d);
 			});
 		}
@@ -394,9 +394,13 @@
 
 	apply_price_list: function(item) {
 		var me = this;
+		var args = this._get_args(item);
+		if(!args.item_list.length) {
+			return;
+		}
 		return this.frm.call({
 			method: "erpnext.stock.get_item_details.apply_price_list",
-			args: {	args: this._get_args(item) },
+			args: {	args: args },
 			callback: function(r) {
 				if (!r.exc) {
 					me.in_apply_price_list = true;
@@ -478,7 +482,7 @@
 		var tax_accounts = [];
 		var company_currency = this.get_company_currency();
 
-		$.each(this.frm.doc["taxes"], function(i, tax) {
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 			var tax_amount_precision = precision("tax_amount", tax);
 			var tax_rate_precision = precision("rate", tax);
 			$.each(JSON.parse(tax.item_wise_tax_detail || '{}'),
@@ -507,7 +511,7 @@
 
 		var distinct_item_names = [];
 		var distinct_items = [];
-		$.each(this.frm.doc["items"], function(i, item) {
+		$.each(this.frm.doc["items"] || [], function(i, item) {
 			if(distinct_item_names.indexOf(item.item_code || item.item_name)===-1) {
 				distinct_item_names.push(item.item_code || item.item_name);
 				distinct_items.push(item);
@@ -592,7 +596,7 @@
 	initialize_taxes: function() {
 		var me = this;
 
-		$.each(this.frm.doc["taxes"], function(i, tax) {
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 			tax.item_wise_tax_detail = {};
 			tax_fields = ["total", "tax_amount_after_discount_amount",
 				"tax_amount_for_current_item", "grand_total_for_current_item",
@@ -614,16 +618,16 @@
 		var actual_tax_dict = {};
 
 		// maintain actual tax rate based on idx
-		$.each(this.frm.doc["taxes"], function(i, tax) {
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 			if (tax.charge_type == "Actual") {
 				actual_tax_dict[tax.idx] = flt(tax.rate, precision("tax_amount", tax));
 			}
 		});
 
-		$.each(this.frm.doc["items"], function(n, item) {
+		$.each(this.frm.doc["items"] || [], function(n, item) {
 			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
 
-			$.each(me.frm.doc["taxes"], function(i, tax) {
+			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
 				// tax_amount represents the amount of tax for the current step
 				var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
 
@@ -726,7 +730,7 @@
 	},
 
 	_cleanup: function() {
-		$.each(this.frm.doc["taxes"], function(i, tax) {
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 			$.each(["tax_amount_for_current_item", "grand_total_for_current_item",
 				"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"],
 				function(i, fieldname) { delete tax[fieldname]; });
diff --git a/erpnext/selling/doctype/installation_note/installation_note.json b/erpnext/selling/doctype/installation_note/installation_note.json
index 7251a67..ca48808 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.json
+++ b/erpnext/selling/doctype/installation_note/installation_note.json
@@ -168,7 +168,7 @@
    "reqd": 1
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies.", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -237,7 +237,7 @@
  "icon": "icon-wrench", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-07 10:50:31.542246", 
+ "modified": "2015-01-30 04:22:34.375717", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Installation Note", 
diff --git a/erpnext/selling/doctype/lead/lead.py b/erpnext/selling/doctype/lead/lead.py
index 47d9b02..e0a148e 100644
--- a/erpnext/selling/doctype/lead/lead.py
+++ b/erpnext/selling/doctype/lead/lead.py
@@ -15,6 +15,10 @@
 	def get_feed(self):
 		return '{0}: {1}'.format(_(self.status), self.lead_name)
 
+	def set_sender(self, sender):
+		"""Will be called by **Communication** when a Lead is created from an incoming email."""
+		self.email_id = sender
+
 	def onload(self):
 		customer = frappe.db.get_value("Customer", {"lead_name": self.name})
 		self.get("__onload").is_customer = customer
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 38cce98..bb912a7 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -151,7 +151,7 @@
    "width": "150px"
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies.", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -810,7 +810,7 @@
  "idx": 1, 
  "is_submittable": 1, 
  "max_attachments": 1, 
- "modified": "2015-01-15 07:33:06.919752", 
+ "modified": "2015-01-30 04:19:47.045878", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index e834e00..a142d03 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -125,7 +125,7 @@
    "width": "150px"
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies.", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -1034,7 +1034,7 @@
  "idx": 1, 
  "is_submittable": 1, 
  "issingle": 0, 
- "modified": "2015-01-15 07:51:42.642249", 
+ "modified": "2015-01-30 04:20:02.166745", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Order", 
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
index 9d77516..ad2102a 100644
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/page/sales_analytics/sales_analytics.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['sales-analytics'].onload = function(wrapper) {
+frappe.pages['sales-analytics'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Sales Analytics'),
diff --git a/erpnext/selling/page/sales_browser/sales_browser.js b/erpnext/selling/page/sales_browser/sales_browser.js
index 5ad60f1..2dbe71c 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.js
+++ b/erpnext/selling/page/sales_browser/sales_browser.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-pscript['onload_Sales Browser'] = function(wrapper){
+frappe.pages["Sales Browser"].on_page_load = function(wrapper){
 	var page = frappe.ui.make_app_page({
 		parent: wrapper,
 		single_column: true,
@@ -32,7 +32,7 @@
 	wrapper.make_tree();
 }
 
-pscript['onshow_Sales Browser'] = function(wrapper){
+frappe.pages['Sales Browser'].on_page_show = function(wrapper){
 	// set route
 	var ctype = frappe.get_route()[1] || 'Territory';
 
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.js b/erpnext/selling/page/sales_funnel/sales_funnel.js
index 47b6a14..fbba71e 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.js
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['sales-funnel'].onload = function(wrapper) {
+frappe.pages['sales-funnel'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Sales Funnel'),
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 48c378f..3c04874 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -248,7 +248,7 @@
 		var me = this;
 
 		if (!this.discount_amount_applied) {
-			$.each(this.frm.doc["items"], function(i, item) {
+			$.each(this.frm.doc["items"] || [], function(i, item) {
 				frappe.model.round_floats_in(item);
 				item.amount = flt(item.rate * item.qty, precision("amount", item));
 
@@ -261,11 +261,11 @@
 
 	determine_exclusive_rate: function() {
 		var me = this;
-		$.each(me.frm.doc["items"], function(n, item) {
+		$.each(me.frm.doc["items"] || [], function(n, item) {
 			var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
 			var cumulated_tax_fraction = 0.0;
 
-			$.each(me.frm.doc["taxes"], function(i, tax) {
+			$.each(me.frm.doc["taxes"] || [], function(i, tax) {
 				tax.tax_fraction_for_current_item = me.get_current_tax_fraction(tax, item_tax_map);
 
 				if(i==0) {
@@ -325,7 +325,7 @@
 		var me = this;
 		this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0;
 
-		$.each(this.frm.doc["items"], function(i, item) {
+		$.each(this.frm.doc["items"] || [], function(i, item) {
 			me.frm.doc.net_total += item.base_amount;
 			me.frm.doc.net_total_export += item.amount;
 		});
@@ -335,7 +335,7 @@
 
 	calculate_totals: function() {
 		var me = this;
-		var tax_count = this.frm.doc["taxes"].length;
+		var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length: 0;
 
 		this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total);
 		this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
@@ -364,7 +364,7 @@
 			var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount();
 			// calculate item amount after Discount Amount
 			if (grand_total_for_discount_amount) {
-				$.each(this.frm.doc["items"], function(i, item) {
+				$.each(this.frm.doc["items"] || [], function(i, item) {
 					distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount;
 					item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item));
 				});
@@ -382,7 +382,7 @@
 		var total_actual_tax = 0.0;
 		var actual_taxes_dict = {};
 
-		$.each(this.frm.doc["taxes"], function(i, tax) {
+		$.each(this.frm.doc["taxes"] || [], function(i, tax) {
 			if (tax.charge_type == "Actual")
 				actual_taxes_dict[tax.idx] = tax.tax_amount;
 			else if (actual_taxes_dict[tax.row_id] !== null) {
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.json b/erpnext/setup/doctype/sales_partner/sales_partner.json
index 52a44c5..ae9a492 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.json
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.json
@@ -118,7 +118,7 @@
    "reqd": 0
   }, 
   {
-   "description": "Select Budget Distribution to unevenly distribute targets across months.", 
+   "description": "Select Monthly Distribution to unevenly distribute targets across months.", 
    "fieldname": "distribution_id", 
    "fieldtype": "Link", 
    "label": "Target Distribution", 
diff --git a/erpnext/setup/doctype/sales_person/sales_person.json b/erpnext/setup/doctype/sales_person/sales_person.json
index 04791fe..2911f08 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.json
+++ b/erpnext/setup/doctype/sales_person/sales_person.json
@@ -120,7 +120,7 @@
    "permlevel": 0
   }, 
   {
-   "description": "Select Budget Distribution to unevenly distribute targets across months.", 
+   "description": "Select Monthly Distribution to unevenly distribute targets across months.", 
    "fieldname": "distribution_id", 
    "fieldtype": "Link", 
    "label": "Target Distribution", 
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index ce7b572..a4a1f6a 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -11,7 +11,7 @@
 	nsm_parent_field = 'parent_sales_person';
 
 	def validate(self):
-		for d in self.get('targets'):
+		for d in self.get('targets') or []:
 			if not flt(d.target_qty) and not flt(d.target_amount):
 				frappe.throw(_("Either target qty or target amount is mandatory."))
 
diff --git a/erpnext/setup/doctype/territory/territory.json b/erpnext/setup/doctype/territory/territory.json
index e74582c..3ecfd98 100644
--- a/erpnext/setup/doctype/territory/territory.json
+++ b/erpnext/setup/doctype/territory/territory.json
@@ -123,7 +123,7 @@
    "permlevel": 0
   }, 
   {
-   "description": "Select Budget Distribution to unevenly distribute targets across months.", 
+   "description": "Select Monthly Distribution to unevenly distribute targets across months.", 
    "fieldname": "distribution_id", 
    "fieldtype": "Link", 
    "label": "Target Distribution", 
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 8eb4dce..e4fe9c5 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -14,7 +14,7 @@
 	nsm_parent_field = 'parent_territory'
 
 	def validate(self):
-		for d in self.get('targets'):
+		for d in self.get('targets') or []:
 			if not flt(d.target_qty) and not flt(d.target_amount):
 				frappe.throw(_("Either target qty or target amount is mandatory"))
 
diff --git a/erpnext/setup/page/setup_wizard/install_fixtures.py b/erpnext/setup/page/setup_wizard/install_fixtures.py
index 4bdf15e..5312192 100644
--- a/erpnext/setup/page/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/page/setup_wizard/install_fixtures.py
@@ -187,7 +187,11 @@
 		{'doctype': 'Industry Type', 'industry': _('Telecommunications')},
 		{'doctype': 'Industry Type', 'industry': _('Television')},
 		{'doctype': 'Industry Type', 'industry': _('Transportation')},
-		{'doctype': 'Industry Type', 'industry': _('Venture Capital')}
+		{'doctype': 'Industry Type', 'industry': _('Venture Capital')},
+
+		{'doctype': "Email Account", "email_id": "sales@example.com", "append_to": "Lead"},
+		{'doctype': "Email Account", "email_id": "support@example.com", "append_to": "Issue"},
+		{'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"}
 	]
 
 	from frappe.modules import scrub
diff --git a/erpnext/setup/page/setup_wizard/setup_wizard.js b/erpnext/setup/page/setup_wizard/setup_wizard.js
index 2ba6dd4..c31fab4 100644
--- a/erpnext/setup/page/setup_wizard/setup_wizard.js
+++ b/erpnext/setup/page/setup_wizard/setup_wizard.js
@@ -1,4 +1,4 @@
-frappe.pages['setup-wizard'].onload = function(wrapper) {
+frappe.pages['setup-wizard'].on_page_load = function(wrapper) {
 	if(sys_defaults.company) {
 		frappe.set_route("desktop");
 		return;
@@ -356,7 +356,7 @@
 	erpnext.wiz = new frappe.wiz.Wizard(wizard_settings)
 }
 
-frappe.pages['setup-wizard'].onshow = function(wrapper) {
+frappe.pages['setup-wizard'].on_page_show = function(wrapper) {
 	if(frappe.get_route()[1])
 		erpnext.wiz.show(frappe.get_route()[1]);
 }
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 8d00f94..9fa0b7d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -142,7 +142,7 @@
    "width": "150px"
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -1024,7 +1024,7 @@
  "idx": 1, 
  "in_create": 0, 
  "is_submittable": 1, 
- "modified": "2015-01-15 07:33:24.245923", 
+ "modified": "2015-01-30 04:21:39.709704", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note", 
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index e12c764..ec444a9 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -687,20 +687,7 @@
    "read_only": 0
   }, 
   {
-   "default": "No", 
-   "description": "Selecting \"Yes\" will allow you to create Bill of Material showing raw material and operational costs incurred to manufacture this item.", 
-   "fieldname": "is_manufactured_item", 
-   "fieldtype": "Select", 
-   "label": "Allow Bill of Materials", 
-   "oldfieldname": "is_manufactured_item", 
-   "oldfieldtype": "Select", 
-   "options": "Yes\nNo", 
-   "permlevel": 0, 
-   "read_only": 0, 
-   "reqd": 1
-  }, 
-  {
-   "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", 
+   "depends_on": "", 
    "fieldname": "default_bom", 
    "fieldtype": "Link", 
    "ignore_user_permissions": 1, 
@@ -714,7 +701,7 @@
   }, 
   {
    "default": "No", 
-   "depends_on": "eval:doc.is_manufactured_item==\"Yes\"", 
+   "depends_on": "", 
    "description": "Selecting \"Yes\" will allow you to make a Production Order for this item.", 
    "fieldname": "is_pro_applicable", 
    "fieldtype": "Select", 
@@ -877,7 +864,7 @@
  "icon": "icon-tag", 
  "idx": 1, 
  "max_attachments": 1, 
- "modified": "2015-01-08 14:59:49.747106", 
+ "modified": "2015-01-19 16:17:59.756852", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 8c74f09..d77cd1d 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -390,7 +390,7 @@
 			if not frappe.db.exists("Item", newdn):
 				frappe.throw(_("Item {0} does not exist").format(newdn))
 
-			field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no", "is_manufactured_item"]
+			field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
 			new_properties = [cstr(d) for d in frappe.db.get_value("Item", newdn, field_list)]
 			if new_properties != [cstr(self.get(fld)) for fld in field_list]:
 				frappe.throw(_("To merge, following properties must be same for both items")
diff --git a/erpnext/stock/doctype/item/test_records.json b/erpnext/stock/doctype/item/test_records.json
index 7d0f4b0..51dd9fb 100644
--- a/erpnext/stock/doctype/item/test_records.json
+++ b/erpnext/stock/doctype/item/test_records.json
@@ -64,7 +64,6 @@
   "income_account": "Sales - _TC",
   "inspection_required": "No",
   "is_asset_item": "No",
-  "is_manufactured_item": "No",
   "is_pro_applicable": "No",
   "is_purchase_item": "Yes",
   "is_sales_item": "Yes",
@@ -94,7 +93,6 @@
   "income_account": "Sales - _TC",
   "inspection_required": "No",
   "is_asset_item": "No",
-  "is_manufactured_item": "No",
   "is_pro_applicable": "No",
   "is_purchase_item": "Yes",
   "is_sales_item": "Yes",
@@ -214,9 +212,7 @@
   "income_account": "Sales - _TC",
   "inspection_required": "No",
   "is_asset_item": "No",
-  "is_manufactured_item": "Yes",
   "is_pro_applicable": "Yes",
-  "is_purchase_item": "Yes",
   "is_sales_item": "Yes",
   "is_service_item": "No",
   "is_stock_item": "Yes",
@@ -242,7 +238,6 @@
   "is_service_item": "No",
   "is_stock_item": "Yes",
   "is_sub_contracted_item": "Yes",
-  "is_manufactured_item": "Yes",
   "item_code": "_Test FG Item 2",
   "item_group": "_Test Item Group Desktops",
   "item_name": "_Test FG Item 2",
@@ -263,7 +258,6 @@
   "is_sales_item": "Yes",
   "is_service_item": "No",
   "is_stock_item": "Yes",
-  "is_manufactured_item": "Yes",
   "is_sub_contracted_item": "Yes",
   "item_code": "_Test Variant Item",
   "item_group": "_Test Item Group Desktops",
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
index e29dde0..6cc68e7 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js
@@ -73,7 +73,7 @@
 
 	set_total_taxes_and_charges: function() {
 		total_taxes_and_charges = 0.0;
-		$.each(this.frm.doc.taxes, function(i, d) {
+		$.each(this.frm.doc.taxes || [], function(i, d) {
 			total_taxes_and_charges += flt(d.amount)
 		});
 		cur_frm.set_value("total_taxes_and_charges", total_taxes_and_charges);
@@ -83,11 +83,11 @@
 		var me = this;
 		if(this.frm.doc.taxes.length) {
 			var total_item_cost = 0.0;
-			$.each(this.frm.doc.items, function(i, d) {
+			$.each(this.frm.doc.items || [], function(i, d) {
 				total_item_cost += flt(d.amount)
 			});
 
-			$.each(this.frm.doc.items, function(i, item) {
+			$.each(this.frm.doc.items || [], function(i, item) {
 				item.applicable_charges = flt(item.amount) *  flt(me.frm.doc.total_taxes_and_charges) / flt(total_item_cost)
 			});
 			refresh_field("items");
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index bd7dab6..4a14380 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -54,7 +54,7 @@
    "width": "150px"
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "in_filter": 1, 
@@ -236,7 +236,7 @@
  "icon": "icon-ticket", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-06 17:38:12.250644", 
+ "modified": "2015-01-30 04:21:23.753767", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Material Request", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 9a84d3d..119c770 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -596,7 +596,7 @@
    "report_hide": 1
   }, 
   {
-   "description": "Select the relevant company name if you have multiple companies", 
+   "description": "", 
    "fieldname": "company", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -767,7 +767,7 @@
  "icon": "icon-truck", 
  "idx": 1, 
  "is_submittable": 1, 
- "modified": "2015-01-15 07:34:39.475183", 
+ "modified": "2015-01-30 04:22:04.356498", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
diff --git a/erpnext/stock/page/stock_analytics/stock_analytics.js b/erpnext/stock/page/stock_analytics/stock_analytics.js
index 8fd2d32..346750b 100644
--- a/erpnext/stock/page/stock_analytics/stock_analytics.js
+++ b/erpnext/stock/page/stock_analytics/stock_analytics.js
@@ -2,7 +2,7 @@
 // License: GNU General Public License v3. See license.txt
 
 
-frappe.pages['stock-analytics'].onload = function(wrapper) { 
+frappe.pages['stock-analytics'].on_page_load = function(wrapper) { 
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Stock Analytics'),
diff --git a/erpnext/stock/page/stock_ledger/stock_ledger.js b/erpnext/stock/page/stock_ledger/stock_ledger.js
index d9e89b2..3f6a9e3 100644
--- a/erpnext/stock/page/stock_ledger/stock_ledger.js
+++ b/erpnext/stock/page/stock_ledger/stock_ledger.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['stock-ledger'].onload = function(wrapper) {
+frappe.pages['stock-ledger'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Stock Ledger'),
diff --git a/erpnext/stock/page/stock_level/stock_level.js b/erpnext/stock/page/stock_level/stock_level.js
index 21d4220..be4ebd0 100644
--- a/erpnext/stock/page/stock_level/stock_level.js
+++ b/erpnext/stock/page/stock_level/stock_level.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['stock-level'].onload = function(wrapper) {
+frappe.pages['stock-level'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Stock Level'),
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index 2000ea0..e322c9c 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -15,6 +15,10 @@
 	def get_portal_page(self):
 		return "ticket"
 
+	def set_sender(self, sender):
+		"""Will be called by **Communication** when the Issue is created from an incoming email."""
+		self.raised_by = sender
+
 	def validate(self):
 		self.update_status()
 		self.set_lead_contact(self.raised_by)
diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js
index 835e681..8e0b10a 100644
--- a/erpnext/support/page/support_analytics/support_analytics.js
+++ b/erpnext/support/page/support_analytics/support_analytics.js
@@ -1,7 +1,7 @@
 // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 // License: GNU General Public License v3. See license.txt
 
-frappe.pages['support-analytics'].onload = function(wrapper) {
+frappe.pages['support-analytics'].on_page_load = function(wrapper) {
 	frappe.ui.make_app_page({
 		parent: wrapper,
 		title: __('Support Analytics'),
diff --git a/erpnext/templates/generators/item_group.html b/erpnext/templates/generators/item_group.html
index c52629f..8597864 100644
--- a/erpnext/templates/generators/item_group.html
+++ b/erpnext/templates/generators/item_group.html
@@ -17,7 +17,7 @@
 			{% endfor %}
 		</div>
 			{% if (items|length)==100 %}
-				<div class="alert alert-info info">Showing top 100 items.</div>
+				<div class="text-muted info">Showing top 100 items.</div>
 			{% endif %}
 		{% else %}
 			<div class="text-muted">No items listed.</div>