Merge pull request #5390 from MaxMorais/patch-5

get_address_display cannot be called directly
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 5324cde..2a30f12 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -1,7 +1,9 @@
-from erpnext.__version__ import __version__
-
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
 import frappe
 
+__version__ = '7.0.0-beta'
+
 def get_default_company(user=None):
 	'''Get default company for user'''
 	from frappe.defaults import get_user_default_as_list
@@ -21,4 +23,4 @@
 	'''Returns the currency of the default company'''
 	company = get_default_company()
 	if company:
-		return frappe.db.get_value('Company', company, 'default_currency')
\ No newline at end of file
+		return frappe.db.get_value('Company', company, 'default_currency')
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
deleted file mode 100644
index a62f0b3..0000000
--- a/erpnext/__version__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from __future__ import unicode_literals
-__version__ = '6.27.19'
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/account/chart_of_accounts/unverified/es_account_chart_template_common.json b/erpnext/accounts/doctype/account/chart_of_accounts/unverified/es_account_chart_template_common.json
index 3640b23..0910a71 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/unverified/es_account_chart_template_common.json
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/unverified/es_account_chart_template_common.json
@@ -1481,10 +1481,7 @@
                 }
             }, 
             "Deterioro del valor de inversiones financieras a corto plazo y de activos no corrientes mantenidos para la venta": {
-                "Deterioro de valor de activos no corrientes mantenidos para la venta": {
-                    "Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {
-                        "Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {}
-                    }, 
+                "Deterioro de valor de activos no corrientes mantenidos para la venta": { 
                     "Deterioro de valor de inmovilizado no corriente mantenido para la venta": {
                         "Deterioro de valor de inmovilizado no corriente mantenido para la venta": {}
                     }, 
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/payments/__init__.py b/erpnext/accounts/doctype/budget/__init__.py
similarity index 100%
rename from erpnext/accounts/doctype/payments/__init__.py
rename to erpnext/accounts/doctype/budget/__init__.py
diff --git a/erpnext/accounts/doctype/budget/budget.js b/erpnext/accounts/doctype/budget/budget.js
new file mode 100644
index 0000000..f6a2c88
--- /dev/null
+++ b/erpnext/accounts/doctype/budget/budget.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Budget', {
+	onload: function(frm) {
+		frm.set_query("cost_center", function() {
+			return {
+				filters: {
+					company: frm.doc.company
+				}
+			}
+		})
+		
+		frm.set_query("account", "accounts", function() {
+			return {
+				filters: {
+					company: frm.doc.company,
+					report_type: "Profit and Loss",
+					is_group: 0
+				}
+			}
+		})
+		
+		frm.set_query("monthly_distribution", function() {
+			return {
+				filters: {
+					fiscal_year: frm.doc.fiscal_year
+				}
+			}
+		})
+	}
+});
diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json
new file mode 100644
index 0000000..4946304
--- /dev/null
+++ b/erpnext/accounts/doctype/budget/budget.json
@@ -0,0 +1,314 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 1, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-05-16 11:42:29.632528", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "cost_center", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Cost Center", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Cost Center", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "fiscal_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Fiscal Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Fiscal Year", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "monthly_distribution", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Monthly Distribution", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Monthly Distribution", 
+   "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": "column_break_3", 
+   "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": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Stop", 
+   "fieldname": "action_if_annual_budget_exceeded", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Action if Annual Budget Exceeded", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nStop\nWarn\nIgnore", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": 1, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Warn", 
+   "description": "", 
+   "fieldname": "action_if_accumulated_monthly_budget_exceeded", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Action if Accumulated Monthly Budget Exceeded", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nStop\nWarn\nIgnore", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "company", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Company", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Company", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "amended_from", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amended From", 
+   "length": 0, 
+   "no_copy": 1, 
+   "options": "Budget", 
+   "permlevel": 0, 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_6", 
+   "fieldtype": "Section 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": "accounts", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Budget Accounts", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Budget Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 1, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-05-16 15:00:40.233685", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Budget", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 1, 
+   "apply_user_permissions": 0, 
+   "cancel": 1, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 1, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 1, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
new file mode 100644
index 0000000..819a635
--- /dev/null
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -0,0 +1,133 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import flt, getdate, add_months, get_last_day
+from frappe.model.naming import make_autoname
+from frappe.model.document import Document
+
+class BudgetError(frappe.ValidationError): pass
+class DuplicateBudgetError(frappe.ValidationError): pass
+
+class Budget(Document):
+	def autoname(self):
+		self.name = make_autoname(self.cost_center + "/" + self.fiscal_year + "/.###")
+
+	def validate(self):
+		self.validate_duplicate()
+		self.validate_accounts()
+
+	def validate_duplicate(self):
+		existing_budget = frappe.db.get_value("Budget", {"cost_center": self.cost_center,
+			"fiscal_year": self.fiscal_year, "company": self.company,
+			"name": ["!=", self.name], "docstatus": ["!=", 2]})
+		if existing_budget:
+			frappe.throw(_("Another Budget record {0} already exists against {1} for fiscal year {2}")
+				.format(existing_budget, self.cost_center, self.fiscal_year), DuplicateBudgetError)
+
+	def validate_accounts(self):
+		account_list = []
+		for d in self.get('accounts'):
+			if d.account:
+				account_details = frappe.db.get_value("Account", d.account,
+					["is_group", "company", "report_type"], as_dict=1)
+
+				if account_details.is_group:
+					frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
+				elif account_details.company != self.company:
+					frappe.throw(_("Account {0} does not belongs to company {1}")
+						.format(d.account, self.company))
+				elif account_details.report_type != "Profit and Loss":
+					frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account")
+						.format(d.account))
+
+				if d.account in account_list:
+					frappe.throw(_("Account {0} has been entered multiple times").format(d.account))
+				else:
+					account_list.append(d.account)
+
+def validate_expense_against_budget(args):
+	args = frappe._dict(args)
+	if frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
+		cc_lft, cc_rgt = frappe.db.get_value("Cost Center", args.cost_center, ["lft", "rgt"])
+
+		budget_records = frappe.db.sql("""
+			select ba.budget_amount, b.monthly_distribution, b.cost_center,
+				b.action_if_annual_budget_exceeded, b.action_if_accumulated_monthly_budget_exceeded
+			from `tabBudget` b, `tabBudget Account` ba
+			where
+				b.name=ba.parent and b.fiscal_year=%s and ba.account=%s and b.docstatus=1
+				and exists(select name from `tabCost Center` where lft<=%s and rgt>=%s and name=b.cost_center)
+		""", (args.fiscal_year, args.account, cc_lft, cc_rgt), as_dict=True)
+
+		for budget in budget_records:
+			if budget.budget_amount:
+				yearly_action = budget.action_if_annual_budget_exceeded
+				monthly_action = budget.action_if_accumulated_monthly_budget_exceeded
+
+				if monthly_action in ["Stop", "Warn"]:
+					budget_amount = get_accumulated_monthly_budget(budget.monthly_distribution,
+						args.posting_date, args.fiscal_year, budget.budget_amount)
+
+					args["month_end_date"] = get_last_day(args.posting_date)
+
+					compare_expense_with_budget(args, budget.cost_center,
+						budget_amount, _("Accumulated Monthly"), monthly_action)
+
+				elif yearly_action in ["Stop", "Warn"]:
+					compare_expense_with_budget(args, budget.cost_center,
+						flt(budget.budget_amount), _("Annual"), yearly_action)
+
+def compare_expense_with_budget(args, cost_center, budget_amount, action_for, action):
+	actual_expense = get_actual_expense(args, cost_center)
+	if actual_expense > budget_amount:
+		diff = actual_expense - budget_amount
+
+		msg = _("{0} Budget for Account {1} against Cost Center {2} is {3}. It will exceed by {4}").format(_(action_for), args.account, cost_center, budget_amount, diff)
+
+		if action=="Stop":
+			frappe.throw(msg, BudgetError)
+		else:
+			frappe.msgprint(msg)
+
+def get_accumulated_monthly_budget(monthly_distribution, posting_date, fiscal_year, annual_budget):
+	distribution = {}
+	if monthly_distribution:
+		for d in frappe.db.sql("""select mdp.month, mdp.percentage_allocation
+			from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
+			where mdp.parent=md.name and md.fiscal_year=%s""", fiscal_year, as_dict=1):
+				distribution.setdefault(d.month, d.percentage_allocation)
+
+	dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date")
+	accumulated_percentage = 0.0
+
+	while(dt <= getdate(posting_date)):
+		if monthly_distribution:
+			accumulated_percentage += distribution.get(getdate(dt).strftime("%B"), 0)
+		else:
+			accumulated_percentage += 100.0/12
+
+		dt = add_months(dt, 1)
+
+	return annual_budget * accumulated_percentage / 100
+
+def get_actual_expense(args, cost_center):
+	lft_rgt = frappe.db.get_value("Cost Center", cost_center, ["lft", "rgt"], as_dict=1)
+	args.update(lft_rgt)
+
+	condition = " and gle.posting_date <= %(month_end_date)s" if args.get("month_end_date") else ""
+
+	return flt(frappe.db.sql("""
+		select sum(gle.debit) - sum(gle.credit)
+		from `tabGL Entry` gle
+		where gle.account=%(account)s
+			and exists(select name from `tabCost Center`
+				where lft>=%(lft)s and rgt<=%(rgt)s and name=gle.cost_center)
+			and gle.fiscal_year=%(fiscal_year)s
+			and gle.company=%(company)s
+			and gle.docstatus=1
+			{condition}
+	""".format(condition=condition), (args))[0][0])
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py
new file mode 100644
index 0000000..78f5690
--- /dev/null
+++ b/erpnext/accounts/doctype/budget/test_budget.py
@@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
+from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+
+class TestBudget(unittest.TestCase):		
+	def test_monthly_budget_crossed_ignore(self):
+		set_total_expense_zero("2013-02-28")
+
+		budget = make_budget()
+		
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", submit=True)
+
+		self.assertTrue(frappe.db.get_value("GL Entry",
+			{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
+			
+		budget.cancel()
+
+	def test_monthly_budget_crossed_stop(self):
+		set_total_expense_zero("2013-02-28")
+
+		budget = make_budget()
+		
+		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
+
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
+
+		self.assertRaises(BudgetError, jv.submit)
+		
+		budget.load_from_db()
+		budget.cancel()
+
+	def test_yearly_budget_crossed_stop(self):
+		set_total_expense_zero("2013-02-28")
+
+		budget = make_budget()
+		
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC")
+
+		self.assertRaises(BudgetError, jv.submit)
+		
+		budget.cancel()
+
+	def test_monthly_budget_on_cancellation(self):
+		set_total_expense_zero("2013-02-28")
+
+		budget = make_budget()
+				
+		jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
+
+		self.assertTrue(frappe.db.get_value("GL Entry",
+			{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
+
+		jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
+
+		self.assertTrue(frappe.db.get_value("GL Entry",
+			{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
+
+		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
+		
+		self.assertRaises(BudgetError, jv1.cancel)
+		
+		budget.load_from_db()
+		budget.cancel()
+		
+	def test_monthly_budget_against_group_cost_center(self):
+		set_total_expense_zero("2013-02-28")
+		set_total_expense_zero("2013-02-28", "_Test Cost Center 2 - _TC")
+		
+		budget = make_budget("_Test Company - _TC")
+		frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
+
+		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+			"_Test Bank - _TC", 40000, "_Test Cost Center 2 - _TC")
+
+		self.assertRaises(BudgetError, jv.submit)
+		
+		budget.load_from_db()
+		budget.cancel()
+
+def set_total_expense_zero(posting_date, cost_center=None):
+	existing_expense = get_actual_expense({
+		"account": "_Test Account Cost for Goods Sold - _TC",
+		"cost_center": cost_center or "_Test Cost Center - _TC",
+		"monthly_end_date": posting_date,
+		"company": "_Test Company",
+		"fiscal_year": "_Test Fiscal Year 2013"
+	}, cost_center or "_Test Cost Center - _TC")
+	
+	make_journal_entry("_Test Account Cost for Goods Sold - _TC",
+		"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
+		
+def make_budget(cost_center=None):
+	budget = frappe.new_doc("Budget")
+	budget.cost_center = cost_center or "_Test Cost Center - _TC"
+	budget.fiscal_year = "_Test Fiscal Year 2013"
+	budget.monthly_distribution = "_Test Distribution"
+	budget.company = "_Test Company"
+	budget.action_if_annual_budget_exceeded = "Stop"
+	budget.action_if_accumulated_monthly_budget_exceeded = "Ignore"
+	
+	budget.append("accounts", {
+		"account": "_Test Account Cost for Goods Sold - _TC",
+		"budget_amount": 100000
+	})
+	
+	budget.insert()
+	budget.submit()
+
+	return budget
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payments/__init__.py b/erpnext/accounts/doctype/budget_account/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/payments/__init__.py
copy to erpnext/accounts/doctype/budget_account/__init__.py
diff --git a/erpnext/accounts/doctype/budget_account/budget_account.json b/erpnext/accounts/doctype/budget_account/budget_account.json
new file mode 100644
index 0000000..e27af68
--- /dev/null
+++ b/erpnext/accounts/doctype/budget_account/budget_account.json
@@ -0,0 +1,86 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "beta": 0, 
+ "creation": "2016-05-16 11:54:09.286135", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "account", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Account", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Account", 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "budget_amount", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Budget Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 1, 
+ "max_attachments": 0, 
+ "modified": "2016-05-30 17:57:03.483750", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Budget Account", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payments/payments.py b/erpnext/accounts/doctype/budget_account/budget_account.py
similarity index 88%
rename from erpnext/accounts/doctype/payments/payments.py
rename to erpnext/accounts/doctype/budget_account/budget_account.py
index 15cf0b2..81b2709 100644
--- a/erpnext/accounts/doctype/payments/payments.py
+++ b/erpnext/accounts/doctype/budget_account/budget_account.py
@@ -6,5 +6,5 @@
 import frappe
 from frappe.model.document import Document
 
-class Payments(Document):
+class BudgetAccount(Document):
 	pass
diff --git a/erpnext/accounts/doctype/budget_detail/README.md b/erpnext/accounts/doctype/budget_detail/README.md
deleted file mode 100644
index 42c7621..0000000
--- a/erpnext/accounts/doctype/budget_detail/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Budget amounts for year and distribution for parent Cost Center.
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_detail/__init__.py b/erpnext/accounts/doctype/budget_detail/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/accounts/doctype/budget_detail/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.json b/erpnext/accounts/doctype/budget_detail/budget_detail.json
deleted file mode 100644
index 99d3919..0000000
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.json
+++ /dev/null
@@ -1,106 +0,0 @@
-{
- "allow_copy": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "hash", 
- "creation": "2013-03-07 11:55:04", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "fields": [
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "budget_allocated", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Budget Allocated", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "budget_allocated", 
-   "oldfieldtype": "Currency", 
-   "options": "Company:company:default_currency", 
-   "permlevel": 0, 
-   "print_hide": 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": "fiscal_year", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 1, 
-   "label": "Fiscal Year", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "fiscal_year", 
-   "oldfieldtype": "Select", 
-   "options": "Fiscal Year", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "unique": 0
-  }
- ], 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "idx": 1, 
- "in_create": 0, 
- "in_dialog": 0, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 1, 
- "max_attachments": 0, 
- "modified": "2015-11-16 06:29:43.050558", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Budget Detail", 
- "owner": "Administrator", 
- "permissions": [], 
- "read_only": 0, 
- "read_only_onload": 0, 
- "sort_field": "modified", 
- "sort_order": "DESC"
-}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget_detail/budget_detail.py b/erpnext/accounts/doctype/budget_detail/budget_detail.py
deleted file mode 100644
index f11ec9c..0000000
--- a/erpnext/accounts/doctype/budget_detail/budget_detail.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
-
-class BudgetDetail(Document):
-	pass
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payments/__init__.py b/erpnext/accounts/doctype/cheque_print_template/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/payments/__init__.py
copy to erpnext/accounts/doctype/cheque_print_template/__init__.py
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
new file mode 100644
index 0000000..dea3af6
--- /dev/null
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.js
@@ -0,0 +1,74 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.provide("erpnext.cheque_print");
+
+frappe.ui.form.on('Cheque Print Template', {
+	refresh: function(frm) {
+		if(!frm.doc.__islocal) {
+			frm.add_custom_button(frm.doc.has_print_format?__("Update Print Format"):__("Create Print Format"),
+				function() {
+					erpnext.cheque_print.view_cheque_print(frm);
+				}).addClass("btn-primary");
+				
+			$(frm.fields_dict.cheque_print_preview.wrapper).empty()
+				
+				
+			var template = '<div style="position: relative; overflow-x: scroll;">\
+				<div id="cheque_preview" style="width: {{ cheque_width }}cm; \
+					height: {{ cheque_height }}cm;\
+					background-image: url({{ scanned_cheque }});\
+					background-repeat: no-repeat;\
+					background-size: cover;">\
+					<span style="top: {{ acc_pay_dist_from_top_edge }}cm;\
+						left: {{ acc_pay_dist_from_left_edge }}cm;\
+						border-bottom: solid 1px;border-top:solid 1px;\
+						position: absolute;"> {{ message_to_show || __("Account Pay Only") }} </span>\
+					<span style="top: {{ date_dist_from_top_edge }}cm;\
+						left: {{ date_dist_from_left_edge }}cm;\
+						position: absolute;"> {{ frappe.datetime.obj_to_user() }} </span>\
+					<span style="top: {{ acc_no_dist_from_top_edge }}cm;\
+						left: {{ acc_no_dist_from_left_edge }}cm;\
+						position: absolute;"> Acc. No. </span>\
+					<span style="top: {{ payer_name_from_top_edge }}cm;\
+						left: {{ payer_name_from_left_edge }}cm;\
+						position: absolute;"> Payer Name </span>\
+					<span style="top:{{ amt_in_words_from_top_edge }}cm;\
+						left: {{ amt_in_words_from_left_edge }}cm;\
+						position: absolute;\
+						display: block;\
+						width: {{ amt_in_word_width }}cm;\
+						line-height: {{ amt_in_words_line_spacing }}cm;\
+						word-wrap: break-word;"> Amount in Words </span>\
+					<span style="top: {{ amt_in_figures_from_top_edge }}cm;\
+						left: {{ amt_in_figures_from_left_edge }}cm;\
+						position: absolute;"> 1000 </span>\
+					<span style="top: {{ signatory_from_top_edge }}cm;\
+						left: {{ signatory_from_left_edge }}cm;\
+						position: absolute;"> Signatory Name </span>\
+				</div>\
+			</div>';
+			
+			$(frappe.render(template, frm.doc)).appendTo(frm.fields_dict.cheque_print_preview.wrapper)
+		}
+	}
+});
+
+
+erpnext.cheque_print.view_cheque_print = function(frm) {
+	frappe.call({
+		method: "erpnext.accounts.doctype.cheque_print_template.cheque_print_template.create_or_update_cheque_print_format",
+		args:{
+			"template_name": frm.doc.name
+		},
+		callback: function(r) {
+			if (!r.exe && !frm.doc.has_print_format) {
+				var doc = frappe.model.sync(r.message);
+				frappe.set_route("Form", r.message.doctype, r.message.name);
+			}
+			else {
+				frappe.msgprint(__("Print settings updated in respective print format"))
+			}
+		}
+	})
+}
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
new file mode 100644
index 0000000..9cec920
--- /dev/null
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.json
@@ -0,0 +1,1079 @@
+{
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "field:bank_name", 
+ "beta": 0, 
+ "creation": "2016-05-04 14:35:00.402544", 
+ "custom": 0, 
+ "docstatus": 0, 
+ "doctype": "DocType", 
+ "document_type": "", 
+ "fields": [
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "", 
+   "fieldname": "settings", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "<div>\n<h3> All dimensions in centimeter only </h3>\n</div>", 
+   "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": "has_print_format", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Has Print Format", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "primary_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Primary Settings", 
+   "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": "bank_name", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Bank Name", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "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": "cheque_size", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Cheque Size", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nRegular\nA4", 
+   "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, 
+   "depends_on": "eval:doc.cheque_size==\"A4\"", 
+   "fieldname": "starting_position_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting position from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "cheque_width", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Cheque Width", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "cheque_height", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Cheque Height", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "scanned_cheque", 
+   "fieldtype": "Attach", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Scanned Cheque", 
+   "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": "column_break_5", 
+   "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": "is_account_payable", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Is Account Payable", 
+   "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, 
+   "depends_on": "eval:doc.is_account_payable", 
+   "fieldname": "acc_pay_dist_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "eval:doc.is_account_payable", 
+   "fieldname": "acc_pay_dist_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "eval:doc.is_account_payable", 
+   "fieldname": "message_to_show", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Message to show", 
+   "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": "date_and_payer_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "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": "date_settings", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Date Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "<label class=\"control-label\" style=\"margin-bottom: 0px;\">Date Settings</label>", 
+   "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": "date_dist_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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, 
+   "depends_on": "", 
+   "fieldname": "date_dist_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "payer_settings", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Payer Settings", 
+   "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": "payer_name_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "payer_name_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amount_in_words_and_figure_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "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": "html_19", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "<label class=\"control-label\" style=\"margin-bottom: 0px;\">Amount In Words</label>", 
+   "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": "amt_in_words_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amt_in_words_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amt_in_word_width", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Width of amount in word", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amt_in_words_line_spacing", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Line spacing for amount in words", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amount_in_figure", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount In Figure", 
+   "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": "amt_in_figures_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "amt_in_figures_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "account_number_and_signatory_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "", 
+   "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": "account_no_settings", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "<label class=\"control-label\" style=\"margin-bottom: 0px;\">Account Number Settings</label>", 
+   "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": "acc_no_dist_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "acc_no_dist_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "signatory_position", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Signatory Position", 
+   "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": "signatory_from_top_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Distance from top edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "signatory_from_left_edge", 
+   "fieldtype": "Float", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Starting location from left edge", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "2", 
+   "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": "preview", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Preview", 
+   "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": "cheque_print_preview", 
+   "fieldtype": "HTML", 
+   "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
+  }
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "idx": 0, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 1, 
+ "modified": "2016-05-19 13:30:26.754096", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Cheque Print Template", 
+ "name_case": "", 
+ "owner": "Administrator", 
+ "permissions": [
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "System Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }, 
+  {
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 1, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts User", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
+   "write": 1
+  }
+ ], 
+ "quick_entry": 0, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
new file mode 100644
index 0000000..14543c4
--- /dev/null
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+from frappe import _
+
+class ChequePrintTemplate(Document):
+	pass
+
+@frappe.whitelist()
+def create_or_update_cheque_print_format(template_name):
+	if not frappe.db.exists("Print Format", template_name):
+		cheque_print = frappe.new_doc("Print Format")
+		cheque_print.update({
+			"doc_type": "Journal Entry",
+			"standard": "No",
+			"custom_format": 1,
+			"print_format_type": "Server",
+			"name": template_name
+		})
+	else:
+		cheque_print = frappe.get_doc("Print Format", template_name)
+	
+	doc = frappe.get_doc("Cheque Print Template", template_name)
+	
+	cheque_print.html = """
+<div style="position: relative; top:%(starting_position_from_top_edge)scm">
+	<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
+		<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
+			border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
+				%(message_to_show)s
+		</span>
+		<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
+			position: absolute;">
+			{{doc.cheque_date or '' }}
+		</span>
+		<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
+			position: absolute;">
+			{{ doc.account_no }}
+		</span>
+		<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
+			position: absolute;">
+			{{doc.pay_to_recd_from}}
+		</span>
+		<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
+			position: absolute; display: block; width: %(amt_in_word_width)scm;
+			line-height:%(amt_in_words_line_spacing)scm; word-wrap: break-word;">
+				{{doc.total_amount_in_words}}
+		</span>
+		<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
+			position: absolute;">
+			{{doc.get_formatted("total_amount")}}
+		</span>
+		<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
+			position: absolute;">
+			{{doc.company}}
+		</span>
+	</div>
+</div>"""%{
+		"starting_position_from_top_edge": doc.starting_position_from_top_edge \
+			if doc.cheque_size == "A4" else 0.0,
+		"cheque_width": doc.cheque_width, "cheque_height": doc.cheque_height,
+		"acc_pay_dist_from_top_edge": doc.acc_pay_dist_from_top_edge,
+		"acc_pay_dist_from_left_edge": doc.acc_pay_dist_from_left_edge,
+		"message_to_show": doc.message_to_show if doc.message_to_show else _("Account Pay Only"),
+		"date_dist_from_top_edge": doc.date_dist_from_top_edge,
+		"date_dist_from_left_edge": doc.date_dist_from_left_edge,
+		"acc_no_dist_from_top_edge": doc.acc_no_dist_from_top_edge,
+		"acc_no_dist_from_left_edge": doc.acc_no_dist_from_left_edge,
+		"payer_name_from_top_edge": doc.payer_name_from_top_edge,
+		"payer_name_from_left_edge": doc.payer_name_from_left_edge,
+		"amt_in_words_from_top_edge": doc.amt_in_words_from_top_edge,
+		"amt_in_words_from_left_edge": doc.amt_in_words_from_left_edge,
+		"amt_in_word_width": doc.amt_in_word_width,
+		"amt_in_words_line_spacing": doc.amt_in_words_line_spacing,
+		"amt_in_figures_from_top_edge": doc.amt_in_figures_from_top_edge,
+		"amt_in_figures_from_left_edge": doc.amt_in_figures_from_left_edge,
+		"signatory_from_top_edge": doc.signatory_from_top_edge,
+		"signatory_from_left_edge": doc.signatory_from_left_edge
+	}
+		
+	cheque_print.save(ignore_permissions=True)
+	
+	frappe.db.set_value("Cheque Print Template", template_name, "has_print_format", 1)
+		
+	return cheque_print
diff --git a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
new file mode 100644
index 0000000..fa9c5b5
--- /dev/null
+++ b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Cheque Print Template')
+
+class TestChequePrintTemplate(unittest.TestCase):
+	pass
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js
index f66459b..85a6052 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.js
+++ b/erpnext/accounts/doctype/cost_center/cost_center.js
@@ -5,36 +5,19 @@
 
 cur_frm.list_route = "Accounts Browser/Cost Center";
 
-erpnext.accounts.CostCenterController = frappe.ui.form.Controller.extend({
-	onload: function() {
-		this.setup_queries();
-	},
 
-	setup_queries: function() {
-		var me = this;
-		if(this.frm.fields_dict["budgets"].grid.get_field("account")) {
-			this.frm.set_query("account", "budgets", function() {
-				return {
-					filters:[
-						['Account', 'company', '=', me.frm.doc.company],
-						['Account', 'is_group', '=', '0']
-					]
-				}
-			});
-		}
-
-		this.frm.set_query("parent_cost_center", function() {
+frappe.ui.form.on('Cost Center', {
+	onload: function(frm) {
+		frm.set_query("parent_cost_center", function() {
 			return {
-				filters:[
-					['Cost Center', 'is_group', '=', '1'],
-					['Cost Center', 'company', '=', me.frm.doc.company],
-				]
+				filters: {
+					company: frm.doc.company,
+					is_group: 1
+				}
 			}
-		});
+		})
 	}
-});
-
-$.extend(cur_frm.cscript, new erpnext.accounts.CostCenterController({frm: cur_frm}));
+})
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	var intro_txt = '';
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.json b/erpnext/accounts/doctype/cost_center/cost_center.json
index 6efdf99..5f78a5b 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.json
+++ b/erpnext/accounts/doctype/cost_center/cost_center.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:cost_center_name", 
+ "beta": 0, 
  "creation": "2013-01-23 19:57:17", 
  "custom": 0, 
  "description": "Track separate Income and Expense for product verticals or divisions.", 
@@ -168,87 +169,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "description": "Define Budget for this Cost Center. To set budget action, see \"Company List\"", 
-   "fieldname": "sb1", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Budget", 
-   "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": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "Select Monthly Distribution, if you want to track based on seasonality.", 
-   "fieldname": "distribution_id", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Distribution Id", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "distribution_id", 
-   "oldfieldtype": "Link", 
-   "options": "Monthly Distribution", 
-   "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": "Add rows to set annual budgets on Accounts.", 
-   "fieldname": "budgets", 
-   "fieldtype": "Table", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Budgets", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "budget_details", 
-   "oldfieldtype": "Table", 
-   "options": "Budget Detail", 
-   "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": "lft", 
    "fieldtype": "Int", 
    "hidden": 1, 
@@ -336,7 +256,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-14 15:59:51.508268", 
+ "modified": "2016-05-16 15:23:14.770933", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Cost Center", 
@@ -443,8 +363,11 @@
    "write": 0
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "search_fields": "parent_cost_center, is_group", 
+ "sort_order": "ASC", 
+ "track_seen": 0, 
  "version": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 072bf60..12d5e19 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -16,36 +16,12 @@
 
 	def validate(self):
 		self.validate_mandatory()
-		self.validate_accounts()
 
 	def validate_mandatory(self):
 		if self.cost_center_name != self.company and not self.parent_cost_center:
 			frappe.throw(_("Please enter parent cost center"))
 		elif self.cost_center_name == self.company and self.parent_cost_center:
 			frappe.throw(_("Root cannot have a parent cost center"))
-			
-	def validate_accounts(self):
-		if self.is_group==1 and self.get("budgets"):
-			frappe.throw(_("Budget cannot be set for Group Cost Center"))
-			
-		check_acc_list = []
-		for d in self.get('budgets'):
-			if d.account:
-				account_details = frappe.db.get_value("Account", d.account, 
-					["is_group", "company", "report_type"], as_dict=1)
-				if account_details.is_group:
-					frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
-				elif account_details.company != self.company:
-					frappe.throw(_("Account {0} does not belongs to company {1}").format(d.account, self.company))
-				elif account_details.report_type != "Profit and Loss":
-					frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account")
-						.format(d.account))
-
-				if [d.account, d.fiscal_year] in check_acc_list:
-					frappe.throw(_("Account {0} has been entered more than once for fiscal year {1}")
-						.format(d.account, d.fiscal_year))
-				else:
-					check_acc_list.append([d.account, d.fiscal_year])
 
 	def convert_group_to_ledger(self):
 		if self.check_if_child_exists():
diff --git a/erpnext/accounts/doctype/cost_center/test_records.json b/erpnext/accounts/doctype/cost_center/test_records.json
index 129f0db..941a85b 100644
--- a/erpnext/accounts/doctype/cost_center/test_records.json
+++ b/erpnext/accounts/doctype/cost_center/test_records.json
@@ -1,17 +1,7 @@
 [
  {
-  "budgets": [
-   {
-    "account": "_Test Account Cost for Goods Sold - _TC",
-    "budget_allocated": 100000,
-    "doctype": "Budget Detail",
-    "fiscal_year": "_Test Fiscal Year 2013",
-    "parentfield": "budgets"
-   }
-  ],
   "company": "_Test Company",
   "cost_center_name": "_Test Cost Center",
-  "distribution_id": "_Test Distribution",
   "doctype": "Cost Center",
   "is_group": 0,
   "parent_cost_center": "_Test Company - _TC"
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/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
index bad7f98..3e609ce 100644
--- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
@@ -4,7 +4,6 @@
 from __future__ import unicode_literals
 import unittest, frappe
 from frappe.utils import flt
-from erpnext.accounts.utils import get_actual_expense, BudgetError, get_fiscal_year
 from erpnext.exceptions import InvalidAccountCurrency
 
 
@@ -96,78 +95,6 @@
 
 		set_perpetual_inventory(0)
 
-	def test_monthly_budget_crossed_ignore(self):
-		frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
-
-		self.set_total_expense_zero("2013-02-28")
-
-		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", submit=True)
-
-		self.assertTrue(frappe.db.get_value("GL Entry",
-			{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
-
-	def test_monthly_budget_crossed_stop(self):
-		frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
-
-		self.set_total_expense_zero("2013-02-28")
-
-		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
-
-		self.assertRaises(BudgetError, jv.submit)
-
-		frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
-
-	def test_yearly_budget_crossed_stop(self):
-		self.test_monthly_budget_crossed_ignore()
-
-		frappe.db.set_value("Company", "_Test Company", "yearly_bgt_flag", "Stop")
-
-		self.set_total_expense_zero("2013-02-28")
-
-		jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 150000, "_Test Cost Center - _TC")
-
-		self.assertRaises(BudgetError, jv.submit)
-
-		frappe.db.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
-
-	def test_monthly_budget_on_cancellation(self):
-		self.set_total_expense_zero("2013-02-28")
-
-		jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
-
-		self.assertTrue(frappe.db.get_value("GL Entry",
-			{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
-
-		jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
-
-		self.assertTrue(frappe.db.get_value("GL Entry",
-			{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
-
-		frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
-
-		self.assertRaises(BudgetError, jv1.cancel)
-
-		frappe.db.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
-
-	def get_actual_expense(self, monthly_end_date):
-		return get_actual_expense({
-			"account": "_Test Account Cost for Goods Sold - _TC",
-			"cost_center": "_Test Cost Center - _TC",
-			"monthly_end_date": monthly_end_date,
-			"company": "_Test Company",
-			"fiscal_year": get_fiscal_year(monthly_end_date)[0]
-		})
-
-	def set_total_expense_zero(self, posting_date):
-		existing_expense = self.get_actual_expense(posting_date)
-		make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
-
 	def test_multi_currency(self):
 		jv = make_journal_entry("_Test Bank USD - _TC",
 			"_Test Bank - _TC", 100, exchange_rate=50, save=False)
@@ -245,9 +172,9 @@
 
 		jv.submit()
 
-def make_journal_entry(account1, account2, amount, cost_center=None, exchange_rate=1, save=True, submit=False):
+def make_journal_entry(account1, account2, amount, cost_center=None, posting_date=None, exchange_rate=1, save=True, submit=False):
 	jv = frappe.new_doc("Journal Entry")
-	jv.posting_date = "2013-02-14"
+	jv.posting_date = posting_date or "2013-02-14"
 	jv.company = "_Test Company"
 	jv.user_remark = "test"
 	jv.multi_currency = 1
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/monthly_distribution/monthly_distribution.json b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
index 096e12b..377a95c 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.json
@@ -1,156 +1,159 @@
 {
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "autoname": "field:distribution_id",
- "creation": "2013-01-10 16:34:05",
- "custom": 0,
- "description": "**Monthly Distribution** helps you distribute your budget across months if you have seasonality in your business.\n\nTo distribute a budget using this distribution, set this **Monthly Distribution** in the **Cost Center**",
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_copy": 0, 
+ "allow_import": 0, 
+ "allow_rename": 0, 
+ "autoname": "field:distribution_id", 
+ "beta": 0, 
+ "creation": "2013-01-10 16:34:05", 
+ "custom": 0, 
+ "description": "**Monthly Distribution** helps you distribute the Budget/Target across months if you have seasonality in your business.", 
+ "docstatus": 0, 
+ "doctype": "DocType", 
  "fields": [
   {
-   "allow_on_submit": 0,
-   "bold": 0,
-   "collapsible": 0,
-   "description": "Name of the Monthly Distribution",
-   "fieldname": "distribution_id",
-   "fieldtype": "Data",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 1,
-   "label": "Distribution Name",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "distribution_id",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "description": "Name of the Monthly Distribution", 
+   "fieldname": "distribution_id", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 1, 
+   "label": "Distribution Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "distribution_id", 
+   "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": "fiscal_year",
-   "fieldtype": "Link",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 1,
-   "in_list_view": 1,
-   "label": "Fiscal Year",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "fiscal_year",
-   "oldfieldtype": "Select",
-   "options": "Fiscal Year",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "fiscal_year", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 1, 
+   "in_list_view": 1, 
+   "label": "Fiscal Year", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "fiscal_year", 
+   "oldfieldtype": "Select", 
+   "options": "Fiscal Year", 
+   "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": "percentages",
-   "fieldtype": "Table",
-   "hidden": 0,
-   "ignore_user_permissions": 0,
-   "ignore_xss_filter": 0,
-   "in_filter": 0,
-   "in_list_view": 0,
-   "label": "Monthly Distribution Percentages",
-   "length": 0,
-   "no_copy": 0,
-   "oldfieldname": "budget_distribution_details",
-   "oldfieldtype": "Table",
-   "options": "Monthly Distribution Percentage",
-   "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,
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "percentages", 
+   "fieldtype": "Table", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Monthly Distribution Percentages", 
+   "length": 0, 
+   "no_copy": 0, 
+   "oldfieldname": "budget_distribution_details", 
+   "oldfieldtype": "Table", 
+   "options": "Monthly Distribution Percentage", 
+   "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
   }
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "icon": "icon-bar-chart",
- "idx": 1,
- "in_create": 0,
- "in_dialog": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2016-03-03 02:46:44.493857",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Monthly Distribution",
- "name_case": "Title Case",
- "owner": "Administrator",
+ ], 
+ "hide_heading": 0, 
+ "hide_toolbar": 0, 
+ "icon": "icon-bar-chart", 
+ "idx": 1, 
+ "in_create": 0, 
+ "in_dialog": 0, 
+ "is_submittable": 0, 
+ "issingle": 0, 
+ "istable": 0, 
+ "max_attachments": 0, 
+ "modified": "2016-05-16 16:35:20.349194", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Monthly Distribution", 
+ "name_case": "Title Case", 
+ "owner": "Administrator", 
  "permissions": [
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 1,
-   "delete": 1,
-   "email": 1,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 0,
-   "print": 1,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "set_user_permissions": 0,
-   "share": 1,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 1, 
+   "delete": 1, 
+   "email": 1, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 0, 
+   "print": 1, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 1, 
+   "submit": 0, 
    "write": 1
-  },
+  }, 
   {
-   "amend": 0,
-   "apply_user_permissions": 0,
-   "cancel": 0,
-   "create": 0,
-   "delete": 0,
-   "email": 0,
-   "export": 0,
-   "if_owner": 0,
-   "import": 0,
-   "permlevel": 2,
-   "print": 0,
-   "read": 1,
-   "report": 1,
-   "role": "Accounts Manager",
-   "set_user_permissions": 0,
-   "share": 0,
-   "submit": 0,
+   "amend": 0, 
+   "apply_user_permissions": 0, 
+   "cancel": 0, 
+   "create": 0, 
+   "delete": 0, 
+   "email": 0, 
+   "export": 0, 
+   "if_owner": 0, 
+   "import": 0, 
+   "permlevel": 2, 
+   "print": 0, 
+   "read": 1, 
+   "report": 1, 
+   "role": "Accounts Manager", 
+   "set_user_permissions": 0, 
+   "share": 0, 
+   "submit": 0, 
    "write": 0
   }
- ],
- "read_only": 0,
- "read_only_onload": 0,
- "sort_field": "modified",
- "sort_order": "DESC"
-}
+ ], 
+ "quick_entry": 1, 
+ "read_only": 0, 
+ "read_only_onload": 0, 
+ "sort_field": "modified", 
+ "sort_order": "DESC", 
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json
index df8eaeb..91089af 100644
--- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json
+++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.json
@@ -16,6 +16,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Payment Gateway", 
@@ -41,6 +42,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Is Default", 
@@ -65,6 +67,7 @@
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "length": 0, 
@@ -88,6 +91,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Payment Account", 
@@ -113,6 +117,7 @@
    "fieldtype": "Read Only", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Currency", 
@@ -138,6 +143,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -160,9 +166,10 @@
    "collapsible": 0, 
    "default": "Please click on the link below to make your payment", 
    "fieldname": "message", 
-   "fieldtype": "Text Editor", 
+   "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Default Payment Request Message", 
@@ -183,16 +190,17 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "default": "Click here to make a payment", 
-   "fieldname": "payment_url_message", 
-   "fieldtype": "Data", 
+   "fieldname": "message_examples", 
+   "fieldtype": "HTML", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Payment URL Message", 
+   "label": "Message Examples", 
    "length": 0, 
    "no_copy": 0, 
+   "options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt; Thank You for being a part of {{ doc.company }}! We hope you are enjoying the service.&lt;/p&gt;\n\n&lt;p&gt; Please find enclosed the E Bill statement. The outstanding amount is {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;p&gt; We don't want you to be spending time running around in order to pay for your Bill.<br>After all, life is beautiful and the time you have in hand should be spent to enjoy it!<br>So here are our little ways to help you get more time for life! &lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -214,7 +222,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-01-21 11:32:10.311015", 
+ "modified": "2016-04-27 17:47:53.979690", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Gateway Account", 
@@ -262,8 +270,10 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "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/payment_request/payment_request.js b/erpnext/accounts/doctype/payment_request/payment_request.js
index 1f0e9bc..e73da4c 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.js
+++ b/erpnext/accounts/doctype/payment_request/payment_request.js
@@ -16,7 +16,7 @@
 })
 
 frappe.ui.form.on("Payment Request", "refresh", function(frm) {
-	if(!in_list(["Initiated", "Paid"], frm.doc.status) && !frm.doc.__islocal){
+	if(!in_list(["Initiated", "Paid"], frm.doc.status) && !frm.doc.__islocal && frm.doc.docstatus==1){
 		frm.add_custom_button(__('Resend Payment Email'), function(){
 			frappe.call({
 				method: "erpnext.accounts.doctype.payment_request.payment_request.resend_payment_email",
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json
index 74a18fc..eca0ad0 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.json
+++ b/erpnext/accounts/doctype/payment_request/payment_request.json
@@ -13,14 +13,14 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "payment_details", 
+   "fieldname": "recipient_and_message", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Payment Details", 
+   "label": "Recipient Message And Payment Details", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -38,100 +38,23 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "currency", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Transaction Currency", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Currency", 
-   "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, 
-   "description": "Amount in customer's currency", 
-   "fieldname": "grand_total", 
-   "fieldtype": "Currency", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Grand Total", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "currency", 
-   "permlevel": 0, 
-   "precision": "2", 
-   "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": "column_break_5", 
-   "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, 
-   "default": "Draft", 
-   "fieldname": "status", 
+   "default": "", 
+   "fieldname": "print_format", 
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Status", 
+   "label": "Print Format", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "\nDraft\nInitiated\nPaid\nFailed\nCancelled", 
+   "options": "", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
-   "read_only": 1, 
+   "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
@@ -142,15 +65,14 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:doc.reference_doctype==\"Sales Order\"", 
-   "fieldname": "make_sales_invoice", 
-   "fieldtype": "Check", 
+   "fieldname": "email_to", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Make Sales Invoice", 
+   "label": "To", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -168,8 +90,33 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "section_break_7", 
-   "fieldtype": "Section Break", 
+   "fieldname": "subject", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Subject", 
+   "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": "column_break_9", 
+   "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -209,6 +156,32 @@
    "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": "currency", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Transaction Currency", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Currency", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
@@ -218,7 +191,237 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "column_break_9", 
+   "description": "Amount in customer's currency", 
+   "fieldname": "grand_total", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Amount", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "currency", 
+   "permlevel": 0, 
+   "precision": "2", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "default": "Draft", 
+   "fieldname": "status", 
+   "fieldtype": "Select", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Status", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nDraft\nInitiated\nPaid\nFailed\nCancelled", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "depends_on": "eval:doc.reference_doctype==\"Sales Order\"", 
+   "fieldname": "make_sales_invoice", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Make Sales Invoice", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "section_break_10", 
+   "fieldtype": "Section 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": "message", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Message", 
+   "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": "message_examples", 
+   "fieldtype": "HTML", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Message Examples", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "<pre><h5>Message Example</h5>\n\n&lt;p&gt; Thank You for being a part of {{ doc.company }}! We hope you are enjoying the service.&lt;/p&gt;\n\n&lt;p&gt; Please find enclosed the E Bill statement. The outstanding amount is {{ doc.grand_total }}.&lt;/p&gt;\n\n&lt;p&gt; We don't want you to be spending time running around in order to pay for your Bill.<br>After all, life is beautiful and the time you have in hand should be spent to enjoy it!<br>So here are our little ways to help you get more time for life! &lt;/p&gt;\n\n&lt;a href=\"{{ payment_url }}\"&gt; click here to pay &lt;/a&gt;\n\n</pre>\n", 
+   "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": "mute_email", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Mute Email", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 1, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "payment_url", 
+   "fieldtype": "Data", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "payment_url", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 1, 
+   "collapsible_depends_on": "doc.payment_gateway_account", 
+   "fieldname": "section_break_7", 
+   "fieldtype": "Section 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": "column_break_16", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
@@ -294,208 +497,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "recipient_and_message", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Recipient and Message", 
-   "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, 
-   "default": "", 
-   "fieldname": "print_format", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Print Format", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "", 
-   "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": "mute_email", 
-   "fieldtype": "Check", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Mute Email", 
-   "length": 0, 
-   "no_copy": 1, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 1, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "email_to", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Email To", 
-   "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": 1, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "subject", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Subject", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "message", 
-   "fieldtype": "Text Editor", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Message", 
-   "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": "payment_url_message", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Payment URL Message", 
-   "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": "payment_url", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "payment_url", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 1, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "reference_details", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -604,7 +605,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-12 15:26:22.756129", 
+ "modified": "2016-05-03 10:31:45.692016", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Payment Request", 
@@ -672,6 +673,7 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_field": "modified", 
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index f2679ba..fc40d42 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -39,22 +39,29 @@
 					frappe.throw(_("PayPal Settings missing"))
 			
 	def on_submit(self):
-		if not self.mute_email:
+		send_mail = True
+		self.make_communication_entry()
+		
+		ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
+		
+		if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart":
+			send_mail = False
+			
+		if send_mail:
 			self.send_payment_request()
 			self.send_email()
-
-		self.make_communication_entry()
 	
 	def on_cancel(self):
 		self.set_as_cancelled()
 	
 	def get_payment_url(self):
 		""" This is blanck method to trigger hooks call from individual payment gateway app
-		  which will return respective payment gateway"""
+		which will return respective payment gateway"""
 		pass
 	
 	def make_invoice(self):
-		if self.make_sales_invoice:
+		ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
+		if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart":
 			from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
 			si = make_sales_invoice(self.reference_name, ignore_permissions=True)
 			si = si.insert(ignore_permissions=True)
@@ -99,13 +106,13 @@
 				
 		if self.reference_doctype == "Sales Order":
 			jv = get_payment_entry_against_order(self.reference_doctype, self.reference_name,
-			 amount=amount, debit_in_account_currency=debit_in_account_currency , journal_entry=True, 
-			 bank_account=self.payment_account)
+			amount=amount, debit_in_account_currency=debit_in_account_currency , journal_entry=True,
+			bank_account=self.payment_account)
 			
-		if self.reference_doctype == "Sales Invoice":			
+		if self.reference_doctype == "Sales Invoice":
 			jv = get_payment_entry_against_invoice(self.reference_doctype, self.reference_name,
-			 amount=amount, debit_in_account_currency=debit_in_account_currency, journal_entry=True,
-			 bank_account=self.payment_account)
+			amount=amount, debit_in_account_currency=debit_in_account_currency, journal_entry=True,
+			bank_account=self.payment_account)
 			
 		jv.update({
 			"voucher_type": "Journal Entry",
@@ -128,8 +135,13 @@
 						
 	def get_message(self):
 		"""return message with payment gateway link"""
-		return  cstr(self.message) + " <a href='{0}'>{1}</a>".format(self.payment_url, \
-			self.payment_url_message or _(" Click here to pay"))
+		
+		context = {
+			"doc": frappe.get_doc(self.reference_doctype, self.reference_name),
+			"payment_url": self.payment_url
+		}
+		
+		return frappe.render_template(self.message, context)
 		
 	def set_failed(self):
 		pass
@@ -157,6 +169,7 @@
 	"""Make payment request"""
 	
 	args = frappe._dict(args)
+	
 	ref_doc = frappe.get_doc(args.dt, args.dn)
 	
 	gateway_account = get_gateway_details(args)
@@ -169,21 +182,17 @@
 	if existing_payment_request:
 		pr = frappe.get_doc("Payment Request", existing_payment_request)
 		
-	else:	
+	else:
 		pr = frappe.new_doc("Payment Request")
 		pr.update({
 			"payment_gateway_account": gateway_account.name,
 			"payment_gateway": gateway_account.payment_gateway,
 			"payment_account": gateway_account.payment_account,
 			"currency": ref_doc.currency,
-			"make_sales_invoice": args.cart or 0,
 			"grand_total": grand_total,
-			"mute_email": args.mute_email or 0,
 			"email_to": args.recipient_id or "",
 			"subject": "Payment Request for %s"%args.dn,
 			"message": gateway_account.message,
-			"payment_url_message": gateway_account.payment_url_message,
-			"payment_success_url": gateway_account.payment_success_url,
 			"reference_doctype": args.dt,
 			"reference_name": args.dn
 		})
@@ -194,13 +203,12 @@
 		if args.submit_doc:
 			pr.insert(ignore_permissions=True)
 			pr.submit()
-
-		
-	if args.cart:
+			
+	if hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart":
 		generate_payment_request(pr.name)
 		frappe.db.commit()
 		
-	if not args.cart:	
+	if not args.cart:
 		return pr
 			
 	return pr.as_dict()
@@ -240,7 +248,7 @@
 	
 def get_payment_gateway_account(args):
 	return frappe.db.get_value("Payment Gateway Account", args, 
-		["name", "payment_gateway", "payment_account", "message", "payment_url_message"], 
+		["name", "payment_gateway", "payment_account", "message"], 
 			as_dict=1)
 
 @frappe.whitelist()
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index d22f4d3..04d4ed7 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -55,6 +55,7 @@
 			if flt(acc.balance_in_company_currency):
 				gl_entries.append(self.get_gl_dict({
 					"account": acc.account,
+					"cost_center": acc.cost_center,
 					"account_currency": acc.account_currency,
 					"debit_in_account_currency": abs(flt(acc.balance_in_account_currency)) \
 						if flt(acc.balance_in_account_currency) < 0 else 0,
@@ -84,12 +85,12 @@
 		"""Get balance for pl accounts"""
 		return frappe.db.sql("""
 			select
-				t1.account, t2.account_currency,
+				t1.account, t1.cost_center, t2.account_currency,
 				sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as balance_in_account_currency,
 				sum(t1.debit) - sum(t1.credit) as balance_in_company_currency
 			from `tabGL Entry` t1, `tabAccount` t2
 			where t1.account = t2.name and t2.report_type = 'Profit and Loss'
 			and t2.docstatus < 2 and t2.company = %s
 			and t1.posting_date between %s and %s
-			group by t1.account
+			group by t1.account, t1.cost_center
 		""", (self.company, self.get("year_start_date"), self.posting_date), as_dict=1)
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index 1fdf002..6f5a663 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -6,7 +6,7 @@
 import unittest
 import frappe
 from frappe.utils import flt, today
-from erpnext.accounts.utils import get_fiscal_year
+from erpnext.accounts.utils import get_fiscal_year, now
 from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
 
 class TestPeriodClosingVoucher(unittest.TestCase):
@@ -14,10 +14,10 @@
 		year_start_date = get_fiscal_year(today())[1]
 
 		make_journal_entry("_Test Bank - _TC", "Sales - _TC", 400,
-			"_Test Cost Center - _TC", submit=True)
+			"_Test Cost Center - _TC", posting_date=now(), submit=True)
 
 		make_journal_entry("_Test Account Cost for Goods Sold - _TC",
-			"_Test Bank - _TC", 600, "_Test Cost Center - _TC", submit=True)
+			"_Test Bank - _TC", 600, "_Test Cost Center - _TC", posting_date=now(), submit=True)
 
 		random_expense_account = frappe.db.sql("""
 			select t1.account,
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..a7e49dd 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -307,10 +307,10 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Payments", 
+   "label": "Sales Invoice Payment", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Payments", 
+   "options": "Sales Invoice Payment", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -350,6 +350,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "default": "Point of Sale", 
    "fieldname": "print_format", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -743,33 +744,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, 
@@ -851,13 +825,14 @@
  "hide_toolbar": 0, 
  "icon": "icon-cog", 
  "idx": 1, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-05-09 00:00:30.610878", 
+ "modified": "2016-06-13 21:20:13.805101", 
  "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.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index b634ccf..7a83c7b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -26,7 +26,6 @@
 		this._super();
 
 		hide_fields(this.frm.doc);
-
 		// Show / Hide button
 		this.show_general_ledger();
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 90a0053..0826150 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-05-21 16:16:39", 
  "custom": 0, 
  "docstatus": 0, 
@@ -132,7 +133,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
@@ -844,7 +845,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "precision": "", 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
@@ -2997,6 +2998,7 @@
  "hide_toolbar": 0, 
  "icon": "icon-file-text", 
  "idx": 204, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 1, 
@@ -3004,7 +3006,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-04-11 14:37:27.243253", 
+ "modified": "2016-06-08 17:30:39.470490", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Invoice", 
@@ -3111,6 +3113,7 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 1, 
  "search_fields": "posting_date, supplier, bill_no, base_grand_total, outstanding_amount", 
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..54d47b5 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()
@@ -19,19 +20,21 @@
 	if pos_profile.get('name'):
 		pos_profile = frappe.get_doc('POS Profile', pos_profile.get('name'))
 	else:
-		frappe.msgprint(_("Warning Message: Create POS Profile"))
+		frappe.msgprint('<a href="#Form/POS Profile/New POS Profile">'
+			+ _("Welcome to POS: Create your POS Profile") + '</a>');
 
 	update_pos_profile_data(doc, pos_profile)
 	update_multi_mode_option(doc, pos_profile)
-	print_template = frappe.db.get_value('Print Format', pos_profile.get('print_format'), 'html') or ''
+	default_print_format = pos_profile.get('print_format') or "Point of Sale"
+	print_template = frappe.db.get_value('Print Format', default_print_format, 'html')
 
 	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,
+		'write_off_account': pos_profile.get('write_off_account'),
 		'meta': {
 			'invoice': frappe.get_meta('Sales Invoice'),
 			'items': frappe.get_meta('Sales Invoice Item'),
@@ -68,6 +71,12 @@
 	from frappe.model import default_fields
 
 	if not pos_profile:
+		for payment in get_mode_of_payment(doc):
+			payments = doc.append('payments', {})
+			payments.mode_of_payment = payment.parent
+			payments.account = payment.default_account
+			payments.type = payment.type
+
 		return
 
 	for payment_mode in pos_profile.payments:
@@ -79,6 +88,10 @@
 
 		doc.append('payments', payment_mode)
 
+def get_mode_of_payment(doc):
+	return frappe.db.sql(""" select mpa.default_account, mpa.parent, mp.type as type from `tabMode of Payment Account` mpa,
+		 `tabMode of Payment` mp where mpa.parent = mp.name and company = %(company)s""", {'company': doc.company}, as_dict=1)
+
 def update_tax_table(doc):
 	taxes = get_taxes_and_charges('Sales Taxes and Charges Template', doc.taxes_and_charges)
 	for tax in taxes:
@@ -106,12 +119,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:
@@ -121,9 +141,6 @@
 					ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31') order by priority desc, name desc""",
 				{'company': doc.company, 'price_list': doc.selling_price_list, 'date': nowdate()}, as_dict=1)
 
-def get_mode_of_payment(doc):
-	return frappe.get_all('Mode of Payment Account', fields = ['distinct parent'], filters={'company': doc.company})
-
 @frappe.whitelist()
 def make_invoice(doc_list):
 	if isinstance(doc_list, basestring):
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 45c918c..be8a846 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -24,7 +24,6 @@
 
 	refresh: function(doc, dt, dn) {
 		this._super();
-
 		if(cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) {
 			// hide new msgbox
 			cur_frm.msgbox.hide();
@@ -51,7 +50,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 +60,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 +220,7 @@
 			frm: cur_frm
 		})
 	},
-	
+
 	asset: function(frm, cdt, cdn) {
 		var row = locals[cdt][cdn];
 		if(row.asset) {
@@ -390,7 +389,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/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 9da4aae..357dec2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -2055,10 +2055,10 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Payments", 
+   "label": "Sales Invoice Payment", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "Payments", 
+   "options": "Sales Invoice Payment", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 1, 
@@ -3589,6 +3589,7 @@
  "hide_toolbar": 0, 
  "icon": "icon-file-text", 
  "idx": 181, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 1, 
@@ -3596,7 +3597,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-05-09 15:03:33.236351", 
+ "modified": "2016-06-10 12:57:08.818701", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Sales Invoice", 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 109a9eb..2584d40 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -650,6 +650,7 @@
 		# write off entries, applicable if only pos
 		if self.write_off_account and self.write_off_amount:
 			write_off_account_currency = get_account_currency(self.write_off_account)
+			default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center')
 
 			gl_entries.append(
 				self.get_gl_dict({
@@ -671,7 +672,7 @@
 					"debit": self.base_write_off_amount,
 					"debit_in_account_currency": self.base_write_off_amount \
 						if write_off_account_currency==self.company_currency else self.write_off_amount,
-					"cost_center": self.write_off_cost_center
+					"cost_center": self.write_off_cost_center or default_cost_center
 				}, write_off_account_currency)
 			)
 
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/payments/__init__.py b/erpnext/accounts/doctype/sales_invoice_payment/__init__.py
similarity index 100%
copy from erpnext/accounts/doctype/payments/__init__.py
copy to erpnext/accounts/doctype/sales_invoice_payment/__init__.py
diff --git a/erpnext/accounts/doctype/payments/payments.json b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
similarity index 96%
rename from erpnext/accounts/doctype/payments/payments.json
rename to erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
index d52fb15..6a17483 100644
--- a/erpnext/accounts/doctype/payments/payments.json
+++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
@@ -169,16 +169,17 @@
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "idx": 0, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2016-05-09 00:14:18.975568", 
+ "modified": "2016-06-10 12:54:18.343417", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
- "name": "Payments", 
+ "name": "Sales Invoice Payment", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [], 
diff --git a/erpnext/accounts/doctype/payments/payments.py b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
similarity index 86%
copy from erpnext/accounts/doctype/payments/payments.py
copy to erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
index 15cf0b2..cc0b7a6 100644
--- a/erpnext/accounts/doctype/payments/payments.py
+++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
@@ -6,5 +6,5 @@
 import frappe
 from frappe.model.document import Document
 
-class Payments(Document):
+class SalesInvoicePayment(Document):
 	pass
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 a8a090f..be9a884 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -6,7 +6,7 @@
 from frappe.utils import flt, cstr, cint
 from frappe import _
 from frappe.model.meta import get_field_precision
-from erpnext.accounts.utils import validate_expense_against_budget
+from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
 
 
 class StockAccountInvalidTransaction(frappe.ValidationError): pass
@@ -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/accounts_browser/accounts_browser.json b/erpnext/accounts/page/accounts_browser/accounts_browser.json
index 7fb1815..f0fe2e8 100644
--- a/erpnext/accounts/page/accounts_browser/accounts_browser.json
+++ b/erpnext/accounts/page/accounts_browser/accounts_browser.json
@@ -1,22 +1,22 @@
 {
- "creation": "2012-06-14 15:07:28.000000", 
- "docstatus": 0, 
- "doctype": "Page", 
- "icon": "icon-sitemap", 
- "idx": 1, 
- "modified": "2013-07-11 14:39:42.000000", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Accounts Browser", 
- "owner": "Administrator", 
- "page_name": "Accounts Browser", 
+ "creation": "2012-06-14 15:07:28.000000",
+ "docstatus": 0,
+ "doctype": "Page",
+ "icon": "icon-sitemap",
+ "idx": 1,
+ "modified": "2013-07-11 14:39:42.000000",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "accounts-browser",
+ "owner": "Administrator",
+ "page_name": "Accounts Browser",
  "roles": [
   {
    "role": "Accounts User"
-  }, 
+  },
   {
    "role": "Accounts Manager"
   }
- ], 
+ ],
  "standard": "Yes"
-}
\ No newline at end of file
+}
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..f3c8c33 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
 	});
 
@@ -12,6 +12,9 @@
 }
 
 frappe.pages['pos'].refresh = function(wrapper) {
+	window.onbeforeunload = function () {
+		return wrapper.pos.beforeunload()
+	}
 	wrapper.pos.on_refresh_page()
 }
 
@@ -32,22 +35,40 @@
 		var me = this;
 		if(this.load){
 			this.load = false;
+		}else if(this.connection_status){
+			this.onload();
 		}else{
 			this.create_new();
 		}
 	},
 
+	beforeunload: function(e){
+		if(this.connection_status == false && frappe.get_route()[0] == "pos"){
+			e = e || window.event;
+
+			// For IE and Firefox prior to version 4
+			if (e) {
+			    e.returnValue = __("You are in offline mode. You will not be able to reload until you have network.");
+				return
+			}
+
+			// For Safari
+			return __("You are in offline mode. You will not be able to reload until you have network.");
+		}
+	},
+
 	check_internet_connection: function(){
 		var me = this;
 		//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,23 +94,24 @@
 		var me = this;
 
 		this.page.add_menu_item(__("New Sales Invoice"), function() {
-			me.create_new()
+			me.save_previous_entry();
+			me.create_new();
 		})
 
 		this.page.add_menu_item(__("View Offline Records"), function(){
-			me.show_unsync_invoice_list()
+			me.show_unsync_invoice_list();
 		});
 
 		this.page.add_menu_item(__("Sync Master Data"), function(){
 			me.get_data_from_server(function(){
-				me.load_data()
-				me.make_customer()
-				me.make_item_list()
+				me.load_data();
+				me.make_customer();
+				me.make_item_list();
 			})
 		});
 
 		this.page.add_menu_item(__("POS Profile"), function() {
-			frappe.set_route('POS Profile');
+			frappe.set_route('List', 'POS Profile');
 		});
 	},
 
@@ -103,36 +125,50 @@
 
 		this.list_dialog.show();
 		this.list_body = this.list_dialog.body;
-		$(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>')
+		if(this.si_docs.length > 0){
+			$(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\
+					<div class="col-xs-2">Sr</div>\
+					<div class="col-xs-4">Customer</div>\
+					<div class="col-xs-2 text-left">Status</div>\
+					<div class="col-xs-4 text-right">Grand Total</div>\
+			</div>')
 
-		$.each(this.si_docs, function(index, data){
-			for(key in data) {
-				$(frappe.render_template("pos_invoice_list", {
-					sr: index + 1,
-					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'
-				})).appendTo($(me.list_body));
-			}
-		})
+			$.each(this.si_docs, function(index, data){
+				for(key in data) {
+					$(frappe.render_template("pos_invoice_list", {
+						sr: index + 1,
+						name: key,
+						customer: data[key].customer,
+						grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
+						data: me.get_doctype_status(data[key])
+					})).appendTo($(me.list_body));
+				}
+			})
 
-		$(this.list_body).find('.list-row').click(function() {
-			me.name = $(this).attr('invoice-name')
-			doc_data = me.get_invoice_doc(me.si_docs)
-			if(doc_data){
-				me.frm.doc = doc_data[0][me.name];
-				me.set_missing_values();
-				me.refresh();
-				me.disable_input_field();
-				me.list_dialog.hide();
-			}
-		})
+			$(this.list_body).find('.list-row').click(function() {
+				me.name = $(this).attr('invoice-name')
+				doc_data = me.get_invoice_doc(me.si_docs)
+				if(doc_data){
+					me.frm.doc = doc_data[0][me.name];
+					me.set_missing_values();
+					me.refresh();
+					me.disable_input_field();
+					me.list_dialog.hide();
+				}
+			})
+		}else{
+			$(this.list_body).append(repl('<div class="media-heading">%(message)s</div>', {'message': __("All records are synced.")}))
+		}
+	},
+
+	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(){
@@ -166,6 +202,7 @@
 				window.pricing_rules = r.message.pricing_rules;
 				window.meta = r.message.meta;
 				window.print_template = r.message.print_template;
+				me.write_off_account = r.message.write_off_account;
 				localStorage.setItem('doc', JSON.stringify(r.message.doc));
 				if(callback){
 					callback();
@@ -174,11 +211,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 +229,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)
@@ -246,7 +289,7 @@
 				"options": this.party,
 				"label": this.party,
 				"fieldname": this.party.toLowerCase(),
-				"placeholder": this.party
+				"placeholder": __("Select or add new customer")
 			},
 			parent: this.wrapper.find(".party-area"),
 			only_input: true,
@@ -264,6 +307,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 +326,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() {
@@ -324,7 +379,8 @@
 			});
 		}
 
-		if(this.items.length == 1){
+		if(this.items.length == 1
+			&& this.search.$input.val()) {
 			this.search.$input.val("");
 			this.add_to_cart();
 		}
@@ -377,39 +433,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 +581,7 @@
 		var me = this;
 		this.refresh_fields();
 		this.update_qty();
+		this.update_rate();
 		this.set_primary_action();
 	},
 	refresh_fields: function() {
@@ -544,7 +614,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 +622,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(){
@@ -589,23 +663,35 @@
 				me.create_invoice();
 				me.make_payment();
 			});
-		}else if(this.frm.doc.docstatus == 0 && this.name){
+		}else if(this.frm.doc.docstatus == 0 && this.frm.doc.items.length){
 			this.page.set_primary_action(__("Submit"), function() {
+				me.validate()
+				me.create_invoice();
 				me.write_off_amount()
 			})
 		}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()
 		}
+
+		this.page.set_secondary_action(__("New"), function() {
+			me.save_previous_entry();
+			me.create_new();
+		});
+	},
+
+	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(){
@@ -616,18 +702,30 @@
 			dialog = new frappe.ui.Dialog({
 				title: 'Write Off Amount',
 				fields: [
-					{fieldtype: "Check", fieldname: "write_off_amount", label: __("Write of Outstanding Amount")},
+					{fieldtype: "Check", fieldname: "write_off_amount", label: __("Write off Outstanding Amount")},
+					{fieldtype: "Link", options:"Account", default:this.write_off_account, fieldname: "write_off_account", 
+					label: __("Write off Account"), get_query: function() {
+						return {
+							filters: {'is_group': 0, 'report_type': 'Profit and Loss'}
+						}
+					}}
 				]
 			});
 
 			dialog.show();
 
 			dialog.fields_dict.write_off_amount.$input.change(function(){
-				write_off_amount = dialog.get_values().write_off_amount
+				write_off_amount = dialog.get_values().write_off_amount;
 				me.frm.doc.write_off_outstanding_amount_automatically = write_off_amount;
 				me.frm.doc.base_write_off_amount = (write_off_amount==1) ? flt(me.frm.doc.grand_total - me.frm.doc.paid_amount, precision("outstanding_amount")) : 0;
+				me.frm.doc.write_off_account = (write_off_amount==1) ? dialog.get_values().write_off_account : '';
 				me.frm.doc.write_off_amount = flt(me.frm.doc.base_write_off_amount * me.frm.doc.conversion_rate, precision("write_off_amount"))
 				me.calculate_outstanding_amount();
+				me.set_primary_action();
+			})
+
+			dialog.fields_dict.write_off_account.$input.change(function(){
+				me.frm.doc.write_off_account = dialog.get_values().write_off_account;
 			})
 
 			dialog.set_primary_action(__("Submit"), function(){
@@ -723,7 +821,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 +838,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/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
index a58b8f2..8cfbc83 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
@@ -8,7 +8,8 @@
 			label: __("Fiscal Year"),
 			fieldtype: "Link",
 			options: "Fiscal Year",
-			default: sys_defaults.fiscal_year
+			default: sys_defaults.fiscal_year,
+			reqd: 1
 		},
 		{
 			fieldname: "period",
@@ -20,14 +21,16 @@
 				{ "value": "Half-Yearly", "label": __("Half-Yearly") },
 				{ "value": "Yearly", "label": __("Yearly") }
 			],
-			default: "Monthly"
+			default: "Monthly",
+			reqd: 1
 		},
 		{
 			fieldname: "company",
 			label: __("Company"),
 			fieldtype: "Link",
 			options: "Company",
-			default: frappe.defaults.get_user_default("Company")
-		},
+			default: frappe.defaults.get_user_default("Company"),
+			reqd: 1
+		}
 	]
 }
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index f8cd134..b67e2b6 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -3,48 +3,43 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe import _, msgprint
+from frappe import _
 from frappe.utils import flt
 from frappe.utils import formatdate
-import time
-from erpnext.accounts.utils import get_fiscal_year
 from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
 
 def execute(filters=None):
 	if not filters: filters = {}
 
 	columns = get_columns(filters)
+	cost_centers = get_cost_centers(filters.company)
 	period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
-	cam_map = get_costcenter_account_month_map(filters)
+	cam_map = get_cost_center_account_month_map(filters)
 
 	data = []
-	for cost_center, cost_center_items in cam_map.items():
-		for account, monthwise_data in cost_center_items.items():
-			row = [cost_center, account]
-			totals = [0, 0, 0]
-			for relevant_months in period_month_ranges:
-				period_data = [0, 0, 0]
-				for month in relevant_months:
-					month_data = monthwise_data.get(month, {})
-					for i, fieldname in enumerate(["target", "actual", "variance"]):
-						value = flt(month_data.get(fieldname))
-						period_data[i] += value
-						totals[i] += value
-				period_data[2] = period_data[0] - period_data[1]
-				row += period_data
-			totals[2] = totals[0] - totals[1]
-			row += totals
-			data.append(row)
+	for cost_center in cost_centers:
+		cost_center_items = cam_map.get(cost_center)
+		if cost_center_items:
+			for account, monthwise_data in cost_center_items.items():
+				row = [cost_center, account]
+				totals = [0, 0, 0]
+				for relevant_months in period_month_ranges:
+					period_data = [0, 0, 0]
+					for month in relevant_months:
+						month_data = monthwise_data.get(month, {})
+						for i, fieldname in enumerate(["target", "actual", "variance"]):
+							value = flt(month_data.get(fieldname))
+							period_data[i] += value
+							totals[i] += value
+					period_data[2] = period_data[0] - period_data[1]
+					row += period_data
+				totals[2] = totals[0] - totals[1]
+				row += totals
+				data.append(row)
 
-	return columns, sorted(data, key=lambda x: (x[0], x[1]))
+	return columns, data
 
 def get_columns(filters):
-	for fieldname in ["fiscal_year", "period", "company"]:
-		if not filters.get(fieldname):
-			label = (" ".join(fieldname.split("_"))).title()
-			msgprint(_("Please specify") + ": " + label,
-				raise_exception=True)
-
 	columns = [_("Cost Center") + ":Link/Cost Center:120", _("Account") + ":Link/Account:120"]
 
 	group_months = False if filters["period"] == "Monthly" else True
@@ -52,7 +47,7 @@
 	for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]):
 		for label in [_("Target") + " (%s)", _("Actual") + " (%s)", _("Variance") + " (%s)"]:
 			if group_months:
-				label = label % (formatdate(from_date, format_string="MMM") + " - " + formatdate(from_date, format_string="MMM"))
+				label = label % (formatdate(from_date, format_string="MMM") + " - " + formatdate(to_date, format_string="MMM"))
 			else:
 				label = label % formatdate(from_date, format_string="MMM")
 
@@ -60,20 +55,21 @@
 
 	return columns + [_("Total Target") + ":Float:120", _("Total Actual") + ":Float:120",
 		_("Total Variance") + ":Float:120"]
+		
+def get_cost_centers(company):
+	return frappe.db.sql_list("select name from `tabCost Center` where company=%s order by lft", company)
 
 #Get cost center & target details
-def get_costcenter_target_details(filters):
-	return frappe.db.sql("""select cc.name, cc.distribution_id,
-		cc.parent_cost_center, bd.account, bd.budget_allocated
-		from `tabCost Center` cc, `tabBudget Detail` bd
-		where bd.parent=cc.name and bd.fiscal_year=%s and
-		cc.company=%s order by cc.name""" % ('%s', '%s'),
-		(filters.get("fiscal_year"), filters.get("company")), as_dict=1)
+def get_cost_center_target_details(filters):
+	return frappe.db.sql("""
+			select b.cost_center, b.monthly_distribution, ba.account, ba.budget_amount
+			from `tabBudget` b, `tabBudget Account` ba
+			where b.name=ba.parent and b.fiscal_year=%s and b.company=%s
+		""", (filters.fiscal_year, filters.company), as_dict=True)
 
 #Get target distribution details of accounts of cost center
 def get_target_distribution_details(filters):
 	target_details = {}
-
 	for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
 		from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
 		where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
@@ -82,45 +78,51 @@
 	return target_details
 
 #Get actual details from gl entry
-def get_actual_details(filters):
+def get_actual_details(cost_center, fiscal_year):
+	cc_lft, cc_rgt = frappe.db.get_value("Cost Center", cost_center, ["lft", "rgt"])
+	
 	ac_details = frappe.db.sql("""select gl.account, gl.debit, gl.credit,
-		gl.cost_center, MONTHNAME(gl.posting_date) as month_name
-		from `tabGL Entry` gl, `tabBudget Detail` bd
-		where gl.fiscal_year=%s and company=%s
-		and bd.account=gl.account and bd.parent=gl.cost_center""" % ('%s', '%s'),
-		(filters.get("fiscal_year"), filters.get("company")), as_dict=1)
+		MONTHNAME(gl.posting_date) as month_name, b.cost_center
+		from `tabGL Entry` gl, `tabBudget Account` ba, `tabBudget` b
+		where 
+			b.name = ba.parent
+			and ba.account=gl.account 
+			and gl.fiscal_year=%s 
+			and b.cost_center=%s
+			and exists(select name from `tabCost Center` where name=gl.cost_center and lft>=%s and rgt<=%s)
+	""", (fiscal_year, cost_center, cc_lft, cc_rgt), as_dict=1)
 
 	cc_actual_details = {}
 	for d in ac_details:
-		cc_actual_details.setdefault(d.cost_center, {}).setdefault(d.account, []).append(d)
+		cc_actual_details.setdefault(d.account, []).append(d)
 
 	return cc_actual_details
 
-def get_costcenter_account_month_map(filters):
+def get_cost_center_account_month_map(filters):
 	import datetime
-	costcenter_target_details = get_costcenter_target_details(filters)
+	cost_center_target_details = get_cost_center_target_details(filters)
 	tdd = get_target_distribution_details(filters)
-	actual_details = get_actual_details(filters)
 
 	cam_map = {}
 
-	for ccd in costcenter_target_details:
+	for ccd in cost_center_target_details:
+		actual_details = get_actual_details(ccd.cost_center, filters.fiscal_year)
+		
 		for month_id in range(1, 13):
 			month = datetime.date(2013, month_id, 1).strftime('%B')
 
-			cam_map.setdefault(ccd.name, {}).setdefault(ccd.account, {})\
+			cam_map.setdefault(ccd.cost_center, {}).setdefault(ccd.account, {})\
 				.setdefault(month, frappe._dict({
 					"target": 0.0, "actual": 0.0
 				}))
 
-			tav_dict = cam_map[ccd.name][ccd.account][month]
+			tav_dict = cam_map[ccd.cost_center][ccd.account][month]
+			month_percentage = tdd.get(ccd.monthly_distribution, {}).get(month, 0) \
+				if ccd.monthly_distribution else 100.0/12
 
-			month_percentage = tdd.get(ccd.distribution_id, {}).get(month, 0) \
-				if ccd.distribution_id else 100.0/12
-
-			tav_dict.target = flt(ccd.budget_allocated) * month_percentage / 100
-
-			for ad in actual_details.get(ccd.name, {}).get(ccd.account, []):
+			tav_dict.target = flt(ccd.budget_amount) * month_percentage / 100
+			
+			for ad in actual_details.get(ccd.account, []):
 				if ad.month_name == month:
 						tav_dict.actual += flt(ad.debit) - flt(ad.credit)
 
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/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 6fc7349..9f30349 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -21,7 +21,7 @@
 		"width": 80
 	})
 	company_currency = frappe.db.get_value("Company", filters.company, "default_currency")
-	
+
 	data = []
 	for d in item_list:
 		delivery_note = None
@@ -33,7 +33,7 @@
 
 		row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
 			d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order,
-			delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
+			delivery_note, d.income_account, d.cost_center, d.qty, d.base_net_rate, d.base_net_amount]
 
 		for tax in tax_accounts:
 			row.append(item_row_tax.get(d.name, {}).get(tax, 0))
@@ -51,12 +51,14 @@
 		_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120",
 		_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
 		_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120",
-		_("Receivable Account") + ":Link/Account:120", 
-		_("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80", 
+		_("Receivable Account") + ":Link/Account:120",
+		_("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80",
 		_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
 		_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
-		_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
-		_("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
+		_("Income Account") + ":Link/Account:140", _("Cost Center") + ":Link/Cost Center:140",
+		_("Qty") + ":Float:120",
+		_("Rate") + ":Currency/currency:120",
+		_("Amount") + ":Currency/currency:120"
 	]
 
 def get_conditions(filters):
@@ -78,9 +80,9 @@
 	return frappe.db.sql("""
 		select
 			si_item.name, si_item.parent, si.posting_date, si.debit_to, si.project,
-			si.customer, si.remarks, si.territory, si.company, si.base_net_total, 
-			si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, 
-			si_item.delivery_note, si_item.income_account, si_item.qty, 
+			si.customer, si.remarks, si.territory, si.company, si.base_net_total,
+			si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
+			si_item.delivery_note, si_item.income_account, si_item.cost_center, si_item.qty,
 			si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
 			si.customer_group, si_item.so_detail, si.mode_of_payment
 		from `tabSales Invoice` si, `tabSales Invoice Item` si_item
@@ -98,12 +100,12 @@
 		item_row_map.setdefault(d.parent, {}).setdefault(d.item_code, []).append(d)
 
 	tax_details = frappe.db.sql("""
-		select 
+		select
 			parent, account_head, item_wise_tax_detail,
 			charge_type, base_tax_amount_after_discount_amount
-		from `tabSales Taxes and Charges` 
-		where 
-			parenttype = 'Sales Invoice' and docstatus = 1 
+		from `tabSales Taxes and Charges`
+		where
+			parenttype = 'Sales Invoice' and docstatus = 1
 			and (account_head is not null and account_head != '')
 			and parent in (%s)
 	""" % ', '.join(['%s']*len(invoice_item_row)), tuple(invoice_item_row.keys()))
@@ -111,21 +113,21 @@
 	for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
 		if account_head not in tax_accounts:
 			tax_accounts.append(account_head)
-			
+
 		if item_wise_tax_detail:
 			try:
 				item_wise_tax_detail = json.loads(item_wise_tax_detail)
 
 				for item_code, tax_amount in item_wise_tax_detail.items():
 					tax_amount = flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
-					
-					item_net_amount = sum([flt(d.base_net_amount) 
+
+					item_net_amount = sum([flt(d.base_net_amount)
 						for d in item_row_map.get(parent, {}).get(item_code, [])])
-						
+
 					for d in item_row_map.get(parent, {}).get(item_code, []):
 						item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) if item_net_amount else 0
 						item_row_tax.setdefault(d.name, {})[account_head] = item_tax_amount
-			
+
 			except ValueError:
 				continue
 		elif charge_type == "Actual" and tax_amount:
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 683b84b..27f1394 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -4,16 +4,14 @@
 from __future__ import unicode_literals
 
 import frappe
-from frappe.utils import nowdate, cstr, flt, cint, now, getdate, add_months
+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
 
 class FiscalYearError(frappe.ValidationError): pass
-class BudgetError(frappe.ValidationError): pass
 
 @frappe.whitelist()
 def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False):
@@ -129,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
@@ -321,72 +319,6 @@
 
 	return difference
 
-def validate_expense_against_budget(args):
-	args = frappe._dict(args)
-	if frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
-			budget = frappe.db.sql("""
-				select bd.budget_allocated, cc.distribution_id
-				from `tabCost Center` cc, `tabBudget Detail` bd
-				where cc.name=bd.parent and cc.name=%s and account=%s and bd.fiscal_year=%s
-			""", (args.cost_center, args.account, args.fiscal_year), as_dict=True)
-
-			if budget and budget[0].budget_allocated:
-				yearly_action, monthly_action = frappe.db.get_value("Company", args.company,
-					["yearly_bgt_flag", "monthly_bgt_flag"])
-				action_for = action = ""
-
-				if monthly_action in ["Stop", "Warn"]:
-					budget_amount = get_allocated_budget(budget[0].distribution_id,
-						args.posting_date, args.fiscal_year, budget[0].budget_allocated)
-
-					args["month_end_date"] = frappe.db.sql("select LAST_DAY(%s)",
-						args.posting_date)[0][0]
-					action_for, action = _("Monthly"), monthly_action
-
-				elif yearly_action in ["Stop", "Warn"]:
-					budget_amount = budget[0].budget_allocated
-					action_for, action = _("Annual"), yearly_action
-
-				if action_for:
-					actual_expense = get_actual_expense(args)
-					if actual_expense > budget_amount:
-						frappe.msgprint(_("{0} budget for Account {1} against Cost Center {2} will exceed by {3}").format(
-							_(action_for), args.account, args.cost_center, cstr(actual_expense - budget_amount)))
-						if action=="Stop":
-							raise BudgetError
-
-def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget):
-	if distribution_id:
-		distribution = {}
-		for d in frappe.db.sql("""select mdp.month, mdp.percentage_allocation
-			from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
-			where mdp.parent=md.name and md.fiscal_year=%s""", fiscal_year, as_dict=1):
-				distribution.setdefault(d.month, d.percentage_allocation)
-
-	dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date")
-	budget_percentage = 0.0
-
-	while(dt <= getdate(posting_date)):
-		if distribution_id:
-			budget_percentage += distribution.get(getdate(dt).strftime("%B"), 0)
-		else:
-			budget_percentage += 100.0/12
-
-		dt = add_months(dt, 1)
-
-	return yearly_budget * budget_percentage / 100
-
-def get_actual_expense(args):
-	args["condition"] = " and posting_date<='%s'" % args.month_end_date \
-		if args.get("month_end_date") else ""
-
-	return flt(frappe.db.sql("""
-		select sum(debit) - sum(credit)
-		from `tabGL Entry`
-		where account='%(account)s' and cost_center='%(cost_center)s'
-		and fiscal_year='%(fiscal_year)s' and company='%(company)s' %(condition)s
-	""" % (args))[0][0])
-
 def get_currency_precision(currency=None):
 	if not currency:
 		currency = frappe.db.get_value("Company",
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/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py
index 5485f0c..8435f3b 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.py
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.py
@@ -72,7 +72,7 @@
 
 		if items and len(items) != len(set(items)) and \
 			not cint(frappe.db.get_single_value("Buying Settings", "allow_multiple_items") or 0):
-			frappe.msgprint(_("Warning: Same item has been entered multiple times."), small=True)
+			frappe.msgprint(_("Warning: Same item has been entered multiple times."), alert=True)
 
 
 	def check_for_closed_status(self, doctype, docname):
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index ddaa5b4..9e44855 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -47,7 +47,7 @@
 
 			if(is_drop_ship && doc.status!="Delivered"){
 				cur_frm.add_custom_button(__('Delivered'),
-					this.delivered_by_supplier, __("Status"));
+					 this.delivered_by_supplier, __("Status"));
 
 				cur_frm.page.set_inner_btn_group_as_primary(__("Status"));
 			}
@@ -61,7 +61,7 @@
 			}
 		}
 
-		if(doc.docstatus == 1 && !in_list(["Closed", "Completed"], doc.status)) {
+		if(doc.docstatus == 1 && doc.status != "Closed") {
 			if(flt(doc.per_received, 2) < 100 && allow_receipt) {
 				cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt, __("Make"));
 
@@ -93,6 +93,15 @@
 		});
 	},
 
+	validate: function() {
+		// set default schedule date as today if missing.
+		(this.frm.doc.items || []).forEach(function(d) {
+			if(!d.schedule_date) {
+				d.schedule_date = frappe.datetime.nowdate();
+			}
+		})
+	},
+
 	make_stock_entry: function() {
 		var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; });
 		var me = this;
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index d259cd3..c99481e 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-05-21 16:16:39", 
  "custom": 0, 
  "docstatus": 0, 
@@ -221,6 +222,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "default": "Today", 
    "fieldname": "transaction_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -2693,7 +2695,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-06 05:39:44.569515", 
+ "modified": "2016-05-23 15:20:59.954292", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order", 
@@ -2780,6 +2782,7 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 1, 
  "search_fields": "status, transaction_date, supplier,grand_total", 
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/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index 5972f46..e2ee374 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -78,13 +78,8 @@
 			'first_name': rfq_supplier.supplier_name,
 			'user_type': 'Website User'
 		})
-
-		# reset password
-		key = random_string(32)
-		update_password_link = get_url("/update-password?key=" + key)
-		user.reset_password_key = key
-		user.redirect_url = link
 		user.save(ignore_permissions=True)
+		update_password_link = user.reset_password()
 
 		return user, update_password_link
 
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/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index 8587a9f..b3030f7 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -7,7 +7,6 @@
 erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({
 	refresh: function() {
 		this._super();
-
 		if (this.frm.doc.docstatus === 1) {
 			cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order,
 				__("Make"));
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index f8c5935..9bed98c 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-05-21 16:16:45", 
  "custom": 0, 
  "docstatus": 0, 
@@ -169,6 +170,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "default": "Today", 
    "fieldname": "transaction_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -1780,7 +1782,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-04-06 05:39:45.107820", 
+ "modified": "2016-05-23 15:20:34.288790", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier Quotation", 
@@ -1885,28 +1887,9 @@
    "share": 0, 
    "submit": 0, 
    "write": 1
-  }, 
-  {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 0, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 1, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "All", 
-   "set_user_permissions": 0, 
-   "share": 0, 
-   "submit": 0, 
-   "write": 0
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 1, 
  "search_fields": "status, transaction_date, supplier,grand_total", 
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 d0629e7..e11544a 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -201,6 +201,11 @@
 					"doctype": "Cost Center",
 				},
 				{
+					"type": "doctype",
+					"name": "Budget",
+					"description": _("Define budget for a financial year.")
+				},
+				{
 					"type": "report",
 					"name": "Budget Variance Report",
 					"is_query_report": True,
@@ -316,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/controllers/tests/__init__.py b/erpnext/controllers/tests/__init__.py
index 60bec4f..e69de29 100644
--- a/erpnext/controllers/tests/__init__.py
+++ b/erpnext/controllers/tests/__init__.py
@@ -1 +0,0 @@
-from erpnext.__version__ import __version__
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/newsletter.json b/erpnext/crm/doctype/newsletter/newsletter.json
index d93f88e..2515638 100644
--- a/erpnext/crm/doctype/newsletter/newsletter.json
+++ b/erpnext/crm/doctype/newsletter/newsletter.json
@@ -3,6 +3,7 @@
  "allow_import": 0, 
  "allow_rename": 1, 
  "autoname": "field:subject", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:31", 
  "custom": 0, 
  "description": "Create and Send Newsletters", 
@@ -18,6 +19,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Newsletter List", 
@@ -43,6 +45,7 @@
    "fieldtype": "Small Text", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Subject", 
@@ -67,6 +70,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 1, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Sender", 
@@ -90,6 +94,7 @@
    "fieldtype": "Check", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Email Sent?", 
@@ -113,6 +118,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -136,6 +142,7 @@
    "fieldtype": "Text Editor", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Message", 
@@ -160,6 +167,7 @@
    "fieldtype": "Section Break", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "", 
@@ -184,6 +192,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Test Email Id", 
@@ -207,6 +216,7 @@
    "fieldtype": "Button", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "Test", 
@@ -235,7 +245,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-02-05 11:48:43.081204", 
+ "modified": "2016-05-24 16:01:54.675129", 
  "modified_by": "Administrator", 
  "module": "CRM", 
  "name": "Newsletter", 
@@ -245,7 +255,7 @@
    "amend": 0, 
    "apply_user_permissions": 0, 
    "cancel": 0, 
-   "create": 1, 
+   "create": 0, 
    "delete": 1, 
    "email": 1, 
    "export": 1, 
@@ -259,12 +269,13 @@
    "set_user_permissions": 0, 
    "share": 1, 
    "submit": 0, 
-   "write": 1
+   "write": 0
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_order": "ASC", 
  "title_field": "subject", 
- "version": 0
+ "track_seen": 0
 }
\ No newline at end of file
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/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index c918dad..9144692 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -82,23 +82,23 @@
 			frm.add_custom_button(__("Close"), function() {
 				frm.set_value("status", "Closed");
 				frm.save();
-			}, __("Status"));
+			});
 		} else {
 			frm.add_custom_button(__("Reopen"), function() {
 				frm.set_value("status", "Open");
 				frm.save();
-			}, __("Status"));
+			});
 		}
 	}
 
 	if(doc.status!=="Lost") {
 		if(doc.status!=="Quotation") {
 			cur_frm.add_custom_button(__('Lost'),
-				cur_frm.cscript['Declare Opportunity Lost'], __("Status"));
+				cur_frm.cscript['Declare Opportunity Lost']);
 		}
 
