Merge pull request #5395 from saurabh6790/payment_request_ux

[enhance] ux fixes for payment request, added jinja for payment reque…
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index a62f0b3..f801959 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.27.19'
+__version__ = '6.27.21'
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index e2e21fa..5c82142 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -6,7 +6,7 @@
 from frappe.utils import cstr
 from unidecode import unidecode
 
-def create_charts(chart_name, company, ignore_permissions=False):
+def create_charts(chart_name, company):
 	chart = get_chart(chart_name)
 	
 	if chart:
@@ -44,7 +44,7 @@
 					if root_account or frappe.local.flags.allow_unverified_charts:
 						account.flags.ignore_mandatory = True
 						
-					account.flags.ignore_permissions = ignore_permissions
+					account.flags.ignore_permissions = True
 					
 					account.insert()
 
diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js
index 0479a4e..e6d8b3b 100644
--- a/erpnext/accounts/doctype/asset/asset.js
+++ b/erpnext/accounts/doctype/asset/asset.js
@@ -90,12 +90,25 @@
 			last_depreciation_date = frm.doc.disposal_date;
 		}
 		
-		frm.dashboard.reset();
-		frm.dashboard.add_graph({
-			x: 'x',
-			columns: [x_intervals, asset_values],
-			regions: {
-				'Asset Value': [{'start': last_depreciation_date, 'style':'dashed'}]
+		frm.dashboard.setup_chart({
+			data: {
+				x: 'x',
+				columns: [x_intervals, asset_values],
+				regions: {
+					'Asset Value': [{'start': last_depreciation_date, 'style':'dashed'}]
+				}
+			},
+			legend: {
+				show: false
+			},
+			axis: {
+				x: {
+					type: 'category'
+				},
+				y: {
+					min: 0,
+					padding: {bottom: 10}
+				}
 			}
 		});		
 	},
diff --git a/erpnext/accounts/doctype/asset/asset.json b/erpnext/accounts/doctype/asset/asset.json
index c272a58..fa53aed 100644
--- a/erpnext/accounts/doctype/asset/asset.json
+++ b/erpnext/accounts/doctype/asset/asset.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:asset_name", 
+ "beta": 0, 
  "creation": "2016-03-01 17:01:27.920130", 
  "custom": 0, 
  "docstatus": 0, 
@@ -738,7 +739,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-22 11:15:40.055518", 
+ "modified": "2016-05-30 18:09:56.158782", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Asset", 
diff --git a/erpnext/accounts/doctype/budget_account/budget_account.json b/erpnext/accounts/doctype/budget_account/budget_account.json
index 43dbbd9..e27af68 100644
--- a/erpnext/accounts/doctype/budget_account/budget_account.json
+++ b/erpnext/accounts/doctype/budget_account/budget_account.json
@@ -39,30 +39,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "budget_amount", 
    "fieldtype": "Currency", 
    "hidden": 0, 
@@ -94,7 +70,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-05-16 11:55:29.586591", 
+ "modified": "2016-05-30 17:57:03.483750", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Budget Account", 
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 2fd838b..2ff98da 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -12,7 +12,9 @@
 class FiscalYear(Document):
 	def set_as_default(self):
 		frappe.db.set_value("Global Defaults", None, "current_fiscal_year", self.name)
-		frappe.get_doc("Global Defaults").on_update()
+		global_defaults = frappe.get_doc("Global Defaults")
+		global_defaults.check_permission("write")
+		global_defaults.on_update()
 
 		# clear cache
 		frappe.clear_cache()
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json
index b7b698c..71008a6 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.json
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json
@@ -3,6 +3,7 @@
  "allow_import": 0, 
  "allow_rename": 0, 
  "autoname": "GL.#######", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:06", 
  "custom": 0, 
  "docstatus": 0, 
@@ -16,6 +17,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Posting Date", 
@@ -25,6 +27,7 @@
    "oldfieldtype": "Date", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -40,6 +43,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Transaction Date", 
@@ -49,6 +53,7 @@
    "oldfieldtype": "Date", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -64,6 +69,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Account", 
@@ -74,6 +80,7 @@
    "options": "Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -89,6 +96,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party Type", 
@@ -97,6 +105,7 @@
    "options": "DocType", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -112,6 +121,7 @@
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Party", 
@@ -120,6 +130,7 @@
    "options": "party_type", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -135,6 +146,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Cost Center", 
@@ -145,6 +157,7 @@
    "options": "Cost Center", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -160,6 +173,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit Amount", 
@@ -171,6 +185,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -186,6 +201,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Amount", 
@@ -197,6 +213,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -212,6 +229,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Account Currency", 
@@ -221,6 +239,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -236,6 +255,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Debit Amount in Account Currency", 
@@ -245,6 +265,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -260,6 +281,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Credit Amount in Account Currency", 
@@ -269,6 +291,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -284,6 +307,7 @@
    "fieldtype": "Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against", 
@@ -293,6 +317,7 @@
    "oldfieldtype": "Text", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -308,6 +333,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Against Voucher Type", 
@@ -318,6 +344,7 @@
    "options": "DocType", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -333,6 +360,7 @@
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Against Voucher", 
@@ -343,6 +371,7 @@
    "options": "against_voucher_type", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -358,6 +387,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher Type", 
@@ -368,6 +398,7 @@
    "options": "DocType", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -383,6 +414,7 @@
    "fieldtype": "Dynamic Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Voucher No", 
@@ -393,6 +425,7 @@
    "options": "voucher_type", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -404,10 +437,37 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "remarks", 
    "fieldtype": "Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Remarks", 
@@ -417,6 +477,7 @@
    "oldfieldtype": "Text", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -432,6 +493,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Is Opening", 
@@ -442,6 +504,7 @@
    "options": "No\nYes", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -457,6 +520,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Advance", 
@@ -467,6 +531,7 @@
    "options": "No\nYes", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -482,6 +547,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Fiscal Year", 
@@ -492,6 +558,7 @@
    "options": "Fiscal Year", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -507,6 +574,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 0, 
    "label": "Company", 
@@ -517,6 +585,7 @@
    "options": "Company", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -535,7 +604,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:47.382225", 
+ "modified": "2016-05-26 16:22:03.094536", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "GL Entry", 
@@ -602,9 +671,11 @@
    "write": 0
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "search_fields": "voucher_no,account,posting_date,against_voucher", 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index dd8d51e..1f95fb8 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -54,9 +54,13 @@
 	def pl_must_have_cost_center(self):
 		if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
 			if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
-				frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}").format(self.account))
-		elif self.cost_center:
-			self.cost_center = None
+				frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}")
+					.format(self.account))
+		else:
+			if self.cost_center:
+				self.cost_center = None
+			if self.project:
+				self.project = None
 
 	def check_pl_account(self):
 		if self.is_opening=='Yes' and \
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 5f9a915..40386e0 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -404,7 +404,8 @@
 						"against_voucher_type": d.reference_type,
 						"against_voucher": d.reference_name,
 						"remarks": self.remark,
-						"cost_center": d.cost_center
+						"cost_center": d.cost_center,
+						"project": d.project
 					})
 				)
 
@@ -727,8 +728,9 @@
 			amount_field: abs(against_jv_amount)
 		}
 	elif args.get("doctype") in ("Sales Invoice", "Purchase Invoice"):
+		party_type = "Customer" if args.get("doctype") == "Sales Invoice" else "Supplier"
 		invoice = frappe.db.get_value(args["doctype"], args["docname"],
-			["outstanding_amount", "conversion_rate"], as_dict=1)
+			["outstanding_amount", "conversion_rate", scrub(party_type)], as_dict=1)
 
 		exchange_rate = invoice.conversion_rate if (args.get("account_currency") != company_currency) else 1
 
@@ -741,7 +743,9 @@
 
 		return {
 			amount_field: abs(flt(invoice.outstanding_amount)),
-			"exchange_rate": exchange_rate
+			"exchange_rate": exchange_rate,
+			"party_type": party_type,
+			"party": invoice.get(scrub(party_type))
 		}
 
 @frappe.whitelist()
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index 28b57bd..dcc32a5 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -3,6 +3,7 @@
  "allow_import": 0, 
  "allow_rename": 0, 
  "autoname": "hash", 
+ "beta": 0, 
  "creation": "2013-02-22 01:27:39", 
  "custom": 0, 
  "docstatus": 0, 
@@ -556,6 +557,32 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "project", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Project", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Project", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "col_break3", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -638,13 +665,15 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-03-07 19:10:27.135795", 
+ "modified": "2016-05-26 16:23:31.354886", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Journal Entry Account", 
  "owner": "Administrator", 
  "permissions": [], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index 8de8e35..99438a6 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -24,18 +24,6 @@
 	});
 });
 
-//cash bank account
-//------------------------------------
-cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
-	return{
-		filters:{
-			'report_type': "Balance Sheet",
-			'is_group': 0,
-			'company': doc.company
-		}
-	}
-}
-
 // Income Account
 // --------------------------------
 cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index 8f25ba9..b1420fc 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -743,33 +743,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "cash_bank_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Cash/Bank Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "cash_bank_account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "income_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -857,7 +830,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-05-09 00:00:30.610878", 
+ "modified": "2016-05-25 15:00:09.335025", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index 634d63c..5f4d5bc 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -27,7 +27,7 @@
 					self.company), raise_exception=1)
 
 	def validate_all_link_fields(self):
-		accounts = {"Account": [self.cash_bank_account, self.income_account,
+		accounts = {"Account": [self.income_account,
 			self.expense_account], "Cost Center": [self.cost_center],
 			"Warehouse": [self.warehouse]}
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index b31c1ab..71e9c42 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -408,7 +408,8 @@
 							"against": self.supplier,
 							"debit": warehouse_debit_amount,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-							"cost_center": item.cost_center
+							"cost_center": item.cost_center,
+							"project": item.project
 						}, account_currency)
 					)
 					
@@ -419,7 +420,8 @@
 							"against": item.expense_account,
 							"cost_center": item.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-							"credit": flt(item.landed_cost_voucher_amount)
+							"credit": flt(item.landed_cost_voucher_amount),
+							"project": item.project
 						}))
 
 					# sub-contracting warehouse
@@ -441,7 +443,8 @@
 							"debit_in_account_currency": (flt(item.base_net_amount, 
 								item.precision("base_net_amount")) if account_currency==self.company_currency 
 								else flt(item.net_amount, item.precision("net_amount"))),
-							"cost_center": item.cost_center
+							"cost_center": item.cost_center,
+							"project": item.project
 						}, account_currency)
 					)
 				
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 4ec2524..2fbf4b6 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -7,6 +7,7 @@
 from frappe.utils import nowdate
 from erpnext.setup.utils import get_exchange_rate
 from erpnext.stock.get_item_details import get_pos_profile
+from erpnext.accounts.party import get_party_account_currency
 from erpnext.controllers.accounts_controller import get_taxes_and_charges
 
 @frappe.whitelist()
@@ -28,7 +29,7 @@
 	return {
 		'doc': doc,
 		'items': get_items(doc, pos_profile),
-		'customers': get_customers(pos_profile),
+		'customers': get_customers(pos_profile, doc),
 		'pricing_rules': get_pricing_rules(doc),
 		'mode_of_payment': get_mode_of_payment(doc),
 		'print_template': print_template,
@@ -68,6 +69,12 @@
 	from frappe.model import default_fields
 
 	if not pos_profile:
+		for payment in frappe.get_all('Mode of Payment Account', fields=["default_account", "parent"], 
+							filters = {'company': doc.company}):
+			payments = doc.append('payments', {})
+			payments.mode_of_payment = payment.parent
+			payments.account = payment.default_account
+
 		return
 
 	for payment_mode in pos_profile.payments:
@@ -106,12 +113,19 @@
 
 	return item_list
 
-def get_customers(pos_profile):
+def get_customers(pos_profile, doc):
 	filters = {'disabled': 0}
+	customer_list = []
 	if pos_profile.get('customer'):
 		filters.update({'name': pos_profile.customer})
 
-	return frappe.get_all("Customer", fields=["*"], filters = filters)
+	customers = frappe.get_all("Customer", fields=["*"], filters = filters)
+
+	for customer in customers:
+		customer_currency = get_party_account_currency('Customer', customer.name, doc.company) or doc.currency
+		if customer_currency == doc.currency:
+			customer_list.append(customer)
+	return customer_list
 
 def get_pricing_rules(doc):
 	if doc.ignore_pricing_rule == 0:
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 45c918c..cc6d1e6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -51,7 +51,7 @@
 					this.make_sales_return, __("Make"));
 				cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 			}
-			
+
 			if(cint(doc.update_stock)!=1) {
 				// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
 				var from_delivery_note = false;
@@ -61,7 +61,7 @@
 					});
 
 				if(!from_delivery_note && !is_delivered_by_supplier) {
-					cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'], 
+					cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'],
 						__("Make"));
 				}
 			}
@@ -221,7 +221,7 @@
 			frm: cur_frm
 		})
 	},
-	
+
 	asset: function(frm, cdt, cdn) {
 		var row = locals[cdt][cdn];
 		if(row.asset) {
@@ -390,7 +390,7 @@
 	if(cur_frm.doc.is_pos) {
 		cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
 			onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
-			<a class="btn btn-default" href="javascript:new_doc(cur_frm.doctype);">{1}</a>', [
+			<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">{1}</a>', [
 			__('Print'), __('New')
 		]));
 
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index abc4083..cc3d952 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -525,7 +525,6 @@
 
 	def make_pos_profile(self):
 		pos_profile = frappe.get_doc({
-			"cash_bank_account": "_Test Bank - _TC",
 			"company": "_Test Company",
 			"cost_center": "_Test Cost Center - _TC",
 			"currency": "INR",
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.json b/erpnext/accounts/doctype/tax_rule/tax_rule.json
index 38e6805..26e379b 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.json
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "TR.####", 
+ "beta": 0, 
  "creation": "2015-08-07 02:33:52.670866", 
  "custom": 0, 
  "docstatus": 0, 
@@ -18,6 +19,7 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Tax Type", 
@@ -27,6 +29,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -42,6 +45,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Use for Shopping Cart", 
@@ -50,6 +54,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -65,6 +70,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -72,6 +78,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -88,6 +95,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Tax Template", 
@@ -97,6 +105,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -113,6 +122,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Tax Template", 
@@ -122,6 +132,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -137,6 +148,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Filters", 
@@ -145,6 +157,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -161,6 +174,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer", 
@@ -170,6 +184,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -186,6 +201,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier", 
@@ -195,6 +211,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -210,6 +227,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing City", 
@@ -218,6 +236,32 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "billing_county", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Billing County", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -233,6 +277,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing State", 
@@ -241,6 +286,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -256,6 +302,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Billing Country", 
@@ -265,6 +312,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -280,6 +328,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -287,6 +336,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -303,6 +353,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customer Group", 
@@ -312,6 +363,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -328,6 +380,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Supplier Type", 
@@ -337,6 +390,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -352,6 +406,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping City", 
@@ -360,6 +415,32 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "shipping_county", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Shipping County", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -375,6 +456,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping State", 
@@ -383,6 +465,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -398,6 +481,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Shipping Country", 
@@ -407,6 +491,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -422,6 +507,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Validity", 
@@ -430,6 +516,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -445,6 +532,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "From Date", 
@@ -453,6 +541,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -468,6 +557,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -475,6 +565,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -490,6 +581,7 @@
    "fieldtype": "Date", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Date", 
@@ -498,6 +590,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -513,6 +606,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -520,6 +614,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -536,6 +631,7 @@
    "fieldtype": "Int", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Priority", 
@@ -544,6 +640,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -559,6 +656,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -566,6 +664,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -581,6 +680,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Company", 
@@ -590,6 +690,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -600,13 +701,14 @@
  ], 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
+ "idx": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:59.201327", 
+ "modified": "2016-05-30 15:53:16.630072", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Tax Rule", 
@@ -634,8 +736,10 @@
    "write": 1
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
- "sort_order": "DESC"
+ "sort_order": "DESC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index be6f4a4..7ec833e 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -49,9 +49,11 @@
 			"supplier":			self.supplier,
 			"supplier_type":	self.supplier_type,
 			"billing_city":		self.billing_city,
+			"billing_county":	self.billing_county,
 			"billing_state": 	self.billing_state,
 			"billing_country":	self.billing_country,
 			"shipping_city":	self.shipping_city,
+			"shipping_county":	self.shipping_county,
 			"shipping_state":	self.shipping_state,
 			"shipping_country":	self.shipping_country,
 			"company":			self.company
@@ -101,16 +103,18 @@
 		billing_filters=	{party_type: party, "is_primary_address": 1}
 		shipping_filters=	{party_type:party, "is_shipping_address": 1}
 
-	billing_address=	frappe.get_all("Address", fields=["city", "state", "country"], filters= billing_filters)
-	shipping_address=	frappe.get_all("Address", fields=["city", "state", "country"], filters= shipping_filters)
+	billing_address=	frappe.get_all("Address", fields=["city", "county", "state", "country"], filters= billing_filters)
+	shipping_address=	frappe.get_all("Address", fields=["city", "county", "state", "country"], filters= shipping_filters)
 
 	if billing_address:
 		out["billing_city"]= billing_address[0].city
+		out["billing_county"]= billing_address[0].county
 		out["billing_state"]= billing_address[0].state
 		out["billing_country"]= billing_address[0].country
 
 	if shipping_address:
 		out["shipping_city"]= shipping_address[0].city
+		out["shipping_county"]= shipping_address[0].county
 		out["shipping_state"]= shipping_address[0].state
 		out["shipping_country"]= shipping_address[0].country
 
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index bdee391..be9a884 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -74,7 +74,8 @@
 			and cstr(e.get('party'))==cstr(gle.get('party')) \
 			and cstr(e.get('against_voucher'))==cstr(gle.get('against_voucher')) \
 			and cstr(e.get('against_voucher_type')) == cstr(gle.get('against_voucher_type')) \
-			and cstr(e.get('cost_center')) == cstr(gle.get('cost_center')):
+			and cstr(e.get('cost_center')) == cstr(gle.get('cost_center')) \
+			and cstr(e.get('project')) == cstr(gle.get('project')):
 				return e
 
 def save_entries(gl_map, adv_adj, update_outstanding):
diff --git a/erpnext/accounts/page/financial_analytics/README.md b/erpnext/accounts/page/financial_analytics/README.md
deleted file mode 100644
index ccb56bb..0000000
--- a/erpnext/accounts/page/financial_analytics/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Trends (multi-year) for account balances including.
\ No newline at end of file
diff --git a/erpnext/accounts/page/financial_analytics/__init__.py b/erpnext/accounts/page/financial_analytics/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/accounts/page/financial_analytics/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.js b/erpnext/accounts/page/financial_analytics/financial_analytics.js
deleted file mode 100644
index c892738..0000000
--- a/erpnext/accounts/page/financial_analytics/financial_analytics.js
+++ /dev/null
@@ -1,332 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.pages['financial-analytics'].on_page_load = function(wrapper) {
-	frappe.ui.make_app_page({
-		parent: wrapper,
-		title: __('Financial Analytics'),
-		single_column: true
-	});
-	erpnext.financial_analytics = new erpnext.FinancialAnalytics(wrapper, 'Financial Analytics');
-	frappe.breadcrumbs.add("Accounts");
-
-};
-
-{% include "erpnext/public/js/account_tree_grid.js" %}
-
-erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
-	filters: [
-		{
-			fieldtype:"Select", label: __("PL or BS"), fieldname: "pl_or_bs",
-			options:[{"label": __("Profit and Loss"), "value": "Profit and Loss"},
-				{"label": __("Balance Sheet"), "value": "Balance Sheet"}],
-			filter: function(val, item, opts, me) {
-				if(item._show) return true;
-
-				// pl or bs
-				var out = (val=='Balance Sheet') ?
-					item.report_type=='Balance Sheet' : item.report_type=='Profit and Loss';
-				if(!out) return false;
-
-				return me.apply_zero_filter(val, item, opts, me);
-			}
-		},
-		{
-			fieldtype:"Select", label: __("Company"), fieldname: "company",
-			link:"Company", default_value: __("Select Company..."),
-			filter: function(val, item, opts) {
-				return item.company == val || val == opts.default_value || item._show;
-			}
-		},
-		{fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year", fieldname: "fiscal_year",
-			default_value: __("Select Fiscal Year...")},
-		{fieldtype:"Date", label: __("From Date"), fieldname: "from_date"},
-		{fieldtype:"Date", label: __("To Date"), fieldname: "to_date"},
-		{fieldtype:"Select", label: __("Range"), fieldname: "range",
-			options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
-				{label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
-		{label: __("Yearly"), value: "Yearly"}]}
-	],
-	setup_columns: function() {
-		var std_columns = [
-			{id: "_check", name: __("Plot"), field: "_check", width: 30,
-				formatter: this.check_formatter},
-			{id: "name", name: __("Account"), field: "name", width: 300,
-				formatter: this.tree_formatter},
-			{id: "opening_dr", name: __("Opening (Dr)"), field: "opening_dr",
-				hidden: true, formatter: this.currency_formatter, balance_type: "Dr"},
-			{id: "opening_cr", name: __("Opening (Cr)"), field: "opening_cr",
-				hidden: true, formatter: this.currency_formatter, balance_type: "Cr"},
-		];
-
-		this.make_date_range_columns(true);
-		this.columns = std_columns.concat(this.columns);
-	},
-	make_date_range_columns: function() {
-		this.columns = [];
-
-		var me = this;
-		var range = this.filter_inputs.range.val();
-		this.from_date = dateutil.user_to_str(this.filter_inputs.from_date.val());
-		this.to_date = dateutil.user_to_str(this.filter_inputs.to_date.val());
-		var date_diff = dateutil.get_diff(this.to_date, this.from_date);
-
-		me.column_map = {};
-		me.last_date = null;
-
-		var add_column = function(date, balance_type) {
-			me.columns.push({
-				id: date + "_" + balance_type.toLowerCase(),
-				name: dateutil.str_to_user(date),
-				field: date + "_" + balance_type.toLowerCase(),
-				date: date,
-				balance_type: balance_type,
-				formatter: me.currency_formatter,
-				width: 110
-			});
-		}
-
-		var build_columns = function(condition) {
-			// add column for each date range
-			for(var i=0; i <= date_diff; i++) {
-				var date = dateutil.add_days(me.from_date, i);
-				if(!condition) condition = function() { return true; }
-
-				if(condition(date)) {
-					$.each(["Dr", "Cr"], function(i, v) {
-						add_column(date, v)
-					});
-				}
-				me.last_date = date;
-
-				if(me.columns.length) {
-					me.column_map[date] = me.columns[me.columns.length-1];
-				}
-			}
-		}
-
-		// make columns for all date ranges
-		if(range=='Daily') {
-			build_columns();
-		} else if(range=='Weekly') {
-			build_columns(function(date) {
-				if(!me.last_date) return true;
-				return !(dateutil.get_diff(date, me.from_date) % 7)
-			});
-		} else if(range=='Monthly') {
-			build_columns(function(date) {
-				if(!me.last_date) return true;
-				return dateutil.str_to_obj(me.last_date).getMonth() != dateutil.str_to_obj(date).getMonth()
-			});
-		} else if(range=='Quarterly') {
-			build_columns(function(date) {
-				if(!me.last_date) return true;
-				return dateutil.str_to_obj(date).getDate()==1 && in_list([0,3,6,9], dateutil.str_to_obj(date).getMonth())
-			});
-		} else if(range=='Yearly') {
-			build_columns(function(date) {
-				if(!me.last_date) return true;
-				return $.map(frappe.report_dump.data['Fiscal Year'], function(v) {
-						return date==v.year_start_date ? true : null;
-					}).length;
-			});
-
-		}
-
-		// set label as last date of period
-		$.each(this.columns, function(i, col) {
-			col.name = me.columns[i+2]
-				? dateutil.str_to_user(dateutil.add_days(me.columns[i+2].date, -1)) + " (" + me.columns[i].balance_type + ")"
-				: dateutil.str_to_user(me.to_date) + " (" + me.columns[i].balance_type + ")";
-		});
-	},
-	setup_filters: function() {
-		var me = this;
-		this._super();
-		this.trigger_refresh_on_change(["pl_or_bs"]);
-
-		this.filter_inputs.pl_or_bs
-			.add_options($.map(frappe.report_dump.data["Cost Center"], function(v) {return v.name;}));
-
-		this.setup_plot_check();
-	},
-	init_filter_values: function() {
-		this._super();
-		this.filter_inputs.range.val('Monthly');
-	},
-	prepare_balances: function() {
-		var me = this;
-		// setup cost center map
-		if(!this.cost_center_by_name) {
-			this.cost_center_by_name = this.make_name_map(frappe.report_dump.data["Cost Center"]);
-		}
-
-		var cost_center = inList(["Balance Sheet", "Profit and Loss"], this.pl_or_bs)
-			? null : this.cost_center_by_name[this.pl_or_bs];
-
-		$.each(frappe.report_dump.data['GL Entry'], function(i, gl) {
-			var filter_by_cost_center = (function() {
-				if(cost_center) {
-					if(gl.cost_center) {
-						var gl_cost_center = me.cost_center_by_name[gl.cost_center];
-						return gl_cost_center.lft >= cost_center.lft && gl_cost_center.rgt <= cost_center.rgt;
-					} else {
-						return false;
-					}
-				} else {
-					return true;
-				}
-			})();
-
-			if(filter_by_cost_center) {
-				var posting_date = dateutil.str_to_obj(gl.posting_date);
-				var account = me.item_by_name[gl.account];
-				var col = me.column_map[gl.posting_date];
-				if(col) {
-					if(gl.voucher_type=='Period Closing Voucher') {
-						// period closing voucher not to be added
-						// to profit and loss accounts (else will become zero!!)
-						if(account.report_type=='Balance Sheet')
-							me.add_balance(col.date, account, gl);
-					} else {
-						me.add_balance(col.date, account, gl);
-					}
-
-				} else if(account.report_type=='Balance Sheet'
-					&& (posting_date < dateutil.str_to_obj(me.from_date))) {
-						me.add_balance('opening', account, gl);
-				}
-			}
-		});
-
-		// make balances as cumulative
-		if(me.pl_or_bs=='Balance Sheet') {
-			$.each(me.data, function(i, ac) {
-				if((ac.rgt - ac.lft)==1 && ac.report_type=='Balance Sheet') {
-					var opening = flt(ac["opening_dr"]) - flt(ac["opening_cr"]);
-					//if(opening) throw opening;
-					$.each(me.columns, function(i, col) {
-						if(col.formatter==me.currency_formatter) {
-							if(col.balance_type=="Dr" && !in_list(["opening_dr", "opening_cr"], col.field)) {
-								opening = opening + flt(ac[col.date + "_dr"]) -
-									flt(ac[col.date + "_cr"]);
-								me.set_debit_or_credit(ac, col.date, opening);
-							}
-						}
-					});
-				}
-			})
-		}
-		this.update_groups();
-		this.accounts_initialized = true;
-
-		if(!me.is_default("company")) {
-			// show Net Profit / Loss
-			var net_profit = {
-				company: me.company,
-				id: "Net Profit / Loss",
-				name: "Net Profit / Loss",
-				indent: 0,
-				opening: 0,
-				checked: false,
-				report_type: me.pl_or_bs=="Balance Sheet"? "Balance Sheet" : "Profit and Loss",
-			};
-			me.item_by_name[net_profit.name] = net_profit;
-
-			$.each(me.columns, function(i, col) {
-				if(col.formatter==me.currency_formatter) {
-					if(!net_profit[col.id]) net_profit[col.id] = 0;
-				}
-			});
-
-			$.each(me.data, function(i, ac) {
-				if(!ac.parent_account && me.apply_filter(ac, "company") &&
-						ac.report_type==net_profit.report_type) {
-					$.each(me.columns, function(i, col) {
-						if(col.formatter==me.currency_formatter && col.balance_type=="Dr") {
-							var bal = net_profit[col.date+"_dr"] -
-								net_profit[col.date+"_cr"] +
-								ac[col.date+"_dr"] - ac[col.date+"_cr"];
-							me.set_debit_or_credit(net_profit, col.date, bal);
-						}
-					});
-				}
-			});
-			this.data.push(net_profit);
-		}
-	},
-	add_balance: function(field, account, gl) {
-		var bal = flt(account[field+"_dr"]) - flt(account[field+"_cr"]) +
-			flt(gl.debit) - flt(gl.credit);
-		this.set_debit_or_credit(account, field, bal);
-	},
-	update_groups: function() {
-		// update groups
-		var me= this;
-		$.each(this.data, function(i, account) {
-			// update groups
-			if((account.is_group == 0) || (account.rgt - account.lft == 1)) {
-				var parent = me.parent_map[account.name];
-				while(parent) {
-					var parent_account = me.item_by_name[parent];
-					$.each(me.columns, function(c, col) {
-						if (col.formatter == me.currency_formatter && col.balance_type=="Dr") {
-							var bal = flt(parent_account[col.date+"_dr"]) -
-								flt(parent_account[col.date+"_cr"]) +
-								flt(account[col.date+"_dr"]) -
-								flt(account[col.date+"_cr"]);
-							me.set_debit_or_credit(parent_account, col.date, bal);
-						}
-					});
-					parent = me.parent_map[parent];
-				}
-			}
-		});
-	},
-	init_account: function(d) {
-		// set 0 values for all columns
-		this.reset_item_values(d);
-
-		// check for default graphs
-		if(!this.accounts_initialized && !d.parent_account) {
-			d.checked = true;
-		}
-
-	},
-	get_plot_data: function() {
-		var data = [];
-		var me = this;
-		var pl_or_bs = this.pl_or_bs;
-		$.each(this.data, function(i, account) {
-
-			var show = pl_or_bs == "Balance Sheet" ?
-				account.report_type=="Balance Sheet" : account.report_type=="Profit and Loss";
-			if (show && account.checked && me.apply_filter(account, "company")) {
-				data.push({
-					label: account.name,
-					data: $.map(me.columns, function(col, idx) {
-						if(col.formatter==me.currency_formatter && !col.hidden &&
-							col.balance_type=="Dr") {
-								var bal = account[col.date+"_dr"]||account[col.date+"_cr"];
-								if (pl_or_bs != "Balance Sheet") {
-									return [[dateutil.str_to_obj(col.date).getTime(), bal],
-										[dateutil.str_to_obj(col.date).getTime(), bal]];
-								} else {
-									return [[dateutil.str_to_obj(col.date).getTime(), bal]];
-								}
-						}
-					}),
-					points: {show: true},
-					lines: {show: true, fill: true},
-				});
-
-				if(pl_or_bs == "Balance Sheet") {
-					// prepend opening for balance sheet accounts
-					data[data.length-1].data = [[dateutil.str_to_obj(me.from_date).getTime(),
-						account.opening]].concat(data[data.length-1].data);
-				}
-			}
-		});
-		return data;
-	}
-})
diff --git a/erpnext/accounts/page/financial_analytics/financial_analytics.json b/erpnext/accounts/page/financial_analytics/financial_analytics.json
deleted file mode 100644
index f551d82..0000000
--- a/erpnext/accounts/page/financial_analytics/financial_analytics.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "creation": "2013-01-27 16:30:52.000000", 
- "docstatus": 0, 
- "doctype": "Page", 
- "icon": "icon-bar-chart", 
- "idx": 1, 
- "modified": "2013-07-11 14:42:16.000000", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "financial-analytics", 
- "owner": "Administrator", 
- "page_name": "financial-analytics", 
- "roles": [
-  {
-   "role": "Analytics"
-  }, 
-  {
-   "role": "Accounts Manager"
-  }
- ], 
- "standard": "Yes", 
- "title": "Financial Analytics"
-}
\ No newline at end of file
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 386ed9e..4b3da28 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -4,7 +4,7 @@
 frappe.pages['pos'].on_page_load = function(wrapper) {
 	var page = frappe.ui.make_app_page({
 		parent: wrapper,
-		title: 'Point of Sale',
+		title: __('Point of Sale'),
 		single_column: true
 	});
 
@@ -32,6 +32,8 @@
 		var me = this;
 		if(this.load){
 			this.load = false;
+		}else if(this.connection_status){
+			this.onload();
 		}else{
 			this.create_new();
 		}
@@ -42,12 +44,13 @@
 		//Check Internet connection after every 30 seconds
 		setInterval(function(){
 			me.set_indicator();
-		}, 30000)
+		}, 5000)
 	},
 
 	set_indicator: function(){
 		var me = this;
 		// navigator.onLine
+		this.connection_status = false;
 		this.page.set_indicator("Offline", "grey")
 		frappe.call({
 			method:"frappe.handler.ping",
@@ -73,6 +76,7 @@
 		var me = this;
 
 		this.page.add_menu_item(__("New Sales Invoice"), function() {
+			me.save_previous_entry()
 			me.create_new()
 		})
 
@@ -89,7 +93,7 @@
 		});
 
 		this.page.add_menu_item(__("POS Profile"), function() {
-			frappe.set_route('POS Profile');
+			frappe.set_route('List', 'POS Profile');
 		});
 	},
 