-		cur_frm.add_custom_button(__('Quotation'),cur_frm.cscript.create_quotation, __("Make"));
-		cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
+		cur_frm.add_custom_button(__('Quotation'),
+			cur_frm.cscript.create_quotation);
 	}
 
 }
diff --git a/erpnext/docs/assets/img/accounts/budget-variance-report.png b/erpnext/docs/assets/img/accounts/budget-variance-report.png
new file mode 100644
index 0000000..c7c3677
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/budget-variance-report.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/budget.png b/erpnext/docs/assets/img/accounts/budget.png
new file mode 100644
index 0000000..c488558
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/budget.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/monthly-distribution.png b/erpnext/docs/assets/img/accounts/monthly-distribution.png
new file mode 100644
index 0000000..0791c8b
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/monthly-distribution.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/attach_scanned_copy.png b/erpnext/docs/assets/img/articles/attach_scanned_copy.png
new file mode 100644
index 0000000..ab3f980
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/attach_scanned_copy.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/cheque_print.gif b/erpnext/docs/assets/img/articles/cheque_print.gif
new file mode 100644
index 0000000..1ebb586
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/cheque_print.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/create_print_format.png b/erpnext/docs/assets/img/articles/create_print_format.png
new file mode 100644
index 0000000..3919ef5
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/create_print_format.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/cueque_print_preview.png b/erpnext/docs/assets/img/articles/cueque_print_preview.png
new file mode 100644
index 0000000..77261b0
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/cueque_print_preview.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/cueque_print_template.png b/erpnext/docs/assets/img/articles/cueque_print_template.png
new file mode 100644
index 0000000..b4c5aa8
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/cueque_print_template.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/journal_entry_cheque_print.png b/erpnext/docs/assets/img/articles/journal_entry_cheque_print.png
new file mode 100644
index 0000000..e8d0d46
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/journal_entry_cheque_print.png
Binary files differ
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/docs/user/manual/en/accounts/articles/cheque-print.md b/erpnext/docs/user/manual/en/accounts/articles/cheque-print.md
new file mode 100644
index 0000000..811e948
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/articles/cheque-print.md
@@ -0,0 +1,36 @@
+#Cheque Print
+
+** Whats is Cheque Print? **
+
+You can choose to print Cheques at the time of making payments to Creditors/ parties during Voucher Entry i.e., directly from the Payment Vouchers and Inter-bank payment or transfers through Contra Vouchers.
+
+###Setup Cheque Print
+
+To enable cheque printing,
+
+1. Create cheque settings under `Accounts > Cheque Print Template`.
+
+![Cheque Print Template]({{docs_base_url}}/assets/img/articles/cueque_print_template.png)
+
+You can see a preview of cheque print by attaching scanned copy of cheque to avoid miss printing.
+
+![Cheque scanned copy]({{docs_base_url}}/assets/img/articles/attach_scanned_copy.png)
+
+![Cheque Print Preview]({{docs_base_url}}/assets/img/articles/cueque_print_preview.png)
+
+2. After saving cheque print settings, you can Create / Update print format for settings.
+
+To create print format, click on `Create Print Format`.
+
+![Create Print Format]({{docs_base_url}}/assets/img/articles/create_print_format.png)
+
+If you have already created a Print Format, you can update it by clicking on `Update Print Format`.
+
+3. You will see newly created / updated print format under Journal Entry.
+
+![Print from Journal Entry]({{docs_base_url}}/assets/img/articles/journal_entry_cheque_print.png)
+
+
+###Cheque Print
+
+![Print from Journal Entry]({{docs_base_url}}/assets/img/articles/cheque_print.gif)
diff --git a/erpnext/docs/user/manual/en/accounts/articles/index.txt b/erpnext/docs/user/manual/en/accounts/articles/index.txt
index 76ace0b..d54f0cd 100644
--- a/erpnext/docs/user/manual/en/accounts/articles/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/articles/index.txt
@@ -12,4 +12,5 @@
 post-dated-cheque-entry
 update-stock-option-in-sales-invoice
 what-is-the-differences-of-total-and-valuation-in-tax-and-charges
-withdrawing-salary-from-owners-equity-account
\ No newline at end of file
+withdrawing-salary-from-owners-equity-account
+cheque-print
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md b/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
index 356ad43..b8310ad 100644
--- a/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
+++ b/erpnext/docs/user/manual/en/accounts/articles/tracking-project-profitability-using-cost-center.md
@@ -69,11 +69,11 @@
 
 #### 3.2 Projectwise Budgeting
 
-If you have also define budgets in the Cost Center of a Project, you will get Budget Variance Report for a Cost Center of a Project.
+You can define budgets against the Cost Center associated with a Project. At any point of time, you can refer Budget Variance Report to analysis the expense vs budget against a cost center.
 
 To check Budget Variance report, go to:
 
-`Accounts > Standard Reports > Budget Variance Report`
+`Accounts > Budget and Cost Center > Budget Variance Report`
 
 [Click here to learn how to do budgeting from Cost Center]({{docs_base_url}}/user/manual/en/accounts/budgeting.html).
 
diff --git a/erpnext/docs/user/manual/en/accounts/budgeting.md b/erpnext/docs/user/manual/en/accounts/budgeting.md
index 49a73ac..a9f92fb 100644
--- a/erpnext/docs/user/manual/en/accounts/budgeting.md
+++ b/erpnext/docs/user/manual/en/accounts/budgeting.md
@@ -1,45 +1,29 @@
-ERPNext will help you set and manage budgets on your Cost Centers. This is
-useful when, for example, you are doing online sales. You have a budget for
-search ads, and you want ERPNext to stop or warn you from over spending, based
-on that budget.
+In ERPNext, you can set and manage budgets against a Cost Center. This is useful when, for example, you are doing online sales. You have a budget for search ads, and you want ERPNext to stop or warn you from over spending, based on that budget.
 