@@ -106,8 +110,8 @@
 		$(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\
 				<div class="col-xs-3">Sr</div>\
 				<div class="col-xs-3">Customer</div>\
-				<div class="col-xs-3 text-right">Grand Total</div>\
-				<div class="col-xs-3 text-right">Status</div>\
+				<div class="col-xs-4 text-center">Grand Total</div>\
+				<div class="col-xs-2 text-left">Status</div>\
 		</div>')
 
 		$.each(this.si_docs, function(index, data){
@@ -117,7 +121,7 @@
 					name: key,
 					customer: data[key].customer,
 					grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
-					status: (data[key].docstatus == 1) ? 'Submitted' : 'Draft'
+					data: me.get_doctype_status(data[key])
 				})).appendTo($(me.list_body));
 			}
 		})
@@ -135,6 +139,16 @@
 		})
 	},
 
+	get_doctype_status: function(doc){
+		if(doc.outstanding_amount == 0){
+			return {status: "Paid", indicator: "green"}
+		}else if(doc.docstatus == 0){
+			return {status: "Draft", indicator: "red"}
+		}else if(doc.paid_amount >= 0){
+			return {status: "Unpaid", indicator: "orange"}
+		}
+	},
+
 	set_missing_values: function(){
 		var me = this;
 		doc = JSON.parse(localStorage.getItem('doc'))
@@ -174,11 +188,16 @@
 		})
 	},
 
+	save_previous_entry : function(){
+		if(this.frm.doc.items.length > 0){
+			this.create_invoice()
+		}
+	},
+
 	create_new: function(){
 		var me = this;
 		this.frm = {}
 		this.name = '';
-		this.frm.doc =  JSON.parse(localStorage.getItem('doc'))
 		this.load_data();
 		this.setup();
 	},