-Budgets are also great for planning purposes. When you are making plans for
-the next financial year, you would typically target a revenue based on which
-you would set your expenses. Setting a budget will ensure that your expenses
-do not get out of hand, at any point, as per your plans.
+Budgets are also great for planning purposes. When you are making plans for the next financial year, you would typically target a revenue based on which you would set your expenses. Setting a budget will ensure that your expenses do not get out of hand, at any point, as per your plans.
 
-You can define it in the Cost Center. If you have seasonal sales you can also
-define a budget distribution that the budget will follow.
+To allocate budget, go to:
 
-In order to allocate budget, go to:
+> Accounts > Budget and Cost Center > Budget
 
-> Accounts > Setup > Chart of Cost Centers 
+In the Budget form, you can select a Cost Center and for that cost center you can define budgets against any Expense / Income accounts. Budgets can be defined against any Cost Center whether it is a Group / Leaf node in the Chart of Cost Centers.
 
-and click on Chart of Cost Center. Select a Cost Center and click on Open.
+<img class="screenshot" alt="Budget" src="{{docs_base_url}}/assets/img/accounts/budget.png">
 
-#### Step 1: Click on Edit.	 
-
-<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-1.gif">
-
-#### Step 3:Add New Row and select budget account.  
-
-<img alt="Cost Center Account" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-2.png"> 
-
-#### Step 3: Enter Monthly Distribution (optional)
-
-<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-distribution.gif">
-
-If you leave the** **distribution ID blank, ERPNext will calculate on a yearly
+If you have seasonal business, you can also define a Monthly Distribution record, to distribute the budget between months. If you don't set the monthly distribution, ERPNext will calculate the budget on yearly
 basis or in equal proportion for every month.
 
-### To Create New Distribution ID
+<img class="screenshot" alt="Monthly Distribution" src="{{docs_base_url}}/assets/img/accounts/monthly-distribution.png">
 
-ERPNext allows you to take a few budget actions. It signifies whether to stop, warn or Ignore  if you exceed budgets.
+While setting budget, you can also define the actions when expenses will exceed the allocated budget for a period. You can set separate action for monthly and annual budgets. There are 3 types of actions: Stop, Warn and Ignore. If Stop, system will not allow to book expenses more than allocated budget. In Case of Warn, it will just warn the user that expenses has been exceeded from the allocated budget. And Ignore will do nothing.
 
-These can be defined from the Company record.
 
-<img alt="Cost Center" class="screenshot" src="{{docs_base_url}}/assets/img/accounts/cost-center-company.gif">
+At any point of time, user can check Budget Variance Report to analysis the expense vs budget against a cost center.
 
-Even if you choose to “ignore” budget overruns, you will get a wealth of information from the “Budget vs Actual” variance report. This report shows month wise actual expenses as compared to the budgeted expenses.
+To check Budget Variance report, go to:
+
+Accounts > Budget and Cost Center > Budget Variance Report
+
+<img class="screenshot" alt="Budget Variance Report" src="{{docs_base_url}}/assets/img/accounts/budget-variance-report.png">
 
 {next}