@@ -187,6 +206,7 @@
 		this.items = window.items;
 		this.customers = window.customers;
 		this.pricing_rules = window.pricing_rules;
+		this.frm.doc =  JSON.parse(localStorage.getItem('doc'));
 
 		$.each(window.meta, function(i, data){
 			frappe.meta.sync(data)
@@ -264,6 +284,7 @@
 		}
 
 		this.party_field.$input.autocomplete({
+			autoFocus: true,
 			source: function (request, response) {
 				me.customer_data = me.get_customers(request.term)
 				response($.map(me.customer_data, function(data){
@@ -282,19 +303,30 @@
 				}
 				me.refresh();
 			}
-		})
+		}).on("focus", function(){
+			setTimeout(function() {
+				if(!me.party_field.$input.val()) {
+					me.party_field.$input.autocomplete( "search", " " );
+				}
+			}, 500);
+		});
 	},
 
 	get_customers: function(key){
 		var me = this;
-		key = key.toLowerCase()
-		return $.grep(this.customers, function(data) {
-			if(data.name.toLowerCase().match(key)
-				|| data.customer_name.toLowerCase().match(key)
-				|| (data.customer_group && data.customer_group.toLowerCase().match(key))){
-				return data
-			}
-		})
+		key = key.toLowerCase().trim()
+		if(key){
+			return $.grep(this.customers, function(data) {
+				if(data.name.toLowerCase().match(key)
+					|| data.customer_name.toLowerCase().match(key)
+					|| (data.customer_group && data.customer_group.toLowerCase().match(key))){
+					return data
+				}
+			})
+		}else{
+			customers = this.customers.sort(function(a,b){ return a.idx < b.idx })
+			return customers.slice(0, 20)
+		}
 	},
 
 	make_item_list: function() {
@@ -377,39 +409,52 @@
 
 		$(this.wrapper).find(".pos-item-qty").on("change", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
-			me.update_qty_against_item_code(item_code, $(this).val());
+			me.update_qty_rate_against_item_code(item_code, "qty", $(this).val());
 		})
 
 		$(this.wrapper).find("[data-action='increase-qty']").on("click", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) + 1;
-			me.update_qty_against_item_code(item_code, qty);
+			me.update_qty_rate_against_item_code(item_code, "qty", qty);
 		})
 
 		$(this.wrapper).find("[data-action='decrease-qty']").on("click", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
-			me.update_qty_against_item_code(item_code, qty);
+			me.update_qty_rate_against_item_code(item_code, "qty", qty);
 		})
 	},
 
-	update_qty_against_item_code: function(item_code, qty){
+	update_rate: function() {
 		var me = this;
-		if(qty < 0){
-			frappe.throw(__("Quantity must be positive"));
+
+		$(this.wrapper).find(".pos-item-rate").on("change", function(){
+			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
+			me.update_qty_rate_against_item_code(item_code, "rate", $(this).val());
+		})
+	},
+
+	update_qty_rate_against_item_code: function(item_code, field, value){
+		var me = this;
+		if(value < 0){
+			frappe.throw(__("Enter value must be positive"));
 		}
 
 		this.remove_item = []
 		$.each(this.frm.doc["items"] || [], function(i, d) {
 			if (d.item_code == item_code) {
-				d.qty = flt(qty);
+				d[field] = flt(value);
 				d.amount = flt(d.rate) * flt(d.qty);
 				if(d.qty==0){
 					me.remove_item.push(d.idx)
 				}
 			}
 		});
-		this.remove_zero_qty_item();
+
+		if(field == 'qty'){
+			this.remove_zero_qty_item();
+		}
+
 		this.refresh();
 	},
 
@@ -512,6 +557,7 @@
 		var me = this;
 		this.refresh_fields();
 		this.update_qty();
+		this.update_rate();
 		this.set_primary_action();
 	},
 	refresh_fields: function() {
@@ -544,7 +590,7 @@
 				qty: d.qty,
 				actual_qty: d.actual_qty,
 				projected_qty: d.projected_qty,
-				rate: format_currency(d.rate, me.frm.doc.currency),
+				rate: format_number(d.rate, me.frm.doc.currency),
 				amount: format_currency(d.amount, me.frm.doc.currency)
 			})).appendTo($items);
 		});
@@ -552,6 +598,10 @@
 		this.wrapper.find("input.pos-item-qty").on("focus", function() {
 			$(this).select();
 		});
+
+		this.wrapper.find("input.pos-item-rate").on("focus", function() {
+			$(this).select();
+		});
 	},
 
 	set_taxes: function(){
@@ -596,18 +646,23 @@
 		}else if(this.frm.doc.docstatus == 1){
 			this.page.set_primary_action(__("Print"), function() {
 				html = frappe.render(me.print_template, me.frm.doc)
-				frappe.require("/assets/js/print_format_v3.min.js", function() {
-					w = _p.preview(html);
-					setTimeout(function(){
-						w.print();
-					}, 1000)
-				});
+				me.print_document(html)
 			})
 		}else {
 			this.page.clear_primary_action()
 		}
 	},
 
+	print_document: function(html){
+		var w = window.open();
+		w.document.write(html);
+		w.document.close();
+		setTimeout(function(){
+			w.print();
+			w.close();
+		}, 1000)
+	},
+
 	write_off_amount: function(){
 		var me = this;
 		var value = 0.0;
@@ -723,7 +778,7 @@
 		var me = this;
 		this.si_docs = this.get_submitted_invoice()
 
-		if(this.connection_status && this.si_docs.length){
+		if(this.si_docs.length){
 			frappe.call({
 				method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
 				args: {
@@ -740,12 +795,14 @@
 	},
 
 	get_submitted_invoice: function(){
-		invoices = []
-		docs = this.get_doc_from_localstorage()
+		var invoices = [];
+		var index = 1;
+		docs = this.get_doc_from_localstorage();
 		if(docs){
 			invoices = $.map(docs, function(data){
 				for(key in data){
-					if(data[key].docstatus == 1){
+					if(data[key].docstatus == 1 && index < 50){
+						index++
 						return data
 					}
 				}
diff --git a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
index 7641924..645fce6 100644
--- a/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
+++ b/erpnext/accounts/print_format/point_of_sale/point_of_sale.json
@@ -6,9 +6,9 @@
  "docstatus": 0, 
  "doctype": "Print Format", 
  "font": "Default", 
- "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{  __(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ posting_date }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>", 
+ "html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{  __(\"Invoice\") }}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ item.qty }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>", 
  "idx": 0, 
- "modified": "2016-05-11 15:04:24.359583", 
+ "modified": "2016-05-21 00:25:20.359074", 
  "modified_by": "Administrator", 
  "name": "Point of Sale", 
  "owner": "Administrator", 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 365212a..3a594c8 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -16,7 +16,10 @@
 
 	def run(self, args):
 		party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
-		return self.get_columns(party_naming_by, args), self.get_data(party_naming_by, args)
+		columns = self.get_columns(party_naming_by, args)
+		data = self.get_data(party_naming_by, args)
+		chart = self.get_chart_data(columns, data)
+		return columns, data, None, chart
 
 	def get_columns(self, party_naming_by, args):
 		columns = [_("Posting Date") + ":Date:80", _(args.get("party_type")) + ":Link/" + args.get("party_type") + ":200"]
@@ -39,6 +42,8 @@
 			})
 
 		columns += [_("Age (Days)") + ":Int:80"]
+		
+		self.ageing_col_idx_start = len(columns)
 
 		if not "range1" in self.filters:
 			self.filters["range1"] = "30"
@@ -46,7 +51,7 @@
 			self.filters["range2"] = "60"
 		if not "range3" in self.filters:
 			self.filters["range3"] = "90"
-
+			
 		for label in ("0-{range1}".format(**self.filters),
 			"{range1}-{range2}".format(**self.filters),
 			"{range2}-{range3}".format(**self.filters),
@@ -250,6 +255,23 @@
 		return self.gl_entries_map.get(party, {})\
 			.get(against_voucher_type, {})\
 			.get(against_voucher, [])
+			
+	def get_chart_data(self, columns, data):
+		ageing_columns = columns[self.ageing_col_idx_start : self.ageing_col_idx_start+4]
+		
+		rows = []
+		for d in data:
+			rows.append(d[self.ageing_col_idx_start : self.ageing_col_idx_start+4])
+
+		if rows:
+			rows.insert(0, [[d.get("label")] for d in ageing_columns])
+		
+		return {
+			"data": {
+				'rows': rows
+			},
+			"chart_type": 'pie'
+		}
 
 def execute(filters=None):
 	args = {
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 1f60f8f..4efd098 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -27,8 +27,10 @@
 		data.append(provisional_profit_loss)
 
 	columns = get_columns(filters.periodicity, period_list, company=filters.company)
+	
+	chart = get_chart_data(columns, asset, liability, equity)
 
-	return columns, data, message
+	return columns, data, message, chart
 
 def get_provisional_profit_loss(asset, liability, equity, period_list, company):
 	if asset and (liability or equity):
@@ -62,11 +64,41 @@
 
 def check_opening_balance(asset, liability, equity):
 	# Check if previous year balance sheet closed
-	opening_balance = flt(asset[0].get("opening_balance", 0))
+	opening_balance = 0
+	if asset:
+		opening_balance = flt(asset[0].get("opening_balance", 0))
 	if liability:
 		opening_balance -= flt(liability[0].get("opening_balance", 0))
 	if equity:
 		opening_balance -= flt(asset[0].get("opening_balance", 0))
 
 	if opening_balance:
-		return _("Previous Financial Year is not closed")
\ No newline at end of file
+		return _("Previous Financial Year is not closed")
+		
+def get_chart_data(columns, asset, liability, equity):
+	x_intervals = ['x'] + [d.get("label") for d in columns[2:]]
+	
+	asset_data, liability_data, equity_data = [], [], []
+	
+	for p in columns[2:]:
+		if asset:
+			asset_data.append(asset[-2].get(p.get("fieldname")))
+		if liability:
+			liability_data.append(liability[-2].get(p.get("fieldname")))
+		if equity:
+			equity_data.append(equity[-2].get(p.get("fieldname")))
+		
+	columns = [x_intervals]
+	if asset_data:
+		columns.append(["Assets"] + asset_data)
+	if liability_data:
+		columns.append(["Liabilities"] + liability_data)
+	if equity_data:
+		columns.append(["Equity"] + equity_data)
+
+	return {
+		"data": {
+			'x': 'x',
+			'columns': columns
+		}
+	}
\ No newline at end of file
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 1a59a9d..c930952 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -112,7 +112,7 @@
 	out = filter_out_zero_value_rows(out, parent_children_map)
 	
 	if out:
-		add_total_row(out, balance_must_be, period_list, company_currency)
+		add_total_row(out, root_type, balance_must_be, period_list, company_currency)
 
 	return out
 
@@ -193,9 +193,9 @@
 
 	return data_with_value
 
-def add_total_row(out, balance_must_be, period_list, company_currency):
+def add_total_row(out, root_type, balance_must_be, period_list, company_currency):
 	total_row = {
-		"account_name": "'" + _("Total ({0})").format(balance_must_be) + "'",
+		"account_name": "'" + _("Total {0} ({1})").format(root_type, balance_must_be) + "'",
 		"account": None,
 		"currency": company_currency
 	}
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index c53ed99..d10b3d9 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -87,7 +87,8 @@
 	columns += [
 		_("Voucher Type") + "::120", _("Voucher No") + ":Dynamic Link/"+_("Voucher Type")+":160",
 		_("Against Account") + "::120", _("Party Type") + "::80", _("Party") + "::150",
-		_("Cost Center") + ":Link/Cost Center:100", _("Remarks") + "::400"
+		_("Project") + ":Link/Project:100", _("Cost Center") + ":Link/Cost Center:100", 
+		_("Remarks") + "::400"
 	]
 
 	return columns
@@ -109,9 +110,12 @@
 	group_by_condition = "group by voucher_type, voucher_no, account, cost_center" \
 		if filters.get("group_by_voucher") else "group by name"
 
-	gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,
+	gl_entries = frappe.db.sql("""
+		select 
+			posting_date, account, party_type, party,
 			sum(debit) as debit, sum(credit) as credit,
-			voucher_type, voucher_no, cost_center, remarks, against, is_opening {select_fields}
+			voucher_type, voucher_no, cost_center, project,
+			remarks, against, is_opening {select_fields}
 		from `tabGL Entry`
 		where company=%(company)s {conditions}
 		{group_by_condition}
@@ -283,7 +287,7 @@
 			row += [d.get("debit_in_account_currency"), d.get("credit_in_account_currency")]
 
 		row += [d.get("voucher_type"), d.get("voucher_no"), d.get("against"),
-			d.get("party_type"), d.get("party"), d.get("cost_center"), d.get("remarks")
+			d.get("party_type"), d.get("party"), d.get("project"), d.get("cost_center"), d.get("remarks")
 		]
 
 		result.append(row)
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 4ae0e67..aa0232b 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -215,7 +215,7 @@
 	def get_average_buying_rate(self, item_code):
 		if not item_code in self.average_buying_rate:
 			if item_code in self.non_stock_items:
-				self.average_buying_rate[item_code] = flt(frappe.db.sql("""select sum(base_net_amount) / sum(qty)
+				self.average_buying_rate[item_code] = flt(frappe.db.sql("""select sum(base_net_amount) / sum(qty * conversion_factor)
 					from `tabPurchase Invoice Item`
 					where item_code = %s and docstatus=1""", item_code)[0][0])
 			else:
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 7c33db2..62d6e69 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -24,8 +24,10 @@
 		data.append(net_profit_loss)
 
 	columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
+	
+	chart = get_chart_data(filters, columns, income, expense, net_profit_loss)
 
-	return columns, data
+	return columns, data, None, chart
 
 def get_net_profit_loss(income, expense, period_list, company):
 	if income and expense:
@@ -50,3 +52,36 @@
 		
 		if has_value:
 			return net_profit_loss
+
+def get_chart_data(filters, columns, income, expense, net_profit_loss):
+	x_intervals = ['x'] + [d.get("label") for d in columns[2:-1]]
+	
+	income_data, expense_data, net_profit = [], [], []
+	
+	for p in columns[2:]:
+		if income:
+			income_data.append(income[-2].get(p.get("fieldname")))
+		if expense:
+			expense_data.append(expense[-2].get(p.get("fieldname")))
+		if net_profit_loss:
+			net_profit.append(net_profit_loss.get(p.get("fieldname")))
+			
+	columns = [x_intervals]
+	if income_data:
+		columns.append(["Income"] + income_data)
+	if expense_data:
+		columns.append(["Expense"] + expense_data)
+	if net_profit:
+		columns.append(["Net Profit/Loss"] + net_profit)
+		
+	chart = {
+		"data": {
+			'x': 'x',
+			'columns': columns
+		}
+	}
+	
+	if not filters.accumulated_values:
+		chart["chart_type"] = "bar"
+		
+	return chart
\ No newline at end of file
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 3b78683..27f1394 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -7,7 +7,6 @@
 from frappe.utils import nowdate, cstr, flt, cint, now, getdate
 from frappe import throw, _
 from frappe.utils import formatdate
-import frappe.desk.reportview
 
 # imported to enable erpnext.accounts.utils.get_account_currency
 from erpnext.accounts.doctype.account.account import get_account_currency
@@ -128,20 +127,20 @@
 	if not args:
 		args = frappe.local.form_dict
 		args.pop("cmd")
-	
+
 	ac = frappe.new_doc("Account")
-	
+
 	if args.get("ignore_permissions"):
 		ac.flags.ignore_permissions = True
 		args.pop("ignore_permissions")
-	
+
 	ac.update(args)
 	ac.old_parent = ""
 	ac.freeze_account = "No"
 	if cint(ac.get("is_root")):
 		ac.parent_account = None
-		ac.flags.ignore_mandatory = True		
-		
+		ac.flags.ignore_mandatory = True
+
 	ac.insert()
 
 	return ac.name
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index dbfda21..6416a23 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -12,7 +12,7 @@
 erpnext.buying.BuyingController = erpnext.TransactionController.extend({
 	setup: function() {
 		this._super();
-		if(!this.frm.get_field('items').grid.editable_fields){
+		if(!in_list(["Material Request", "Request for Quotation"], this.frm.doc.doctype)){
 			this.frm.get_field('items').grid.editable_fields = [
 				{fieldname: 'item_code', columns: 4},
 				{fieldname: 'qty', columns: 2},
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
index 7218531..5fb8b80 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js
@@ -14,6 +14,19 @@
 				filters: {'supplier': d.supplier}
 			}
 		}
+
+		frm.get_field('items').grid.editable_fields = [
+			{fieldname: 'item_code', columns: 4},
+			{fieldname: 'qty', columns: 2},
+			{fieldname: 'schedule_date', columns: 2},
+			{fieldname: 'warehouse', columns: 3},
+		];
+		
+		frm.get_field('suppliers').grid.editable_fields = [
+			{fieldname: 'supplier', columns: 5},
+			{fieldname: 'contact', columns: 3},
+			{fieldname: 'email_id', columns: 3}
+		];
 	},
 
 	onload: function(frm){
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
index d9b34eb..3399b51 100644
--- a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.json
@@ -147,7 +147,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-05-10 11:36:04.171180", 
+ "modified": "2016-05-31 19:08:15.397706", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Request for Quotation Supplier", 
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index d502a3d..f23885a 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -24,24 +24,6 @@
 		  	unhide_field(['address_html','contact_html']);
 			erpnext.utils.render_address_and_contact(frm);
 		}
-
-		frm.events.add_custom_buttons(frm);
-	},
-	add_custom_buttons: function(frm) {
-		// ["Supplier Quotation", "Purchase Order", "Purchase Receipt", "Purchase Invoice"].forEach(function(doctype, i) {
-		// 	if(frappe.model.can_read(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"supplier": frm.doc.name};
-		// 			frappe.set_route("List", doctype);
-		// 		}, __("View"));
-		// 	}
-		// 	if(frappe.model.can_create(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"supplier": frm.doc.name};
-		// 			new_doc(doctype);
-		// 		}, __("Make"));
-		// 	}
-		// });
 	},
 });
 
diff --git a/erpnext/buying/page/purchase_analytics/purchase_analytics.js b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
index afb615f..3e6f23b 100644
--- a/erpnext/buying/page/purchase_analytics/purchase_analytics.js
+++ b/erpnext/buying/page/purchase_analytics/purchase_analytics.js
@@ -110,7 +110,7 @@
 		this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on", "company"]);
 
 		this.show_zero_check()
-		this.setup_plot_check();
+		this.setup_chart_check();
 	},
 	init_filter_values: function() {
 		this._super();
@@ -248,9 +248,5 @@
 		if(!this.checked) {
 			this.data[0].checked = true;
 		}
-	},
-	get_plot_points: function(item, col, idx) {
-		return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]],
-			[dateutil.user_to_obj(col.name).getTime(), item[col.field]]];
 	}
 });
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 1b445fe..e11544a 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -321,12 +321,6 @@
 			"label": _("Analytics"),
 			"items": [
 				{
-					"type": "page",
-					"name": "financial-analytics",
-					"label": _("Financial Analytics"),
-					"icon": "icon-bar-chart",
-				},
-				{
 					"type": "report",
 					"name": "Gross Profit",
 					"doctype": "Sales Invoice",
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index e6d0ee9..34f098e 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -247,7 +247,8 @@
 			'credit_in_account_currency': 0,
 			'is_opening': self.get("is_opening") or "No",
 			'party_type': None,
-			'party': None
+			'party': None,
+			'project': self.get("project")
 		})
 		gl_dict.update(args)
 
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 0ea0734..41b8b88 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -32,13 +32,13 @@
 	attribute_values = {}
 	for t in frappe.get_all("Item Attribute Value", fields=["parent", "attribute_value"],
 		filters={"parent": ["in", args.keys()]}):
-		
+
 		(attribute_values.setdefault(t.parent.lower(), [])).append(t.attribute_value)
 
 	numeric_attributes = frappe._dict((t.attribute.lower(), t) for t in \
 		frappe.db.sql("""select attribute, from_range, to_range, increment from `tabItem Variant Attribute`
 		where parent = %s and numeric_values=1""", (item), as_dict=1))
-		
+
 	for attribute, value in args.items():
 		if attribute.lower() in numeric_attributes:
 			numeric_attribute = numeric_attributes[attribute.lower()]
@@ -61,10 +61,10 @@
 			if not (is_in_range and is_incremental):
 				frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
 					.format(attribute, from_range, to_range, increment), InvalidItemAttributeValueError)
-		
+
 		elif value not in attribute_values.get(attribute.lower(), []):
 			frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
-				value, attribute))
+				value, attribute), InvalidItemAttributeValueError)
 
 def find_variant(template, args, variant_item_code=None):
 	conditions = ["""(iv_attribute.attribute="{0}" and iv_attribute.attribute_value="{1}")"""\
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 845a4d0..1976cc6 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -62,6 +62,7 @@
 							"cost_center": detail.cost_center,
 							"remarks": self.get("remarks") or "Accounting Entry for Stock",
 							"credit": flt(sle.stock_value_difference, 2),
+							"project": detail.get("project") or self.get("project")
 						}))
 					elif sle.warehouse not in warehouse_with_no_account:
 						warehouse_with_no_account.append(sle.warehouse)
diff --git a/erpnext/crm/doctype/newsletter/newsletter.js b/erpnext/crm/doctype/newsletter/newsletter.js
index 77eecac..9bee9b3 100644
--- a/erpnext/crm/doctype/newsletter/newsletter.js
+++ b/erpnext/crm/doctype/newsletter/newsletter.js
@@ -38,7 +38,7 @@
 		var total = frappe.utils.sum($.map(stat, function(v) { return v; }));
 		if(total) {
 			$.each(stat, function(k, v) {
-				stat[k] = flt(v * 100 / total, 2);
+				stat[k] = flt(v * 100 / total, 2) + '%';
 			});
 
 			cur_frm.dashboard.add_progress("Status", [
diff --git a/erpnext/crm/doctype/newsletter_list/newsletter_list.js b/erpnext/crm/doctype/newsletter_list/newsletter_list.js
index d6cda45..7799627 100644
--- a/erpnext/crm/doctype/newsletter_list/newsletter_list.js
+++ b/erpnext/crm/doctype/newsletter_list/newsletter_list.js
@@ -39,7 +39,7 @@
 
 		frm.add_custom_button(__("New Newsletter"), function() {
 			frappe.route_options = {"newsletter_list": frm.doc.name};
-			new_doc("Newsletter");
+			frappe.new_doc("Newsletter");
 		}, __("Action"));
 
 	}
diff --git a/erpnext/docs/user/manual/de/website/setup/social-login-keys.md b/erpnext/docs/user/manual/de/website/setup/social-login-keys.md
index 746a313..6a336f9 100644
--- a/erpnext/docs/user/manual/de/website/setup/social-login-keys.md
+++ b/erpnext/docs/user/manual/de/website/setup/social-login-keys.md
@@ -9,6 +9,6 @@
 
 * Für Facebook: https://www.youtube.com/watch?v=zC6Q6gIfiw8
 * Für Google: https://www.youtube.com/watch?v=w_EAttrE9sw
-* Für GutHub: https://www.youtube.com/watch?v=bG71DxxkVjQ
+* Für GitHub: https://www.youtube.com/watch?v=bG71DxxkVjQ
 
 {next}
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index af0d5e4..fcf2646 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.27.19"
+app_version = "6.27.21"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
diff --git a/erpnext/hr/doctype/designation/designation.js b/erpnext/hr/doctype/designation/designation.js
new file mode 100644
index 0000000..952c73f
--- /dev/null
+++ b/erpnext/hr/doctype/designation/designation.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Designation', {
+	refresh: function(frm) {
+
+	}
+});
diff --git a/erpnext/hr/doctype/designation/designation.json b/erpnext/hr/doctype/designation/designation.json
index 1a1cc32..73f4446 100644
--- a/erpnext/hr/doctype/designation/designation.json
+++ b/erpnext/hr/doctype/designation/designation.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:designation_name", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:13", 
  "custom": 0, 
  "docstatus": 0, 