diff --git a/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
index 1cdbd1e..163bd88 100644
--- a/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
+++ b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
@@ -1,8 +1,8 @@
-In ERPNext, you can maintain fixed asset records like Computers, Furnitures, Cars etc and manage depreciations, sell or disposal of those assets.
+In ERPNext, you can maintain fixed asset records like Computers, Furnitures, Cars, etc. and manage depreciations, sale or disposal of those assets.
 
 ## Asset Category
 
-To start first you should create Asset Category, depending on the type of assets. For example, all your desktops and laptops can be part of a Asset Category named "Computers". Here, you can set default depreciation method, periodicity and depreciation related accounts, which will be applicable to all the assets under the category.
+To start first you should create an Asset Category, depending on the type of assets. For example, all your desktops and laptops can be part of an Asset Category named "Computers". Here, you can set default depreciation method, periodicity and depreciation related accounts, which will be applicable to all the assets under the category.
 
 <img class="screenshot" alt="Asset Category" src="{{docs_base_url}}/assets/img/accounts/asset-category.png">
 
@@ -11,7 +11,7 @@
 
 ## Asset
 
-Next step will be creating the fixed asset records. Asset record is the heart of fixed asset management, all the activities like purchasing, depreciation, scrapping or sales are managed against it.
+Next step will be creating the fixed asset record. Asset record is the heart of fixed asset management, all the activities like purchasing, depreciation, scrapping or sales are managed against it.
 
 <img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset.png">
 
@@ -85,4 +85,4 @@
 
 There is also a dedicated button "Transfer Asset" inside the Asset form to track the Asset Movement.
 
-<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset-movement-using-button.png">
\ No newline at end of file
+<img class="screenshot" alt="Asset" src="{{docs_base_url}}/assets/img/accounts/asset-movement-using-button.png">
diff --git a/erpnext/docs/user/manual/en/accounts/setup/cost-center.md b/erpnext/docs/user/manual/en/accounts/setup/cost-center.md
index 8b9fcc1..16b5431 100644
--- a/erpnext/docs/user/manual/en/accounts/setup/cost-center.md
+++ b/erpnext/docs/user/manual/en/accounts/setup/cost-center.md
@@ -34,45 +34,4 @@
 
 ![Chart of Cost Center]({{docs_base_url}}/assets/old_images/erpnext/chart-of-cost-centers.png)
 
-Cost centers help you in one more activity, budgeting.
-
-### Budgeting
-
-ERPNext will help you set and manage budgets on your Cost Centers. This is
-useful when, for example, you are doing online sales. You have a budget for
-search ads, and you want ERPNext to stop or warn you from over spending, based
-on that budget.
-
-Budgets are also great for planning purposes. When you are making plans for
-the next financial year, you would typically target a revenue based on which
-you would set your expenses. Setting a budget will ensure that your expenses
-do not get out of hand, at any point, as per your plans.
-
-You can define it in the Cost Center. If you have seasonal sales you can also
-define a budget distribution that the budget will follow.
-
-> Accounts > Setup > Budget Distribution > New Budget Distribution
-
-![Budget Distribution]({{docs_base_url}}/assets/old_images/erpnext/budgeting.png)
-
-#### Budget Actions
-
-ERPNext allows you to either:
-
-  * Stop.
-  * Warn or, 
-  * Ignore 
-
-if you exceed budgets.
-
-These can be defined from the Company record.
-
-Even if you choose to “ignore” budget overruns, you will get a wealth of
-information from the “Budget vs Actual” variance report.
-
-> Note: When you set a budget, it has to be set as per Account under the Cost
-Center. For example if you have a Cost Center “Online Sales”, you can restrict
-“Advertising Budget” by creating a row with that Account and defining the
-amount.
-
 {next}
diff --git a/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md b/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
index 134a9b4..e32c97d 100644
--- a/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
+++ b/erpnext/docs/user/manual/en/selling/setup/sales-person-target-allocation.md
@@ -20,7 +20,7 @@
 
 ####1.3 Target Distribution
 
-If you wish to spread allocated target across months, then you shoult setup Target Distribution master, and select it in the Sales Person master. Considering our example, target for the month of December will be set as 5 qty (10% of total allocation).
+If you wish to spread allocated target across months, then you should setup Monthly Distribution master, and select it in the Sales Person master. Considering our example, target for the month of December will be set as 5 qty (10% of total allocation).
 
 ![Sales Person Target Distribution]({{docs_base_url}}/assets/old_images/erpnext/sales-person-target-distribution.png)
 
@@ -52,11 +52,11 @@
 
 ####2.2 Allocating Target
 
-Allocation Target in the Territory master is same as in Sales Person master. You can follow same steps as given above to specify target in the Territory master as well.
+Target Allocation in the Territory master is same as in Sales Person master. You can follow same steps as given above to specify target in the Territory master as well.
 
 ####2.3 Target Distribution
 
-Using this master, you can divide target Qty or Amount across various months.
+Using this Monthly Distribution document, you can divide target Qty or Amount across various months.
 
 ####2.4 Report - Territory Target Variance Item Groupwise
 
@@ -68,15 +68,15 @@
 
 ###3. Target Distribution
 
-Target Distribution master allows you to divide allocated target across multiple months. If your product and services is seasonal, you can distribute the sales target accordingly. For example, if you are into umbrella business, then target allocated in the monsoon seasion will be higher than in other months.
+Target Distribution document allows you to divide allocated target across multiple months. If your product and services is seasonal, you can distribute the sales target accordingly. For example, if you are into umbrella business, then target allocated in the monsoon seasion will be higher than in other months.
 
-To create new Budget Distriibution master, go to:
+To create new Monthly Distriibution, go to:
 
-`Accounts > Setup > Budget Distributon`
+`Accounts > Monthly Distributon`
 
 ![Target Distribution]({{docs_base_url}}/assets/old_images/erpnext/target-distribution.png)
 
-You can link target distribution while allocation targets in Sales Person as well as in Territory master.
+You can link Monthly Distribution while allocating targets in Sales Person as well as in Territory master.
 
 ###See Also
 
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index af0d5e4..2bb2ca6 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -1,5 +1,6 @@
 from __future__ import unicode_literals
 from frappe import _
+from . import __version__ as app_version
 
 app_name = "erpnext"
 app_title = "ERPNext"
@@ -7,7 +8,6 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.27.19"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
@@ -89,7 +89,7 @@
 	{"title": _("Orders"), "route": "/orders", "reference_doctype": "Sales Order"},
 	{"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice"},
 	{"title": _("Shipments"), "route": "/shipments", "reference_doctype": "Delivery Note"},
-	{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue"},
+	{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "show_always": True},
 	{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"}
 ]
 
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/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index c0960cb..6730141 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -185,13 +185,13 @@
 			item = frappe.get_doc("Item", self.item)
 			if item.default_bom != self.name:
 				item.default_bom = self.name
-				item.save()
+				item.save(ignore_permissions = True)
 		else:
 			frappe.db.set(self, "is_default", 0)
 			item = frappe.get_doc("Item", self.item)
 			if item.default_bom == self.name:
 				item.default_bom = None
-				item.save()
+				item.save(ignore_permissions = True)
 
 	def clear_operations(self):
 		if not self.with_operations:
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
index 37b643d..26ba5b7 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.json
@@ -2,11 +2,13 @@
  "allow_copy": 1, 
  "allow_import": 0, 
  "allow_rename": 0, 
+ "beta": 0, 
  "creation": "2013-01-21 12:03:47", 
  "custom": 0, 
  "default_print_format": "Standard", 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "document_type": "Setup", 
  "fields": [
   {
    "allow_on_submit": 0, 
@@ -633,7 +635,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Create Material Requests for All Required Qty", 
+   "label": "Create for full quantity, ignoring quantity already on order", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -651,7 +653,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty, if \"Create Material Requests for All Required Qty\" is unchecked.", 
+   "description": "", 
    "fieldname": "create_material_requests", 
    "fieldtype": "Button", 
    "hidden": 0, 
@@ -709,7 +711,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-05-10 12:55:45.647374", 
+ "modified": "2016-06-02 17:59:48.976304", 
  "modified_by": "Administrator", 
  "module": "Manufacturing", 
  "name": "Production Planning Tool", 
@@ -736,7 +738,9 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 1, 
  "read_only_onload": 0, 
- "sort_order": "ASC"
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
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 10af7b6..363a5a6 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -264,4 +264,9 @@
 erpnext.patches.v7_0.update_item_projected
 erpnext.patches.v7_0.fix_duplicate_icons
 erpnext.patches.v7_0.remove_features_setup
-erpnext.patches.v7_0.update_home_page
\ No newline at end of file
+erpnext.patches.v7_0.update_home_page
+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
+execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatus=2')
+execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
\ No newline at end of file
diff --git a/erpnext/patches/v5_0/rename_table_fieldnames.py b/erpnext/patches/v5_0/rename_table_fieldnames.py
index 05d5c91..37176f2 100644
--- a/erpnext/patches/v5_0/rename_table_fieldnames.py
+++ b/erpnext/patches/v5_0/rename_table_fieldnames.py
@@ -86,9 +86,6 @@
 	"Bank Reconciliation": [
 		["entries", "journal_entries"]
 	],
-	"Cost Center": [
-		["budget_details", "budgets"]
-	],
 	"C-Form": [
 		["invoice_details", "invoices"]
 	],
diff --git a/erpnext/patches/v7_0/create_budget_record.py b/erpnext/patches/v7_0/create_budget_record.py
new file mode 100644
index 0000000..607ef690
--- /dev/null
+++ b/erpnext/patches/v7_0/create_budget_record.py
@@ -0,0 +1,56 @@
+import frappe
+
+from erpnext.accounts.doctype.budget.budget import DuplicateBudgetError
+
+def execute():
+	frappe.reload_doc("accounts", "doctype", "budget")
+	frappe.reload_doc("accounts", "doctype", "budget_account")
+
+	existing_budgets = frappe.db.sql("""
+		select
+			cc.name, cc.company, cc.distribution_id,
+			budget.account, budget.budget_allocated, budget.fiscal_year
+		from
+			`tabCost Center` cc, `tabBudget Detail` budget
+		where
+			cc.name=budget.parent
+	""", as_dict=1)
+
+	actions = {}
+	for d in frappe.db.sql("select name, yearly_bgt_flag, monthly_bgt_flag from tabCompany", as_dict=1):
+		actions.setdefault(d.name, d)
+
+	budget_records = []
+	for d in existing_budgets:
+		budget = frappe.db.get_value("Budget",
+			{"cost_center": d.name, "fiscal_year": d.fiscal_year, "company": d.company})
+
+		if not budget:
+			budget = frappe.new_doc("Budget")
+			budget.cost_center = d.name
+			budget.fiscal_year = d.fiscal_year
+			budget.monthly_distribution = d.distribution_id
+			budget.company = d.company
+			if actions[d.company]["yearly_bgt_flag"]:
+				budget.action_if_annual_budget_exceeded = actions[d.company]["yearly_bgt_flag"]
+			if actions[d.company]["monthly_bgt_flag"]:
+				budget.action_if_accumulated_monthly_budget_exceeded = actions[d.company]["monthly_bgt_flag"]
+		else:
+			budget = frappe.get_doc("Budget", budget)
+
+		budget.append("accounts", {
+			"account": d.account,
+			"budget_amount": d.budget_allocated
+		})
+
+		try:
+			budget.insert()
+			budget_records.append(budget)
+		except DuplicateBudgetError:
+			pass
+
+	for budget in budget_records:
+		budget.submit()
+
+	if frappe.db.get_value("DocType", "Budget Detail"):
+		frappe.delete_doc("DocType", "Budget Detail")
\ No newline at end of file
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/projects/doctype/time_log/time_log_list.js b/erpnext/projects/doctype/time_log/time_log_list.js
index e9e7d05..4428bf6 100644
--- a/erpnext/projects/doctype/time_log/time_log_list.js
+++ b/erpnext/projects/doctype/time_log/time_log_list.js
@@ -34,10 +34,6 @@
 			// select only billable time logs
 			for(var i in selected) {
 				var d = selected[i];
-				if(!d.billable) {
-					msgprint(__("Time Log is not billable") + ": " + d.name + " - " + d.title);
-					return;
-				}
 				if(d.status=="Batched for Billing") {
 					msgprint(__("Time Log has been Batched for Billing") + ": " + d.name + " - " + d.title);
 					return;
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index 340ebdb..cf412e1 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -26,7 +26,8 @@
 		"public/js/payment/pos_payment.html",
 		"public/js/payment/payment_details.html",
 		"public/js/templates/item_selector.html",
-		"public/js/utils/item_selector.js"
+		"public/js/utils/item_selector.js",
+		"public/js/utils/document_flow.js"
 	],
 	"js/item-dashboard.min.js": [
 		"stock/dashboard/item_dashboard.html",
diff --git a/erpnext/public/css/erpnext.css b/erpnext/public/css/erpnext.css
index 6777e1e..719f259 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -118,9 +118,56 @@
 }
 .dashboard-list-item {
   background-color: inherit;
-  padding: 7px 15px;
+  padding: 5px 0px;
   border-bottom: 1px solid #d1d8dd;
 }
+#page-stock-balance .dashboard-list-item {
+  padding: 5px 15px;
+}
 .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/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index f775f29..cf66501 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -577,7 +577,7 @@
 		var me = this;
 		var paid_amount = base_paid_amount = 0.0;
 		$.each(this.frm.doc['payments'] || [], function(index, data){
-			if(data.amount > 0){
+			if(data.amount > -1){
 				data.base_amount = flt(data.amount * me.frm.doc.conversion_rate);
 				paid_amount += data.amount;
 				base_paid_amount += data.base_amount;	
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/payment/payment_details.html b/erpnext/public/js/payment/payment_details.html
index b0f61d8..18f9d03 100644
--- a/erpnext/public/js/payment/payment_details.html
+++ b/erpnext/public/js/payment/payment_details.html
@@ -1,4 +1,11 @@
 <div class="row pos-payment-row" type="{{type}}" idx={{idx}}>
-    <div class="col-xs-6"><h5 class="payment-mode text-ellipsis" idx="{{idx}}"> {{mode_of_payment}} </h5></div>
-	<div class="col-xs-6 text-right"><input disabled data-fieldtype="Currency" class="input-with-feedback form-control text-right amount" idx="{{idx}}" type="text" value="{{format_number(amount, 2)}}"></div>
+    <div class="col-xs-6">{{mode_of_payment}}</div>
+	<div class="col-xs-6">
+		<div class="input-group">
+			<input disabled class="form-control text-right amount" idx="{{idx}}" type="text" value="{{format_number(amount, 2)}}">
+			<span class="input-group-btn">
+				<button type="button" class="btn btn-default clr" idx="{{idx}}" style="border:1px solid #d1d8dd">C</button>
+			</span>
+		</div>
+	</div>
 </div>
\ No newline at end of file
diff --git a/erpnext/public/js/payment/payments.js b/erpnext/public/js/payment/payments.js
index f5527b1..4cd12f1 100644
--- a/erpnext/public/js/payment/payments.js
+++ b/erpnext/public/js/payment/payments.js
@@ -31,6 +31,7 @@
 		$(this.$body).html(frappe.render_template('pos_payment', this.frm.doc))
 		this.show_payment_details();
 		this.bind_keyboard_event()
+		this.clear_amount()
 	},
 
 	make_multimode_payment: function(){
@@ -57,11 +58,33 @@
 					currency: me.frm.doc.currency,
 					type: data.type
 				})).appendTo(multimode_payments)
+
+				if (data.type == 'Cash' && me.frm.doc.outstanding_amount > 0) {
+					me.idx = data.idx;
+					me.set_outstanding_amount();
+				}
 			})
 		}else{
 			$("<p>No payment mode selected in pos profile</p>").appendTo(multimode_payments)
 		}
 	},
+
+	set_outstanding_amount: function(){
+		this.selected_mode = $(this.$body).find(repl("input[idx='%(idx)s']",{'idx': this.idx}));
+		this.highlight_selected_row()
+		this.payment_val = 0.0
+		if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
+			//When user first tithis click on row
+			this.payment_val = flt(this.frm.doc.outstanding_amount)
+			this.selected_mode.val(format_number(this.payment_val, 2));
+			this.update_paid_amount()
+		}else if(flt(this.selected_mode.val()) > 0){
+			//If user click on existing row which has value
+			this.payment_val = flt(this.selected_mode.val());
+		}
+		this.selected_mode.select()
+		this.bind_amount_change_event();
+	},
 	
 	bind_keyboard_event: function(){
 		var me = this;
@@ -69,28 +92,15 @@
 		this.bind_payment_mode_keys_event();
 		this.bind_keyboard_keys_event();
 	},
-	
+
 	bind_payment_mode_keys_event: function(){
 		var me = this;
 		$(this.$body).find('.pos-payment-row').click(function(){
 			me.idx = $(this).attr("idx");
-			me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
-			me.highlight_selected_row()
-			me.payment_val = 0.0
-			if(me.frm.doc.outstanding_amount > 0 && flt(me.selected_mode.val()) == 0.0){
-				//When user first time click on row
-				me.payment_val = flt(me.frm.doc.outstanding_amount)
-				me.selected_mode.val(format_number(me.payment_val, 2));
-				me.update_paid_amount()
-			}else if(flt(me.selected_mode.val()) > 0){
-				//If user click on existing row which has value
-				me.payment_val = flt(me.selected_mode.val());
-			}
-			me.selected_mode.select()
-			me.bind_amount_change_event();
+			me.set_outstanding_amount()
 		})
 	},
-	
+
 	highlight_selected_row: function(){
 		var me = this;
 		selected_row = $(this.$body).find(repl(".pos-payment-row[idx='%(idx)s']",{'idx': this.idx}));
@@ -127,7 +137,19 @@
 			me.update_paid_amount()
 		})
 	},
-	
+
+	clear_amount: function(){
+		var me = this;
+		$(this.$body).find('.clr').click(function(e){
+			e.stopPropagation();
+			me.idx = $(this).attr("idx");
+			me.selected_mode = $(me.$body).find(repl("input[idx='%(idx)s']",{'idx': me.idx}));
+			me.payment_val = 0.0;
+			me.selected_mode.val(0.0);
+			me.update_paid_amount();
+		})
+	},
+
 	update_paid_amount: function(){
 		var me = this;
 		$.each(this.frm.doc.payments, function(index, data){
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..c0b4764 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-2">{%= sr %}</div>
+	<div class="col-xs-4">{%= customer %}</div>
+	<div class="col-xs-2 text-left"><span class="indicator {{data.indicator}}">{{ data.status }}</span></div>
+	<div class="col-xs-4 text-right">{%= grand_total %}</div>
 </div>
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 2eb73a3..d3ff8eb 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -269,7 +269,7 @@
 							"default": __("Products")},
 						{fieldtype:"Select", fieldname:"item_uom_" + i, label:__("UOM"),
 							options:[__("Unit"), __("Nos"), __("Box"), __("Pair"), __("Kg"), __("Set"),
-								__("Hour"), __("Minute")],
+								__("Hour"), __("Minute"), __("Litre"), __("Meter"), __("Gram")],
 							"default": __("Unit")},
 						{fieldtype: "Check", fieldname: "is_sales_item_" + i, label:__("We sell this Item"), default: 1},
 						{fieldtype: "Check", fieldname: "is_purchase_item_" + i, label:__("We buy this Item")},
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/js/utils/document_flow.js b/erpnext/public/js/utils/document_flow.js
new file mode 100644
index 0000000..eaad6f8
--- /dev/null
+++ b/erpnext/public/js/utils/document_flow.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+// MIT License. See license.txt
+
+// for module flow
+
+$.extend(frappe.document_flow, {
+	"Selling": {
+		"Sales Order": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Quotation": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"]
+	},
+	"Accounts": {
+		"Sales Invoice": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Purchase Invoice": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
+			"Purchase Invoice", "Journal Entry"]
+	},
+	"Buying": {
+		"Purchase Order": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
+			"Purchase Invoice", "Journal Entry"],
+		"Supplier Quotation": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
+			"Purchase Invoice", "Journal Entry"]
+	},
+	"Stock": {
+		"Delivery Note": ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice", "Journal Entry"],
+		"Purchase Receipt": ["Supplier Quotation", "Purchase Order", "Purchase Receipt",
+			"Purchase Invoice", "Journal Entry"]
+	}
+});
diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less
index 58e8e62..404540a 100644
--- a/erpnext/public/less/erpnext.less
+++ b/erpnext/public/less/erpnext.less
@@ -149,10 +149,63 @@
 
 .dashboard-list-item {
 	background-color: inherit;
-	padding: 7px 15px;
+	padding: 5px 0px;
 	border-bottom: 1px solid @border-color;
 }
 
+#page-stock-balance .dashboard-list-item {
+	padding: 5px 15px;
+}
+
 .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;
+	height: 60px;
+}
+
+.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-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/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index aac9360..2a954b1 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -504,6 +504,30 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "fieldname": "website", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Website", 
+   "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": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
    "fieldname": "column_break1", 
    "fieldtype": "Column Break", 
    "hidden": 0, 
@@ -765,30 +789,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "website", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Website", 
-   "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": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "is_frozen", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -949,13 +949,14 @@
  "icon": "icon-user", 
  "idx": 363, 
  "image_field": "image", 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-05-13 17:50:42.227329", 
+ "modified": "2016-06-09 14:39:17.712638", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Customer", 
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 9e5283c..f61f0e9 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -16,7 +16,6 @@
 	},
 	refresh: function(doc, dt, dn) {
 		this._super(doc, dt, dn);
-
 		if(doc.docstatus == 1 && doc.status!=='Lost') {
 			cur_frm.add_custom_button(__('Make Sales Order'),
 				cur_frm.cscript['Make Sales Order']);
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 9cc7473..6ed1888 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -63,7 +63,7 @@
 
 	def on_cancel(self):
 		#update enquiry status
-		self.set_status()
+		self.set_status(update=True)
 		self.update_opportunity()
 
 	def print_other_charges(self,docname):
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 29501f5..ce9c958 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -21,7 +21,7 @@
 		this.frm.dashboard.reset();
 		var allow_purchase = false;
 		var allow_delivery = false;
-
+		
 		if(doc.docstatus==1) {
 			if(doc.status != 'Closed') {
 
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/selling/page/sales_browser/sales_browser.json b/erpnext/selling/page/sales_browser/sales_browser.json
index ace9203..54cac65 100644
--- a/erpnext/selling/page/sales_browser/sales_browser.json
+++ b/erpnext/selling/page/sales_browser/sales_browser.json
@@ -1,37 +1,37 @@
 {
- "creation": "2012-06-14 15:07:26.000000", 
- "docstatus": 0, 
- "doctype": "Page", 
- "icon": "icon-sitemap", 
- "idx": 1, 
- "modified": "2013-07-11 14:43:56.000000", 
- "modified_by": "Administrator", 
- "module": "Selling", 
- "name": "Sales Browser", 
- "owner": "Administrator", 
- "page_name": "Sales Browser", 
+ "creation": "2012-06-14 15:07:26.000000",
+ "docstatus": 0,
+ "doctype": "Page",
+ "icon": "icon-sitemap",
+ "idx": 1,
+ "modified": "2013-07-11 14:43:56.000000",
+ "modified_by": "Administrator",
+ "module": "Selling",
+ "name": "sales-browser",
+ "owner": "Administrator",
+ "page_name": "Sales Browser",
  "roles": [
   {
    "role": "Sales Master Manager"
-  }, 
+  },
   {
    "role": "Material Master Manager"
-  }, 
+  },
   {
    "role": "Accounts Manager"
-  }, 
+  },
   {
    "role": "Sales Master Manager"
-  }, 
+  },
   {
    "role": "Purchase Manager"
-  }, 
+  },
   {
    "role": "Purchase Master Manager"
-  }, 
+  },
   {
    "role": "Material Manager"
   }
- ], 
+ ],
  "standard": "Yes"
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 9d6785d..9140534 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:company_name", 
+ "beta": 0, 
  "creation": "2013-04-10 08:35:39", 
  "custom": 0, 
  "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.", 
@@ -661,7 +662,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "Cost Center", 
+   "label": "Deafult Cost Center", 
    "length": 0, 
    "no_copy": 1, 
    "options": "Cost Center", 
@@ -679,59 +680,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "credit_days_based_on", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Credit Days Based On", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nFixed Days\nLast Day of the Next Month", 
-   "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, 
-   "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')", 
-   "fieldname": "credit_days", 
-   "fieldtype": "Int", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Credit Days", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "credit_days", 
-   "oldfieldtype": "Int", 
-   "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, 
    "depends_on": "eval:!doc.__islocal", 
    "fieldname": "credit_limit", 
    "fieldtype": "Currency", 
@@ -784,21 +732,19 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "yearly_bgt_flag", 
+   "fieldname": "credit_days_based_on", 
    "fieldtype": "Select", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "If Yearly Budget Exceeded (for expense account)", 
+   "label": "Credit Days Based On", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "yearly_bgt_flag", 
-   "oldfieldtype": "Select", 
-   "options": "\nWarn\nIgnore\nStop", 
+   "options": "\nFixed Days\nLast Day of the Next Month", 
    "permlevel": 0, 
+   "precision": "", 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
@@ -812,20 +758,19 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "depends_on": "eval:!doc.__islocal", 
-   "fieldname": "monthly_bgt_flag", 
-   "fieldtype": "Select", 
+   "depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')", 
+   "fieldname": "credit_days", 
+   "fieldtype": "Int", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "If Monthly Budget Exceeded (for expense account)", 
+   "label": "Credit Days", 
    "length": 0, 
    "no_copy": 0, 
-   "oldfieldname": "monthly_bgt_flag", 
-   "oldfieldtype": "Select", 
-   "options": "\nWarn\nIgnore\nStop", 
+   "oldfieldname": "credit_days", 
+   "oldfieldtype": "Int", 
    "permlevel": 0, 
    "print_hide": 0, 
    "print_hide_if_no_value": 0, 
@@ -1387,7 +1332,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-03-10 04:34:43.440914", 
+ "modified": "2016-05-16 15:24:47.178826", 
  "modified_by": "Administrator", 
  "module": "Setup", 
  "name": "Company", 
@@ -1534,7 +1479,9 @@
    "write": 0
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 0, 
- "sort_order": "ASC"
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 800e19e..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,17 +194,12 @@
 
 		rec = frappe.db.sql("SELECT name from `tabGL Entry` where company = %s", self.name)
 		if not rec:
-			# delete Account
-			frappe.db.sql("delete from `tabAccount` where company = %s", self.name)
-
-			# delete cost center child table - budget detail
-			frappe.db.sql("""delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc
-				where bd.parent = cc.name and cc.company = %s""", self.name)
-			#delete cost center
-			frappe.db.sql("delete from `tabCost Center` WHERE company = %s", self.name)
-
-			# delete account from customer and supplier
-			frappe.db.sql("delete from `tabParty Account` where 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)
 
 		if not frappe.db.get_value("Stock Ledger Entry", {"company": self.name}):
 			frappe.db.sql("""delete from `tabWarehouse` where company=%s""", self.name)
diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py
index b07a794..a78898f 100644
--- a/erpnext/setup/doctype/company/delete_company_transactions.py
+++ b/erpnext/setup/doctype/company/delete_company_transactions.py
@@ -14,7 +14,8 @@
 	doc = frappe.get_doc("Company", company_name)
 
 	if frappe.session.user != doc.owner:
-		frappe.throw(_("Transactions can only be deleted by the creator of the Company"), frappe.PermissionError)
+		frappe.throw(_("Transactions can only be deleted by the creator of the Company"), 
+			frappe.PermissionError)
 
 	delete_bins(company_name)
 	delete_time_logs(company_name)
@@ -22,7 +23,7 @@
 
 	for doctype in frappe.db.sql_list("""select parent from
 		tabDocField where fieldtype='Link' and options='Company'"""):
-		if doctype not in ("Account", "Cost Center", "Warehouse", "Budget Detail",
+		if doctype not in ("Account", "Cost Center", "Warehouse", "Budget",
 			"Party Account", "Employee", "Sales Taxes and Charges Template",
 			"Purchase Taxes and Charges Template", "POS Profile", 'BOM'):
 				delete_for_doctype(doctype, company_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/domainify.py b/erpnext/setup/setup_wizard/domainify.py
index af4317e..f77b05d 100644
--- a/erpnext/setup/setup_wizard/domainify.py
+++ b/erpnext/setup/setup_wizard/domainify.py
@@ -8,7 +8,7 @@
 	'Manufacturing': {
 		'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
 			'Production Order',  'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling',
-			 'Accounts', 'HR'],
+			 'Accounts', 'HR', 'ToDo'],
 		'properties': [
 			{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'collapsible_depends_on', 'value': 'is_stock_item'},
 		],
@@ -19,7 +19,7 @@
 
 	'Retail': {
 		'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice',  'Purchase Order', 'Warranty Claim',
-		'Accounts', 'Buying'],
+		'Accounts', 'Buying', 'ToDo'],
 		'remove_roles': ['Manufacturing User', 'Manufacturing Manager'],
 		'properties': [
 			{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
@@ -32,7 +32,7 @@
 
 	'Distribution': {
 		'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order',
-			 'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR'],
+			 'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'],
 		'remove_roles': ['Manufacturing User', 'Manufacturing Manager'],
 		'properties': [
 			{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
@@ -44,7 +44,7 @@
 
 	'Services': {
 		'desktop_icons': ['Project', 'Time Log', 'Customer', 'Sales Order', 'Sales Invoice', 'Lead', 'Opportunity',
-			'Expense Claim', 'Employee', 'HR'],
+			'Expense Claim', 'Employee', 'HR', 'ToDo'],
 		'remove_roles': ['Manufacturing User', 'Manufacturing Manager'],
 		'properties': [
 			{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index d3d0cb4..f2b72f4 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -120,6 +120,9 @@
 		{'uom_name': _('Unit'), 'doctype': 'UOM', 'name': _('Unit'), "must_be_whole_number": 1},
 		{'uom_name': _('Box'), 'doctype': 'UOM', 'name': _('Box'), "must_be_whole_number": 1},
 		{'uom_name': _('Kg'), 'doctype': 'UOM', 'name': _('Kg')},
+		{'uom_name': _('Meter'), 'doctype': 'UOM', 'name': _('Meter')},
+		{'uom_name': _('Litre'), 'doctype': 'UOM', 'name': _('Litre')},
+		{'uom_name': _('Gram'), 'doctype': 'UOM', 'name': _('Gram')},
 		{'uom_name': _('Nos'), 'doctype': 'UOM', 'name': _('Nos'), "must_be_whole_number": 1},
 		{'uom_name': _('Pair'), 'doctype': 'UOM', 'name': _('Pair'), "must_be_whole_number": 1},
 		{'uom_name': _('Set'), 'doctype': 'UOM', 'name': _('Set'), "must_be_whole_number": 1},
@@ -127,11 +130,17 @@
 		{'uom_name': _('Minute'), 'doctype': 'UOM', 'name': _('Minute')},
 
 		# Mode of Payment
-		{'doctype': 'Mode of Payment', 'mode_of_payment': 'Check' if country=="United States" else _('Cheque')},
-		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Cash')},
-		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Credit Card')},
-		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Wire Transfer')},
-		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Bank Draft')},
+		{'doctype': 'Mode of Payment',
+			'mode_of_payment': 'Check' if country=="United States" else _('Cheque'),
+			'type': 'Bank'},
+		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Cash'),
+			'type': 'Cash'},
+		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Credit Card'),
+			'type': 'Bank'},
+		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Wire Transfer'),
+			'type': 'Bank'},
+		{'doctype': 'Mode of Payment', 'mode_of_payment': _('Bank Draft'),
+			'type': 'Bank'},
 
 		# Activity Type
 		{'doctype': 'Activity Type', 'activity_type': _('Planning')},
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/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index 6d31386..c5fce7d 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -8,7 +8,6 @@
 erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
 	refresh: function(doc, dt, dn) {
 		this._super();
-
 		if (!doc.is_return && doc.status!="Closed") {
 			if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
 				cur_frm.add_custom_button(__('Installation Note'), this.make_installation_note, __("Make"));
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index a0c1e8a..fe7e54e 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -174,7 +174,7 @@
 		frm.dashboard.show_dashboard();
 
 		frappe.require('assets/js/item-dashboard.min.js', function() {
-			var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;">Stock Levels</h5>');
+			var section = frm.dashboard.add_section('<h5 style="margin-top: 0px;"><a href="#stock-balance">Stock Levels</a></h5>');
 			erpnext.item.item_dashboard = new erpnext.stock.ItemDashboard({
 				parent: section,
 				item_code: frm.doc.name
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/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 19467d9..6e993c2 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-03-07 14:48:38", 
  "custom": 0, 
  "docstatus": 0, 
@@ -301,6 +302,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "default": "Today", 
    "fieldname": "transaction_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -569,6 +571,7 @@
  "hide_toolbar": 0, 
  "icon": "icon-ticket", 
  "idx": 70, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 1, 
@@ -576,7 +579,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-04-15 05:41:26.657236", 
+ "modified": "2016-06-08 16:36:41.295001", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Material Request", 
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index a967b5b..f622b63 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -29,7 +29,7 @@
 				}
 			})
 		})
-		
+
 		frm.set_query("supplier_warehouse", function() {
 			return {
 				filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
@@ -41,7 +41,6 @@
 erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
 	refresh: function() {
 		this._super();
-
 		if(this.frm.doc.docstatus===1) {
 			this.show_stock_ledger();
 			if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
@@ -71,9 +70,9 @@
 				if (this.frm.has_perm("submit")) {
 					cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt, __("Status"))
 				}
-				
+
 				cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __("Make"));
-				
+
 				if(flt(this.frm.doc.per_billed) < 100) {
 					cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __("Make"));
 				}
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 7122459..62ecee6 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1,8 +1,9 @@
 {
  "allow_copy": 0, 
- "allow_import": 0, 
+ "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-05-21 16:16:39", 
  "custom": 0, 
  "docstatus": 0, 
@@ -198,6 +199,7 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
+   "default": "Today", 
    "fieldname": "posting_date", 
    "fieldtype": "Date", 
    "hidden": 0, 
@@ -2409,6 +2411,7 @@
  "hide_toolbar": 0, 
  "icon": "icon-truck", 
  "idx": 261, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 1, 
@@ -2416,7 +2419,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-04-06 05:39:45.971761", 
+ "modified": "2016-06-09 15:11:04.042369", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
@@ -2523,6 +2526,7 @@
    "write": 1
   }
  ], 
+ "quick_entry": 0, 
  "read_only": 0, 
  "read_only_onload": 1, 
  "search_fields": "status, posting_date, supplier", 
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/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
index 0ac9410..b75eeea 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
@@ -70,7 +70,8 @@
 		"basic_rate": args.rate or args.basic_rate,
 		"conversion_factor": 1.0,
 		"serial_no": args.serial_no,
-		'cost_center': args.cost_center
+		'cost_center': args.cost_center,
+		'expense_account': args.expense_account
 	})
 
 	if not args.do_not_save:
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index 221724f..0c33ff7 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -122,8 +122,8 @@
 		set_perpetual_inventory()
 
 		mr = make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC",
-			qty=50, basic_rate=100)
-
+			qty=50, basic_rate=100, expense_account="Stock Adjustment - _TC")
+					
 		stock_in_hand_account = frappe.db.get_value("Account", {"account_type": "Warehouse",
 			"warehouse": mr.get("items")[0].t_warehouse})
 
@@ -149,9 +149,10 @@
 		set_perpetual_inventory()
 
 		make_stock_entry(item_code="_Test Item", target="_Test Warehouse - _TC",
-			qty=50, basic_rate=100)
+			qty=50, basic_rate=100, expense_account="Stock Adjustment - _TC")
 
-		mi = make_stock_entry(item_code="_Test Item", source="_Test Warehouse - _TC", qty=40)
+		mi = make_stock_entry(item_code="_Test Item", source="_Test Warehouse - _TC", 
+			qty=40, expense_account="Stock Adjustment - _TC")
 
 		self.check_stock_ledger_entries("Stock Entry", mi.name,
 			[["_Test Item", "_Test Warehouse - _TC", -40.0]])
diff --git a/erpnext/stock/page/stock_balance/stock_balance.js b/erpnext/stock/page/stock_balance/stock_balance.js
index 2b6fd8d..efaf96f 100644
--- a/erpnext/stock/page/stock_balance/stock_balance.js
+++ b/erpnext/stock/page/stock_balance/stock_balance.js
@@ -7,7 +7,7 @@
 	page.start = 0;
 
 	page.warehouse_field = page.add_field({
-		fieldname: 'wareshouse',
+		fieldname: 'warehouse',
 		label: __('Warehouse'),
 		fieldtype:'Link',
 		options:'Warehouse',
diff --git a/erpnext/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json b/erpnext/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json
index d4b6a40..a361ffb 100644
--- a/erpnext/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json
+++ b/erpnext/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.json
@@ -2,16 +2,17 @@
  "add_total_row": 1, 
  "apply_user_permissions": 1, 
  "creation": "2013-05-13 16:23:05", 
+ "disabled": 0, 
  "docstatus": 0, 
  "doctype": "Report", 
  "idx": 1, 
  "is_standard": "Yes", 
- "modified": "2015-03-30 05:47:31.113927", 
+ "modified": "2016-06-08 16:40:17.254701", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Requested Items To Be Transferred", 
  "owner": "Administrator", 
- "query": "select \n    mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Transferred Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Transfer:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Transfer\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", 
+ "query": "select \n    mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Transferred Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Transfer:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type in (\"Material Transfer\", \"Material Issue\")\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc", 
  "ref_doctype": "Stock Entry", 
  "report_name": "Requested Items To Be Transferred", 
  "report_type": "Query Report"
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index d3fa482..292bd61 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -141,7 +141,7 @@
 			"stock_value": self.stock_value
 		})
 		bin_doc.flags.via_stock_ledger_entry = True
-		
+
 		bin_doc.save(ignore_permissions=True)
 
 	def process_sle(self, sle):
@@ -211,7 +211,7 @@
 		if incoming_rate < 0:
 			# wrong incoming rate
 			incoming_rate = self.valuation_rate
-			
+
 		stock_value_change = 0
 		if incoming_rate:
 			stock_value_change = actual_qty * incoming_rate
@@ -334,11 +334,23 @@
 
 	def raise_exceptions(self):
 		deficiency = min(e["diff"] for e in self.exceptions)
-		msg = _("Negative Stock Error ({6}) for Item {0} in Warehouse {1} on {2} {3} in {4} {5}").format(self.item_code,
-			self.warehouse, self.exceptions[0]["posting_date"], self.exceptions[0]["posting_time"],
-			_(self.exceptions[0]["voucher_type"]), self.exceptions[0]["voucher_no"], deficiency)
+
+
+
+		if frappe.local.flags.currently_saving.doctype==self.exceptions[0]["voucher_type"] \
+			and frappe.local.flags.currently_saving.name==self.exceptions[0]["voucher_no"]:
+			msg = _("{0} units of {1} needed in {2} to complete this transaction.").format(
+				abs(deficiency), frappe.get_desk_link('Item', self.item_code),
+				frappe.get_desk_link('Warehouse', self.warehouse))
+		else:
+			msg = _("{0} units of {1} needed in {2} on {3} {4} for {5} to complete this transaction.").format(
+				abs(deficiency), frappe.get_desk_link('Item', self.item_code),
+				frappe.get_desk_link('Warehouse', self.warehouse),
+				self.exceptions[0]["posting_date"], self.exceptions[0]["posting_time"],
+				frappe.get_desk_link(self.exceptions[0]["voucher_type"], self.exceptions[0]["voucher_no"]))
+
 		if self.verbose:
-			frappe.throw(msg, NegativeStockError)
+			frappe.throw(msg, NegativeStockError, title='Insufficent Stock')
 		else:
 			raise NegativeStockError, msg
 
diff --git a/erpnext/support/doctype/issue/issue.js b/erpnext/support/doctype/issue/issue.js
index 15029a0..21ef5b8 100644
--- a/erpnext/support/doctype/issue/issue.js
+++ b/erpnext/support/doctype/issue/issue.js
@@ -8,12 +8,12 @@
 			frm.add_custom_button(__("Close"), function() {
 				frm.set_value("status", "Closed");
 				frm.save();
-			}, __("Status"));
+			});
 		} else {
 			frm.add_custom_button(__("Reopen"), function() {
 				frm.set_value("status", "Open");
 				frm.save();
-			}, __("Status"));
+			});
 		}
 	}
 });
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 6c0662e..be9603b 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "naming_series:", 
+ "beta": 0, 
  "creation": "2013-02-01 10:36:25", 
  "custom": 0, 
  "docstatus": 0, 
@@ -166,29 +167,33 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "fold", 
-   "fieldtype": "Fold", 
+   "fieldname": "customer", 
+   "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
-   "in_filter": 0, 
+   "in_filter": 1, 
    "in_list_view": 0, 
+   "label": "Customer", 
    "length": 0, 
    "no_copy": 0, 
+   "oldfieldname": "customer", 
+   "oldfieldtype": "Link", 
+   "options": "Customer", 
    "permlevel": 0, 
-   "print_hide": 0, 
+   "print_hide": 1, 
    "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
-   "search_index": 0, 
+   "search_index": 1, 
    "set_only_once": 0, 
    "unique": 0
   }, 
   {
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 0, 
+   "collapsible": 1, 
    "fieldname": "section_break_7", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -196,6 +201,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "label": "Details", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -314,7 +320,7 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 0, 
+   "collapsible": 1, 
    "fieldname": "additional_info", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -322,7 +328,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
-   "label": "", 
+   "label": "Contact", 
    "length": 0, 
    "no_copy": 0, 
    "options": "icon-pushpin", 
@@ -412,33 +418,6 @@
   }, 
   {
    "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "customer", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Customer", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "customer", 
-   "oldfieldtype": "Link", 
-   "options": "Customer", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "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": 1, 
    "collapsible": 0, 
    "fieldname": "customer_name", 
@@ -492,7 +471,7 @@
   {
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 0, 
+   "collapsible": 1, 
    "fieldname": "section_break_19", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -500,6 +479,7 @@
    "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 0, 
+   "label": "Resolution", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -703,7 +683,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-06 03:15:20.756565", 
+ "modified": "2016-06-04 16:01:15.860333", 
  "modified_by": "Administrator", 
  "module": "Support", 
  "name": "Issue", 
@@ -730,6 +710,7 @@
    "write": 1
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
  "read_only_onload": 0, 
  "search_fields": "status,customer,subject,raised_by", 
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/templates/pages/order.html b/erpnext/templates/pages/order.html
index 61b4546..b548e1f 100644
--- a/erpnext/templates/pages/order.html
+++ b/erpnext/templates/pages/order.html
@@ -82,7 +82,7 @@
 				or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0) %}
 			<div class="page-header-actions-block" data-html-block="header-actions">
 				<p>
-				    <a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1&mute_email=1&cart=1"
+				    <a href="/api/method/erpnext.accounts.doctype.payment_request.payment_request.make_payment_request?dn={{ doc.name }}&dt={{ doc.doctype }}&submit_doc=1"
 				        class="btn btn-primary btn-sm">Pay {{ doc.get_formatted("grand_total") }} </a>
 				</p>
 			</div>
diff --git a/erpnext/utilities/address_and_contact.py b/erpnext/utilities/address_and_contact.py
index d175db6..a2e566f 100644
--- a/erpnext/utilities/address_and_contact.py
+++ b/erpnext/utilities/address_and_contact.py
@@ -80,7 +80,7 @@
 	meta = frappe.get_meta(doctype)
 
 	for df in meta.get_link_fields():
-		if df.options not in ("Customer", "Supplier", "Sales Partner"):
+		if df.options not in ("Customer", "Supplier", "Company", "Sales Partner"):
 			continue
 
 		if frappe.has_permission(df.options):
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..5dd87ab 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,15 @@
+# -*- coding: utf-8 -*-
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
+import re, ast
 
-version = "6.27.19"
+# get version from __version__ variable in erpnext/__init__.py
+_version_re = re.compile(r'__version__\s+=\s+(.*)')
+
+with open('erpnext/__init__.py', 'rb') as f:
+    version = str(ast.literal_eval(_version_re.search(
+        f.read().decode('utf-8')).group(1)))
+
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(