@@ -17,6 +18,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Designation", 
@@ -26,12 +28,38 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -44,7 +72,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:45.227540", 
+ "modified": "2016-06-01 12:52:03.787578", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Designation", 
@@ -71,6 +99,9 @@
    "write": 1
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.js b/erpnext/hr/doctype/job_applicant/job_applicant.js
index eac1a9a..6541a8c 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.js
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.js
@@ -20,11 +20,11 @@
 						"applicant_name": frm.doc.applicant_name,
 						"designation": frm.doc.job_opening,
 					};
-					new_doc("Offer Letter");
+					frappe.new_doc("Offer Letter");
 				}, __("Make"));
 				cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 			}
 		}
-		
+
 	}
 });
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_opening/job_opening.py b/erpnext/hr/doctype/job_opening/job_opening.py
index 90993c7..acc40b7 100644
--- a/erpnext/hr/doctype/job_opening/job_opening.py
+++ b/erpnext/hr/doctype/job_opening/job_opening.py
@@ -27,5 +27,3 @@
 def get_list_context(context):
 	context.title = _("Jobs")
 	context.introduction = _('Current Job Openings')
-	context.show_sidebar=True
-	context.show_search=True
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index aeacf11..6f45ff2 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -4,6 +4,14 @@
 frappe.provide("erpnext.bom");
 
 frappe.ui.form.on("BOM", {
+	setup: function(frm) {
+		frm.get_field('items').grid.editable_fields = [
+			{fieldname: 'item_code', columns: 4},
+			{fieldname: 'item_name', columns: 3},
+			{fieldname: 'qty', columns: 2},
+			{fieldname: 'rate', columns: 2}
+		];
+	},
 	onload_post_render: function(frm) {
 		frm.get_field("items").grid.set_multiple_add("item_code", "qty");
 	},
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index f45708a..7ef1d6a 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -323,7 +323,7 @@
 					ifnull(sum(fb.qty/ifnull(bom.quantity, 1)), 0) as qty,
 					fb.description, fb.stock_uom, item.min_order_qty
 					from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` item
-					where bom.name = fb.parent and it.name = fb.item_code
+					where bom.name = fb.parent and item.name = fb.item_code
 					and (item.is_sub_contracted_item = 0 or ifnull(item.default_bom, "")="")
 					and item.is_stock_item = 1
 					and fb.docstatus<2 and bom.name=%s
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index fdd5513..210a9e8 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -265,4 +265,6 @@
 erpnext.patches.v7_0.fix_duplicate_icons
 erpnext.patches.v7_0.remove_features_setup
 erpnext.patches.v7_0.update_home_page
-erpnext.patches.v7_0.create_budget_record
\ No newline at end of file
+erpnext.patches.v7_0.create_budget_record
+execute:frappe.delete_doc_if_exists("Page", "financial-analytics")
+erpnext.patches.v7_0.update_project_in_gl_entry
diff --git a/erpnext/patches/v7_0/update_home_page.py b/erpnext/patches/v7_0/update_home_page.py
index f646405..604d7d4 100644
--- a/erpnext/patches/v7_0/update_home_page.py
+++ b/erpnext/patches/v7_0/update_home_page.py
@@ -12,7 +12,10 @@
 		if header and header.startswith("<div class='hero text-center'>"):
 			homepage = frappe.get_doc('Homepage', 'Homepage')
 			homepage.company = erpnext.get_default_company()
-			homepage.tag_line = header.split('<h1>')[1].split('</h1>')[0] or 'Default Website'
+			if '<h1>' in header:
+				homepage.tag_line = header.split('<h1>')[1].split('</h1>')[0] or 'Default Website'
+			else:
+				homepage.tag_line = 'Default Website'
 			homepage.setup_items()
 			homepage.save()
 
diff --git a/erpnext/patches/v7_0/update_project_in_gl_entry.py b/erpnext/patches/v7_0/update_project_in_gl_entry.py
new file mode 100644
index 0000000..7f9923b
--- /dev/null
+++ b/erpnext/patches/v7_0/update_project_in_gl_entry.py
@@ -0,0 +1,20 @@
+import frappe
+
+def execute():
+	frappe.reload_doctype("GL Entry")
+	
+	for doctype in ("Delivery Note", "Sales Invoice", "Stock Entry"):
+		frappe.db.sql("""
+			update `tabGL Entry` gle, `tab{0}` dt
+			set gle.project = dt.project
+			where gle.voucher_type=%s and gle.voucher_no = dt.name
+				and ifnull(gle.cost_center, '') != '' and ifnull(dt.project, '') != ''
+		""".format(doctype), doctype)
+		
+	for doctype in ("Purchase Receipt", "Purchase Invoice"):
+		frappe.db.sql("""
+			update `tabGL Entry` gle, `tab{0} Item` dt
+			set gle.project = dt.project
+			where gle.voucher_type=%s and gle.voucher_no = dt.parent and gle.cost_center=dt.cost_center 
+				and ifnull(gle.cost_center, '') != '' and ifnull(dt.project, '') != ''
+		""".format(doctype), doctype)
\ No newline at end of file
diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js
index 4835287..7b340d2 100644
--- a/erpnext/projects/doctype/project/project.js
+++ b/erpnext/projects/doctype/project/project.js
@@ -2,6 +2,15 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.ui.form.on("Project", {
+	setup: function(frm) {
+		frm.get_field('tasks').grid.editable_fields = [
+			{fieldname: 'title', columns: 4},
+			{fieldname: 'status', columns: 3},
+			{fieldname: 'start_date', columns: 2},
+			{fieldname: 'end_date', columns: 2}
+		];
+
+	},
 	onload: function(frm) {
 		var so = frappe.meta.get_docfield("Project", "sales_order");
 		so.get_route_options_for_new_doc = function(field) {
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
index 6777e1e..91e1d6b 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -124,3 +124,47 @@
 .dashboard-list-item:last-child {
   border-bottom: none;
 }
+.payment-toolbar {
+  margin-left: 35px;
+}
+.payment-mode {
+  cursor: pointer;
+  font-family: sans-serif;
+  font-size: 15px;
+}
+.pos-payment-row .col-xs-6 {
+  padding: 10px;
+}
+.pos-payment-row {
+  border-bottom: 1px solid #d1d8dd;
+  margin: 2px 0px 5px 0px;
+}
+.pos-payment-row:hover,
+.pos-keyboard-key:hover {
+  background-color: #FAFBFC;
+  cursor: pointer;
+}
+.pos-keyboard-key,
+.delete-btn {
+  border: 1px solid #d1d8dd;
+  height: 85px;
+  width: 85px;
+  margin: 10px 10px;
+  font-size: 24px;
+  font-weight: 200;
+  background-color: #FDFDFD;
+  border-color: #e8e8e8;
+}
+.amount {
+  margin-top: 5px;
+}
+.amount-label {
+  font-size: 16px;
+}
+.selected-payment-mode {
+  background-color: #FAFBFC;
+  cursor: pointer;
+}
+.pos-invoice-list {
+  padding: 15px 10px;
+}
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index ac266f5..ac0287d 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -216,12 +216,17 @@
 			// barcode cleared, remove item
 			d.item_code = "";
 		}
-		this.item_code(doc, cdt, cdn);
+		this.item_code(doc, cdt, cdn, true);
 	},
 
-	item_code: function(doc, cdt, cdn) {
+	item_code: function(doc, cdt, cdn, from_barcode) {
 		var me = this;
 		var item = frappe.get_doc(cdt, cdn);
+
+		// clear barcode if setting item (else barcode will take priority)
+		if(!from_barcode) {
+			item.barcode = null;
+		}
 		if(item.item_code || item.barcode || item.serial_no) {
 			if(!this.validate_company_and_party()) {
 				cur_frm.fields_dict["items"].grid.grid_rows[item.idx - 1].remove();
@@ -966,6 +971,9 @@
 	},
 
 	setup_item_selector: function() {
+		// TODO: remove item selector
+
+		return;
 		if(!this.item_selector) {
 			this.item_selector = new erpnext.ItemSelector({frm: this.frm});
 		}
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index 3c87dab..c1e53a2 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -28,7 +28,7 @@
 				{ "value": "Half-Yearly", "label": __("Half-Yearly") },
 				{ "value": "Yearly", "label": __("Yearly") }
 			],
-			"default": "Yearly",
+			"default": "Monthly",
 			"reqd": 1
 		}
 	],
@@ -83,5 +83,5 @@
 			var filters = report.get_values();
 			frappe.set_route('query-report', 'Cash Flow', {company: filters.company});
 		}, 'Financial Statements');
-	},
+	}
 };
diff --git a/erpnext/public/js/pos/pos_bill_item.html b/erpnext/public/js/pos/pos_bill_item.html
index fe521f6..c21e1d5 100644
--- a/erpnext/public/js/pos/pos_bill_item.html
+++ b/erpnext/public/js/pos/pos_bill_item.html
@@ -17,6 +17,7 @@
         </div>
     </div>
     <div class="col-xs-3 text-right">
-        <h6>{%= amount %}<div class="text-muted" style="margin-top: 5px;">{%= rate %}</div></h6>
+        <div class="text-muted" style="margin-top: 5px;"><input type="text" value="{%= rate %}" class="form-control input-sm pos-item-rate text-right"></div>
+		<p><h6>{%= amount %}</h6></p>
     </div>
 </div>
diff --git a/erpnext/public/js/pos/pos_invoice_list.html b/erpnext/public/js/pos/pos_invoice_list.html
index 8d2644c..cb25072 100644
--- a/erpnext/public/js/pos/pos_invoice_list.html
+++ b/erpnext/public/js/pos/pos_invoice_list.html
@@ -1,6 +1,6 @@
 <div class="row list-row pos-invoice-list" invoice-name = "{{name}}">
 	<div class="col-xs-3">{%= sr %}</div>
 	<div class="col-xs-3">{%= customer %}</div>
-	<div class="col-xs-3 text-right">{%= grand_total %}</div>
-	<div class="col-xs-3 text-right">{%= status %}</div>
+	<div class="col-xs-4 text-center">{%= grand_total %}</div>
+	<div class="col-xs-2 text-left"><span class="indicator {{data.indicator}}">{{ data.status }}</span></div>
 </div>
diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js
index e9f9758..c64a2c9 100644
--- a/erpnext/public/js/stock_analytics.js
+++ b/erpnext/public/js/stock_analytics.js
@@ -78,7 +78,7 @@
 			this.trigger_refresh_on_change(["value_or_qty", "brand", "warehouse", "range"]);
 
 			this.show_zero_check();
-			this.setup_plot_check();
+			this.setup_chart_check();
 		},
 		init_filter_values: function() {
 			this._super();
@@ -198,9 +198,6 @@
 				}
 			});
 		},
-		get_plot_points: function(item, col, idx) {
-			return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
-		},
 		show_stock_ledger: function(item_code) {
 			frappe.route_options = {
 				item_code: item_code,
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 8bca282..ea28fd5 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -93,7 +93,7 @@
 			.html(frappe.render_template("address_list",
 				cur_frm.doc.__onload))
 			.find(".btn-address").on("click", function() {
-				new_doc("Address");
+				frappe.new_doc("Address");
 			});
 
 		// render contact
@@ -102,7 +102,7 @@
 				.html(frappe.render_template("contact_list",
 					cur_frm.doc.__onload))
 				.find(".btn-contact").on("click", function() {
-					new_doc("Contact");
+					frappe.new_doc("Contact");
 				}
 			);
 		}
diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less
index 58e8e62..7da54e7 100644
--- a/erpnext/public/less/erpnext.less
+++ b/erpnext/public/less/erpnext.less
@@ -156,3 +156,55 @@
 .dashboard-list-item:last-child {
 	border-bottom: none;
 }
+
+.payment-toolbar {
+	margin-left: 35px;
+}
+
+.payment-mode {
+	cursor: pointer;
+	font-family: sans-serif;
+	font-size: 15px;
+}
+
+.pos-payment-row .col-xs-6 {
+	padding :10px;
+}
+
+.pos-payment-row {
+	border-bottom:1px solid #d1d8dd;
+    margin: 2px 0px 5px 0px;
+}
+
+.pos-payment-row:hover, .pos-keyboard-key:hover{
+	background-color: #FAFBFC;
+	cursor: pointer;
+}
+
+.pos-keyboard-key, .delete-btn {
+	border: 1px solid #d1d8dd;
+	height:85px;
+	width:85px;
+	margin:10px 10px;
+	font-size:24px;
+	font-weight:200;
+	background-color: #FDFDFD;
+	border-color: #e8e8e8;
+}
+
+.amount {
+	margin-top: 5px;
+}
+
+.amount-label {
+	font-size: 16px;
+}
+
+.selected-payment-mode {
+	background-color: #FAFBFC;
+	cursor: pointer;
+}
+
+.pos-invoice-list {
+	padding: 15px 10px;
+}
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 87d028f..3556be7 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -27,24 +27,6 @@
 		var grid = cur_frm.get_field("sales_team").grid;
 		grid.set_column_disp("allocated_amount", false);
 		grid.set_column_disp("incentives", false);
-
-		frm.events.add_custom_buttons(frm);
-	},
-	add_custom_buttons: function(frm) {
-		// ["Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"].forEach(function(doctype, i) {
-		// 	if(frappe.model.can_read(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"customer": frm.doc.name};
-		// 			frappe.set_route("List", doctype);
-		// 		}, __("View"));
-		// 	}
-		// 	if(frappe.model.can_create(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"customer": frm.doc.name};
-		// 			new_doc(doctype);
-		// 		}, __("Make"));
-		// 	}
-		// });
 	},
 	validate: function(frm) {
 		if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index c8a8d7d..060ed62 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -345,11 +345,6 @@
 	def update_item(source, target, source_parent):
 		target.project = source_parent.project
 
-
-	so = frappe.get_doc("Sales Order", source_name)
-
-	item_table = "Packed Item" if so.packed_items else "Sales Order Item"
-
 	doc = get_mapped_doc("Sales Order", source_name, {
 		"Sales Order": {
 			"doctype": "Material Request",
@@ -357,13 +352,22 @@
 				"docstatus": ["=", 1]
 			}
 		},
-		item_table: {
+		"Packed Item": {
 			"doctype": "Material Request Item",
 			"field_map": {
 				"parent": "sales_order",
 				"stock_uom": "uom"
 			},
 			"postprocess": update_item
+		},
+		"Sales Order Item": {
+			"doctype": "Material Request Item",
+			"field_map": {
+				"parent": "sales_order",
+				"stock_uom": "uom"
+			},
+			"condition": lambda doc: not frappe.db.exists('Product Bundle', doc.item_code),
+			"postprocess": update_item
 		}
 	}, target_doc, postprocess)
 
diff --git a/erpnext/selling/page/sales_analytics/sales_analytics.js b/erpnext/selling/page/sales_analytics/sales_analytics.js
index e37610d..2f9b02c 100644
--- a/erpnext/selling/page/sales_analytics/sales_analytics.js
+++ b/erpnext/selling/page/sales_analytics/sales_analytics.js
@@ -97,11 +97,11 @@
 			"Sales Order", "Delivery Note"]},
 		{fieldtype:"Select", fieldname: "value_or_qty", label:  __("Value or Qty"),
 			options:[{label: __("Value"), value: "Value"}, {label: __("Quantity"), value: "Quantity"}]},
-		{fieldtype:"Select", fieldname: "company", label: __("Company"), link:"Company",
-			default_value: __("Select Company...")},
 		{fieldtype:"Date", fieldname: "from_date", label: __("From Date")},
 		{fieldtype:"Label", fieldname: "to", label: __("To")},
 		{fieldtype:"Date", fieldname: "to_date", label: __("To Date")},
+		{fieldtype:"Select", fieldname: "company", label: __("Company"), link:"Company",
+			default_value: __("Select Company...")},
 		{fieldtype:"Select", label: __("Range"), fieldname: "range",
 			options:[{label: __("Daily"), value: "Daily"}, {label: __("Weekly"), value: "Weekly"},
 				{label: __("Monthly"), value: "Monthly"}, {label: __("Quarterly"), value: "Quarterly"},
@@ -114,7 +114,7 @@
 		this.trigger_refresh_on_change(["value_or_qty", "tree_type", "based_on", "company"]);
 
 		this.show_zero_check()
-		this.setup_plot_check();
+		this.setup_chart_check();
 	},
 	init_filter_values: function() {
 		this._super();
@@ -243,9 +243,5 @@
 		if(!this.checked) {
 			this.data[0].checked = true;
 		}
-	},
-	get_plot_points: function(item, col, idx) {
-		return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]],
-			[dateutil.user_to_obj(col.name).getTime(), item[col.field]]];
 	}
 });
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index ebb7805..7da7c25 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -98,7 +98,7 @@
 						"company": self.name,
 						"create_account_under": stock_group
 					})
-					warehouse.flags.ignore_permissions = self.flags.ignore_permissions
+					warehouse.flags.ignore_permissions = True
 					warehouse.insert()
 
 	def create_default_accounts(self):
@@ -106,12 +106,12 @@
 			self.chart_of_accounts = "Standard"
 
 		from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
-		create_charts(self.chart_of_accounts, self.name, self.flags.ignore_permissions)
+		create_charts(self.chart_of_accounts, self.name)
 
 		frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
-			{"company": self.name, "account_type": "Receivable"}))
+			{"company": self.name, "account_type": "Receivable", "is_group": 0}))
 		frappe.db.set(self, "default_payable_account", frappe.db.get_value("Account",
-			{"company": self.name, "account_type": "Payable"}))
+			{"company": self.name, "account_type": "Payable", "is_group": 0}))
 
 	def set_default_accounts(self):
 		self._set_default_account("default_cash_account", "Cash")
@@ -194,8 +194,9 @@
 
 		rec = frappe.db.sql("SELECT name from `tabGL Entry` where company = %s", self.name)
 		if not rec:
-			frappe.db.sql("""delete from `tabBudget Account` b
-				where exists(select name from tabBudget where name=b.parent and company = %s)""", self.name)
+			frappe.db.sql("""delete from `tabBudget Account`
+				where exists(select name from tabBudget 
+					where name=`tabBudget Account`.parent and company = %s)""", self.name)
 			
 			for doctype in ["Account", "Cost Center", "Budget", "Party Account"]:
 				frappe.db.sql("delete from `tab{0}` where company = %s".format(doctype), self.name)
diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js
index 409f99b..c8e199b 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.js
+++ b/erpnext/setup/doctype/notification_control/notification_control.js
@@ -2,8 +2,11 @@
 // License: GNU General Public License v3. See license.txt
 
 frappe.ui.form.on("Notification Control", {
+	refresh: function(frm) {
+		frm.page.set_primary_action(__('Update'), function() { frm.events.set_message(frm); });
+	},
 	select_transaction: function(frm) {
-		frm.set_value("custom_message", frm.events.get_fieldname(frm));
+		frm.set_value("custom_message", frm.doc[frm.events.get_fieldname(frm)]);
 	},
 	set_message: function(frm) {
 		frm.set_value(frm.events.get_fieldname(frm), frm.doc.custom_message);
diff --git a/erpnext/setup/doctype/notification_control/notification_control.json b/erpnext/setup/doctype/notification_control/notification_control.json
index 904965e..540aa13 100644
--- a/erpnext/setup/doctype/notification_control/notification_control.json
+++ b/erpnext/setup/doctype/notification_control/notification_control.json
@@ -2,6 +2,7 @@
  "allow_copy": 1, 
  "allow_import": 0, 
  "allow_rename": 0, 
+ "beta": 0, 
  "creation": "2012-07-12 23:29:45", 
  "custom": 0, 
  "description": "Send automatic emails to Contacts on Submitting transactions.", 
@@ -17,12 +18,15 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Prompt for Email on Submission of", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -38,12 +42,15 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "50%", 
    "read_only": 0, 
    "report_hide": 0, 
@@ -61,12 +68,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Quotation", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -82,12 +92,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sales Order", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -103,12 +116,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Delivery Note", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -124,12 +140,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Sales Invoice", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -145,12 +164,15 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "50%", 
    "read_only": 0, 
    "report_hide": 0, 
@@ -168,12 +190,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Purchase Order", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -189,12 +214,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Purchase Receipt", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -210,12 +238,15 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Claim", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -232,12 +263,15 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Customize the Notification", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -253,13 +287,16 @@
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Select Transaction", 
+   "length": 0, 
    "no_copy": 0, 
    "options": "\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPurchase Order\nPurchase Receipt\nExpense Claim\nExpense Claim Approved\nExpense Claim Rejected", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -275,34 +312,15 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Custom Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "set_message", 
-   "fieldtype": "Button", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Update", 
-   "no_copy": 0, 
-   "options": "", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -318,12 +336,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Quotation Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -339,12 +360,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Order Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -360,12 +384,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Delivery Note Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -381,12 +408,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sales Invoice Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -402,12 +432,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Order Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -423,12 +456,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Purchase Receipt Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -444,12 +480,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Claim Approved Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -465,12 +504,15 @@
    "fieldtype": "Text", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Expense Claim Rejected Message", 
+   "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -488,7 +530,8 @@
  "is_submittable": 0, 
  "issingle": 1, 
  "istable": 0, 
- "modified": "2015-07-13 06:24:05.436127", 
+ "max_attachments": 0, 
+ "modified": "2016-06-01 13:06:06.981905", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Notification Control", 
@@ -515,6 +558,9 @@
    "write": 1
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index f26452d..e3e47ae 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -20,7 +20,7 @@
 
 	install_fixtures.install(args.get("country"))
 
-	# update_setup_wizard_access()
+	update_setup_wizard_access()
 	create_fiscal_year_and_company(args)
 	create_users(args)
 	set_defaults(args)
@@ -56,6 +56,8 @@
 			pass
 
 def update_setup_wizard_access():
+	if frappe.flags.in_test:
+		return
 	setup_wizard = frappe.get_doc('Page', 'setup-wizard')
 	for roles in setup_wizard.roles:
 		if roles.role == 'System Manager':
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
index 10bbcfe..390bc27 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
@@ -36,4 +36,6 @@
 		cart_settings.enabled = 1
 		if not frappe.db.get_value("Tax Rule", {"use_for_shopping_cart": 1}, "name"):
 			self.assertRaises(ShoppingCartSetupError, cart_settings.validate_tax_rule)
+			
+		frappe.db.sql("update `tabTax Rule` set use_for_shopping_cart = 1")
 
diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py
index a51852a..5282231 100644
--- a/erpnext/shopping_cart/test_shopping_cart.py
+++ b/erpnext/shopping_cart/test_shopping_cart.py
@@ -101,7 +101,7 @@
 		quotation = self.create_quotation()
 
 		from erpnext.accounts.party import set_taxes
-
+		
 		tax_rule_master = set_taxes(quotation.customer, "Customer", \
 			quotation.transaction_date, quotation.company, None, None, \
 			quotation.customer_address, quotation.shipping_address_name, 1)
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 99edb0f..33296ee 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -65,7 +65,7 @@
 		this.max_count = this.max_count;
 
 		// show more button
-		if(data.length===21) {
+		if(data && data.length===21) {
 			this.content.find('.more').removeClass('hidden');
 
 			// remove the last element
@@ -79,6 +79,7 @@
 	},
 	get_item_dashboard_data: function(data, max_count, show_item) {
 		if(!max_count) max_count = 0;
+		if(!data) data = [];
 		data.forEach(function(d) {
 			d.actual_or_pending = d.projected_qty + d.reserved_qty + d.reserved_qty_for_production;
 			d.pending_qty = 0;
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 9f2c60c..2d6dae2 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -148,6 +148,30 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "barcode", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Barcode", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "description": "", 
    "fieldname": "item_group", 
    "fieldtype": "Link", 
@@ -410,30 +434,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "barcode", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Barcode", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "description", 
    "fieldtype": "Text Editor", 
    "hidden": 0, 
@@ -2228,8 +2228,8 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 1, 
- "modified": "2016-05-12 15:33:02.407671", 
- "modified_by": "umair@erpnext.com", 
+ "modified": "2016-06-02 14:48:46.128121", 
+ "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
  "owner": "Administrator", 
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 9e48fed..bd2ada9 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -487,56 +487,59 @@
 		for variant_of in frappe.get_all("Item", filters={"variant_of": self.name}):
 			frappe.delete_doc("Item", variant_of.name)
 
-	def before_rename(self, olddn, newdn, merge=False):
+	def before_rename(self, old_name, new_name, merge=False):
+		if self.item_name==old_name:
+			self.item_name=new_name
+
 		if merge:
 			# Validate properties before merging
-			if not frappe.db.exists("Item", newdn):
-				frappe.throw(_("Item {0} does not exist").format(newdn))
+			if not frappe.db.exists("Item", new_name):
+				frappe.throw(_("Item {0} does not exist").format(new_name))
 
 			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)]
+			new_properties = [cstr(d) for d in frappe.db.get_value("Item", new_name, 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")
 					+ ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list]))
 
-			frappe.db.sql("delete from `tabBin` where item_code=%s", olddn)
+			frappe.db.sql("delete from `tabBin` where item_code=%s", old_name)
 
-	def after_rename(self, olddn, newdn, merge):
-		super(Item, self).after_rename(olddn, newdn, merge)
+	def after_rename(self, old_name, new_name, merge):
+		super(Item, self).after_rename(old_name, new_name, merge)
 		if self.page_name:
 			invalidate_cache_for_item(self)
 			clear_cache(self.page_name)
 
-		frappe.db.set_value("Item", newdn, "item_code", newdn)
+		frappe.db.set_value("Item", new_name, "item_code", new_name)
 
 		if merge:
-			self.set_last_purchase_rate(newdn)
-			self.recalculate_bin_qty(newdn)
+			self.set_last_purchase_rate(new_name)
+			self.recalculate_bin_qty(new_name)
 
 		for dt in ("Sales Taxes and Charges", "Purchase Taxes and Charges"):
 			for d in frappe.db.sql("""select name, item_wise_tax_detail from `tab{0}`
 					where ifnull(item_wise_tax_detail, '') != ''""".format(dt), as_dict=1):
 
 				item_wise_tax_detail = json.loads(d.item_wise_tax_detail)
-				if olddn in item_wise_tax_detail:
-					item_wise_tax_detail[newdn] = item_wise_tax_detail[olddn]
-					item_wise_tax_detail.pop(olddn)
+				if old_name in item_wise_tax_detail:
+					item_wise_tax_detail[new_name] = item_wise_tax_detail[old_name]
+					item_wise_tax_detail.pop(old_name)
 
 					frappe.db.set_value(dt, d.name, "item_wise_tax_detail",
 						json.dumps(item_wise_tax_detail), update_modified=False)
 
-	def set_last_purchase_rate(self, newdn):
-		last_purchase_rate = get_last_purchase_details(newdn).get("base_rate", 0)
-		frappe.db.set_value("Item", newdn, "last_purchase_rate", last_purchase_rate)
+	def set_last_purchase_rate(self, new_name):
+		last_purchase_rate = get_last_purchase_details(new_name).get("base_rate", 0)
+		frappe.db.set_value("Item", new_name, "last_purchase_rate", last_purchase_rate)
 
-	def recalculate_bin_qty(self, newdn):
+	def recalculate_bin_qty(self, new_name):
 		from erpnext.stock.stock_balance import repost_stock
 		frappe.db.auto_commit_on_many_writes = 1
 		existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
 		frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
 
 		for warehouse in frappe.db.sql("select name from `tabWarehouse`"):
-			repost_stock(newdn, warehouse[0])
+			repost_stock(new_name, warehouse[0])
 
 		frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
 		frappe.db.auto_commit_on_many_writes = 0
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index a66362d..47f5162 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -6,7 +6,8 @@
 import frappe
 
 from frappe.test_runner import make_test_records
-from erpnext.controllers.item_variant import create_variant, ItemVariantExistsError, InvalidItemAttributeValueError
+from erpnext.controllers.item_variant import (create_variant, ItemVariantExistsError,
+	InvalidItemAttributeValueError)
 
 test_ignore = ["BOM"]
 test_dependencies = ["Warehouse"]
@@ -86,6 +87,18 @@
 		for key, value in to_check.iteritems():
 			self.assertEquals(value, details.get(key))
 
+	def test_item_attribute_change_after_variant(self):
+		frappe.delete_doc_if_exists("Item", "_Test Variant Item-L", force=1)
+
+		variant = create_variant("_Test Variant Item", {"Test Size": "Large"})
+		variant.save()
+
+		attribute = frappe.get_doc('Item Attribute', 'Test Size')
+		attribute.item_attribute_values = []
+
+		self.assertRaises(InvalidItemAttributeValueError, attribute.save)
+		frappe.db.rollback()
+
 	def test_make_item_variant(self):
 		frappe.delete_doc_if_exists("Item", "_Test Variant Item-L", force=1)
 
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py
index f2d5345..7bcb21a 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.py
@@ -6,13 +6,27 @@
 from frappe.model.document import Document
 from frappe import _
 
+from erpnext.controllers.item_variant import InvalidItemAttributeValueError
+
+
 class ItemAttributeIncrementError(frappe.ValidationError): pass
 
 class ItemAttribute(Document):
+	def __setup__(self):
+		self.flags.ignore_these_exceptions_in_test = [InvalidItemAttributeValueError]
+
 	def validate(self):
 		self.validate_numeric()
 		self.validate_duplication()
-		self.validate_attribute_values()
+
+	def on_update(self):
+		self.validate_exising_items()
+
+	def validate_exising_items(self):
+		'''Validate that if there are existing items with attributes, they are valid'''
+		for item in frappe.db.sql('''select i.name from `tabItem Variant Attribute` iva, `tabItem` i
+			where iva.attribute = %s and iva.parent = i.name and i.has_variants = 0''', self.name):
+			frappe.get_doc('Item', item[0]).validate_variant_attributes()
 
 	def validate_numeric(self):
 		if self.numeric_values:
@@ -39,19 +53,3 @@
 			if d.abbr in abbrs:
 				frappe.throw(_("{0} must appear only once").format(d.abbr))
 			abbrs.append(d.abbr)
-
-	def validate_attribute_values(self):
-		# don't validate numeric values
-		if self.numeric_values:
-			return
-
-		attribute_values = []
-		for d in self.item_attribute_values:
-			attribute_values.append(d.attribute_value)
-
-		variant_attributes = frappe.db.sql("select DISTINCT attribute_value from `tabItem Variant Attribute` where attribute=%s", self.name)
-		if variant_attributes:
-			for d in variant_attributes:
-				if d[0] and d[0] not in attribute_values:
-					frappe.throw(_("Attribute Value {0} cannot be removed from {1} as Item Variants \
-						exist with this Attribute.").format(d[0], self.name))
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index a173ae8..7cea640 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -222,7 +222,8 @@
 							"against": warehouse_account[d.warehouse]["name"],
 							"cost_center": d.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-							"credit": flt(d.landed_cost_voucher_amount)
+							"credit": flt(d.landed_cost_voucher_amount),
+							"project": d.project
 						}))
 
 					# sub-contracting warehouse
@@ -253,7 +254,8 @@
 							"against": warehouse_account[d.warehouse]["name"],
 							"cost_center": d.cost_center,
 							"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
-							"debit": divisional_loss
+							"debit": divisional_loss,
+							"project": d.project
 						}, stock_rbnb_currency))
 
 				elif d.warehouse not in warehouse_with_no_account or \
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 737902b..69d9a76 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -67,7 +67,7 @@
 			}
 		});
 
-		if(!this.item_selector) {
+		if(!this.item_selector && false) {
 			this.item_selector = new erpnext.ItemSelector({frm: this.frm});
 		}
 	},
diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js
index 4a3376c..562a169 100644
--- a/erpnext/support/page/support_analytics/support_analytics.js
+++ b/erpnext/support/page/support_analytics/support_analytics.js
@@ -32,8 +32,13 @@
 		{fieldtype:"Date", label: __("From Date")},
 		{fieldtype:"Date", label: __("To Date")},
 		{fieldtype:"Select", label: __("Range"),
-			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]}
+			options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"], default_value: "Monthly"}
 	],
+	
+	init_filter_values: function() {
+		this._super();
+		this.filter_inputs.range.val('Monthly');
+	},
 
 	setup_columns: function() {
 		var std_columns = [
@@ -100,11 +105,5 @@
 		})
 
 		this.data = [total_tickets, days_to_close, hours_to_close, hours_to_respond];
-	},
-
-	get_plot_points: function(item, col, idx) {
-		return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]],
-			[dateutil.user_to_obj(col.name).getTime(), item[col.field]]];
 	}
-
 });
diff --git a/erpnext/utilities/doctype/address/address.json b/erpnext/utilities/doctype/address/address.json
index 558e0b7..8ccf205 100644
--- a/erpnext/utilities/doctype/address/address.json
+++ b/erpnext/utilities/doctype/address/address.json
@@ -2,6 +2,7 @@
  "allow_copy": 0, 
  "allow_import": 1, 
  "allow_rename": 1, 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:32", 
  "custom": 0, 
  "docstatus": 0, 
@@ -159,6 +160,31 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "county", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "County", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "state", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -183,30 +209,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "pincode", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Postal Code", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "country", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -232,6 +234,30 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "pincode", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 0, 
+   "label": "Postal Code", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 1, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "column_break0", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -644,7 +670,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-15 03:09:31.497272", 
+ "modified": "2016-05-30 14:20:47.284751", 
  "modified_by": "Administrator", 
  "module": "Utilities", 
  "name": "Address", 
diff --git a/setup.py b/setup.py
index 0185f02..a1088bd 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
 
-version = "6.27.19"
+version = "6.27.21"
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(