Merge pull request #5367 from KanchanChauhan/job_openings_public

[Minor Fix] Job Opening should not require login
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 4cc1cec..f801959 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.27.17'
+__version__ = '6.27.21'
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index a551d06..718ba31 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -19,8 +19,12 @@
 			self.get("__onload").can_freeze_account = True
 
 	def autoname(self):
-		self.name = self.account_name.strip() + ' - ' + \
-			frappe.db.get_value("Company", self.company, "abbr")
+		# first validate if company exists
+		company = frappe.db.get_value("Company", self.company, ["abbr", "name"], as_dict=True)
+		if not company:
+			frappe.throw(_('Company {0} does not exist').format(self.company))
+
+		self.name = self.account_name.strip() + ' - ' + company.abbr
 
 	def validate(self):
 		if frappe.local.flags.allow_unverified_charts:
@@ -68,7 +72,7 @@
 				if self.root_type != db_value.root_type:
 					frappe.db.sql("update `tabAccount` set root_type=%s where lft > %s and rgt < %s",
 						(self.root_type, self.lft, self.rgt))
-						
+
 		if self.root_type and not self.report_type:
 			self.report_type = "Balance Sheet" \
 				if self.root_type in ("Asset", "Liability", "Equity") else "Profit and Loss"
@@ -78,14 +82,14 @@
 		if frappe.db.exists("Account", self.name):
 			if not frappe.db.get_value("Account", self.name, "parent_account"):
 				throw(_("Root cannot be edited."), RootNotEditable)
-				
+
 		if not self.parent_account and not self.is_group:
 			frappe.throw(_("Root Account must be a group"))
-			
+
 	def validate_group_or_ledger(self):
 		if self.get("__islocal"):
 			return
-		
+
 		existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
 		if cint(self.is_group) != cint(existing_is_group):
 			if self.check_gle_exists():
@@ -153,7 +157,7 @@
 	def validate_mandatory(self):
 		if not self.root_type:
 			throw(_("Root Type is mandatory"))
-			
+
 		if not self.report_type:
 			throw(_("Report Type is mandatory"))
 
@@ -213,9 +217,9 @@
 
 			if val != [self.is_group, self.root_type, self.company]:
 				throw(_("""Merging is only possible if following properties are same in both records. Is Group, Root Type, Company"""))
-				
+
 			if self.is_group and frappe.db.get_value("Account", new, "parent_account") == old:
-				frappe.db.set_value("Account", new, "parent_account", 
+				frappe.db.set_value("Account", new, "parent_account",
 					frappe.db.get_value("Account", old, "parent_account"))
 
 		return new_account
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/account/chart_of_accounts/verified/standard_chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
index 68aa310..386b229 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
@@ -120,7 +120,8 @@
 	        },
 	        _("Indirect Income"): {
 				"is_group": 1
-	        }
+	        },
+	        "root_type": "Income"
 	    },
 	    _("Source of Funds (Liabilities)"): {
 	        _("Current Liabilities"): {
diff --git a/erpnext/accounts/doctype/asset/asset.js b/erpnext/accounts/doctype/asset/asset.js
index 0479a4e..e6d8b3b 100644
--- a/erpnext/accounts/doctype/asset/asset.js
+++ b/erpnext/accounts/doctype/asset/asset.js
@@ -90,12 +90,25 @@
 			last_depreciation_date = frm.doc.disposal_date;
 		}
 		
-		frm.dashboard.reset();
-		frm.dashboard.add_graph({
-			x: 'x',
-			columns: [x_intervals, asset_values],
-			regions: {
-				'Asset Value': [{'start': last_depreciation_date, 'style':'dashed'}]
+		frm.dashboard.setup_chart({
+			data: {
+				x: 'x',
+				columns: [x_intervals, asset_values],
+				regions: {
+					'Asset Value': [{'start': last_depreciation_date, 'style':'dashed'}]
+				}
+			},
+			legend: {
+				show: false
+			},
+			axis: {
+				x: {
+					type: 'category'
+				},
+				y: {
+					min: 0,
+					padding: {bottom: 10}
+				}
 			}
 		});		
 	},
diff --git a/erpnext/accounts/doctype/asset/asset.json b/erpnext/accounts/doctype/asset/asset.json
index c272a58..fa53aed 100644
--- a/erpnext/accounts/doctype/asset/asset.json
+++ b/erpnext/accounts/doctype/asset/asset.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:asset_name", 
+ "beta": 0, 
  "creation": "2016-03-01 17:01:27.920130", 
  "custom": 0, 
  "docstatus": 0, 
@@ -738,7 +739,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-04-22 11:15:40.055518", 
+ "modified": "2016-05-30 18:09:56.158782", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Asset", 
diff --git a/erpnext/accounts/doctype/budget/__init__.py b/erpnext/accounts/doctype/budget/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/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/budget_account/__init__.py b/erpnext/accounts/doctype/budget_account/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/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/budget_account/budget_account.py b/erpnext/accounts/doctype/budget_account/budget_account.py
new file mode 100644
index 0000000..81b2709
--- /dev/null
+++ b/erpnext/accounts/doctype/budget_account/budget_account.py
@@ -0,0 +1,10 @@
+# -*- 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
+
+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/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.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index bc337a1..f670c90 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -6,6 +6,15 @@
 
 
 frappe.ui.form.on("Journal Entry", {
+	setup: function(frm) {
+		frm.get_field('accounts').grid.editable_fields = [
+			{fieldname: 'account', columns: 3},
+			{fieldname: 'party', columns: 4},
+			{fieldname: 'debit_in_account_currency', columns: 2},
+			{fieldname: 'credit_in_account_currency', columns: 2}
+		];
+	},
+
 	refresh: function(frm) {
 		erpnext.toggle_naming_series();
 		frm.cscript.voucher_type(frm.doc);
@@ -50,7 +59,7 @@
 	},
 
 	load_defaults: function() {
-		this.frm.show_print_first = true;
+		//this.frm.show_print_first = true;
 		if(this.frm.doc.__islocal && this.frm.doc.company) {
 			frappe.model.set_default_values(this.frm.doc);
 			$.each(this.frm.doc.accounts || [], function(i, jvd) {
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/party_account/party_account.json b/erpnext/accounts/doctype/party_account/party_account.json
index 4527531..e30346a 100644
--- a/erpnext/accounts/doctype/party_account/party_account.json
+++ b/erpnext/accounts/doctype/party_account/party_account.json
@@ -2,6 +2,7 @@
  "allow_copy": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
+ "beta": 0, 
  "creation": "2014-08-29 16:02:39.740505", 
  "custom": 0, 
  "docstatus": 0, 
@@ -16,6 +17,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Company", 
@@ -24,6 +26,7 @@
    "options": "Company", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -35,33 +38,11 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "col_break1", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "", 
-   "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, 
-   "width": "50%"
-  }, 
-  {
-   "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", 
@@ -70,6 +51,7 @@
    "options": "Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -80,21 +62,24 @@
  ], 
  "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": "2015-11-16 06:29:51.450360", 
+ "modified": "2016-05-20 11:47:16.625828", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Party Account", 
  "name_case": "", 
  "owner": "Administrator", 
  "permissions": [], 
+ "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/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..b1420fc 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -743,33 +743,6 @@
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
-   "fieldname": "cash_bank_account", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Cash/Bank Account", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "cash_bank_account", 
-   "oldfieldtype": "Link", 
-   "options": "Account", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
    "fieldname": "income_account", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -857,7 +830,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2016-05-09 00:00:30.610878", 
+ "modified": "2016-05-25 15:00:09.335025", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index 634d63c..5f4d5bc 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -27,7 +27,7 @@
 					self.company), raise_exception=1)
 
 	def validate_all_link_fields(self):
-		accounts = {"Account": [self.cash_bank_account, self.income_account,
+		accounts = {"Account": [self.income_account,
 			self.expense_account], "Cost Center": [self.cost_center],
 			"Warehouse": [self.warehouse]}
 
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 923514d..b634ccf 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -15,16 +15,21 @@
 				this.frm.set_df_property("credit_to", "print_hide", 0);
 			}
 		}
+
+		// formatter for material request item
+		this.frm.set_indicator_formatter('item_code',
+			function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
+
 	},
 
 	refresh: function(doc) {
 		this._super();
-		
+
 		hide_fields(this.frm.doc);
 
 		// Show / Hide button
 		this.show_general_ledger();
-		
+
 		if(doc.update_stock==1 && doc.docstatus==1) {
 			this.show_stock_ledger();
 		}
@@ -34,13 +39,13 @@
 				this.frm.add_custom_button(__('Payment'), this.make_bank_entry, __("Make"));
 				cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 			}
-			
+
 			if(doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
-				cur_frm.add_custom_button(doc.update_stock ? __('Purchase Return') : __('Debit Note'), 
+				cur_frm.add_custom_button(doc.update_stock ? __('Purchase Return') : __('Debit Note'),
 					this.make_debit_note, __("Make"));
 			}
 		}
-		
+
 		if(doc.docstatus===0) {
 			cur_frm.add_custom_button(__('Purchase Order'), function() {
 				frappe.model.map_current_doc({
@@ -69,7 +74,7 @@
 				})
 			}, __("Get items from"));
 		}
-		
+
 		this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes");
 	},
 
@@ -156,7 +161,7 @@
 			frm: cur_frm
 		})
 	},
-	
+
 	asset: function(frm, cdt, cdn) {
 		var row = locals[cdt][cdn];
 		if(row.asset) {
@@ -188,13 +193,13 @@
 			var docfield = frappe.meta.docfield_map[doc.doctype][parent_fields[i]];
 			if(!docfield.hidden) unhide_field(parent_fields[i]);
 		}
-	
+
 	}
 
 	item_fields_stock = ['warehouse_section', 'received_qty', 'rejected_qty'];
 
 	cur_frm.fields_dict['items'].grid.set_column_disp(item_fields_stock,
-		(cint(doc.update_stock)==1 ? true : false));	
+		(cint(doc.update_stock)==1 ? true : false));
 
 	cur_frm.refresh_fields();
 }
@@ -361,7 +366,7 @@
 			}
 		})
 	},
-	
+
 	is_subcontracted: function(frm) {
 		if (frm.doc.is_subcontracted === "Yes") {
 			erpnext.buying.get_default_bom(frm);
@@ -369,4 +374,3 @@
 		frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes");
 	}
 })
-	
\ No newline at end of file
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/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 91d3ae4..5dacb9b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -6,7 +6,7 @@
 import unittest
 import frappe
 import frappe.model
-from frappe.utils import cint, flt
+from frappe.utils import cint, flt, today
 import frappe.defaults
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
 	test_records as pr_test_records
@@ -412,8 +412,7 @@
 def make_purchase_invoice(**args):
 	pi = frappe.new_doc("Purchase Invoice")
 	args = frappe._dict(args)
-	if args.posting_date:
-		pi.posting_date = args.posting_date
+	pi.posting_date = args.posting_date or today()
 	if args.posting_time:
 		pi.posting_time = args.posting_time
 	if args.update_stock:
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 9bea107..2fbf4b6 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -7,6 +7,7 @@
 from frappe.utils import nowdate
 from erpnext.setup.utils import get_exchange_rate
 from erpnext.stock.get_item_details import get_pos_profile
+from erpnext.accounts.party import get_party_account_currency
 from erpnext.controllers.accounts_controller import get_taxes_and_charges
 
 @frappe.whitelist()
@@ -19,7 +20,7 @@
 	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(_("Warning Message: Create POS Profile"))
 
 	update_pos_profile_data(doc, pos_profile)
 	update_multi_mode_option(doc, pos_profile)
@@ -28,7 +29,7 @@
 	return {
 		'doc': doc,
 		'items': get_items(doc, pos_profile),
-		'customers': get_customers(pos_profile),
+		'customers': get_customers(pos_profile, doc),
 		'pricing_rules': get_pricing_rules(doc),
 		'mode_of_payment': get_mode_of_payment(doc),
 		'print_template': print_template,
@@ -47,7 +48,7 @@
 		update_tax_table(doc)
 
 	doc.currency = pos_profile.get('currency') or company_data.default_currency
-	doc.conversion_rate = 1.0 
+	doc.conversion_rate = 1.0
 	if doc.currency != company_data.default_currency:
 		doc.conversion_rate = get_exchange_rate(doc.currency, company_data.default_currency)
 	doc.selling_price_list = pos_profile.get('selling_price_list') or frappe.db.get_value('Selling Settings', None, 'selling_price_list')
@@ -57,17 +58,23 @@
 	doc.apply_discount_on = pos_profile.get('apply_discount_on') or ''
 	doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
 	doc.territory = pos_profile.get('territory') or get_root('Territory')
-	
+
 def get_root(table):
-	root = frappe.db.sql(""" select name from `tab%(table)s` having 
+	root = frappe.db.sql(""" select name from `tab%(table)s` having
 		min(lft)"""%{'table': table}, as_dict=1)
-	
-	return root[0].name 
+
+	return root[0].name
 
 def update_multi_mode_option(doc, pos_profile):
 	from frappe.model import default_fields
-	
+
 	if not pos_profile:
+		for payment in frappe.get_all('Mode of Payment Account', fields=["default_account", "parent"], 
+							filters = {'company': doc.company}):
+			payments = doc.append('payments', {})
+			payments.mode_of_payment = payment.parent
+			payments.account = payment.default_account
+
 		return
 
 	for payment_mode in pos_profile.payments:
@@ -100,25 +107,32 @@
 		item.cost_center = pos_profile.get('cost_center') or item_doc.selling_cost_center
 		item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
 								'warehouse': item.default_warehouse}, 'actual_qty') or 0
-		item.serial_nos = frappe.db.sql_list("""select name from `tabSerial No` where warehouse= %(warehouse)s 
+		item.serial_nos = frappe.db.sql_list("""select name from `tabSerial No` where warehouse= %(warehouse)s
 			and item_code = %(item_code)s""", {'warehouse': item.default_warehouse, 'item_code': item.item_code})
 		item_list.append(item)
 
 	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:
 		return frappe.db.sql(""" Select * from `tabPricing Rule` where docstatus < 2 and disable = 0
 					and selling = 1 and ifnull(company, '') in (%(company)s, '') and
 					ifnull(for_price_list, '') in (%(price_list)s, '')  and %(date)s between
-					ifnull(valid_from, '2000-01-01') and ifnull(valid_upto, '2500-12-31') order by priority desc, name desc""", 
+					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):
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 45c918c..cc6d1e6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -51,7 +51,7 @@
 					this.make_sales_return, __("Make"));
 				cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 			}
-			
+
 			if(cint(doc.update_stock)!=1) {
 				// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
 				var from_delivery_note = false;
@@ -61,7 +61,7 @@
 					});
 
 				if(!from_delivery_note && !is_delivered_by_supplier) {
-					cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'], 
+					cur_frm.add_custom_button(__('Delivery'), cur_frm.cscript['Make Delivery Note'],
 						__("Make"));
 				}
 			}
@@ -221,7 +221,7 @@
 			frm: cur_frm
 		})
 	},
-	
+
 	asset: function(frm, cdt, cdn) {
 		var row = locals[cdt][cdn];
 		if(row.asset) {
@@ -390,7 +390,7 @@
 	if(cur_frm.doc.is_pos) {
 		cur_frm.msgbox = frappe.msgprint(format('<a class="btn btn-primary" \
 			onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">{0}</a>\
-			<a class="btn btn-default" href="javascript:new_doc(cur_frm.doctype);">{1}</a>', [
+			<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">{1}</a>', [
 			__('Print'), __('New')
 		]));
 
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 952cce6..109a9eb 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -63,7 +63,7 @@
 		self.validate_write_off_account()
 		self.validate_fixed_asset()
 		self.set_income_account_for_fixed_assets()
-		
+
 		# if cint(self.is_pos):
 			# self.validate_pos()
 
@@ -85,7 +85,7 @@
 
 	def before_save(self):
 		set_account_for_mode_of_payment(self)
-		
+
 	def update_change_amount(self):
 		self.base_paid_amount = 0.0
 		if self.paid_amount:
@@ -95,7 +95,7 @@
 				self.change_amount = flt(self.paid_amount - self.grand_total, self.precision("change_amount"))
 				self.base_change_amount = flt(self.change_amount * self.conversion_rate, self.precision("base_change_amount"))
 
-	def on_submit(self):			
+	def on_submit(self):
 		if not self.recurring_id:
 			frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
 			 	self.company, self.base_grand_total, self)
@@ -109,12 +109,12 @@
 		self.update_status_updater_args()
 		self.update_prevdoc_status()
 		self.update_billing_status_in_dn()
-		
-		# Updating stock ledger should always be called after updating prevdoc status, 
+
+		# Updating stock ledger should always be called after updating prevdoc status,
 		# because updating reserved qty in bin depends upon updated delivered qty in SO
 		if self.update_stock == 1:
 			self.update_stock_ledger()
-		
+
 		# this sequence because outstanding may get -ve
 		self.make_gl_entries()
 
@@ -149,8 +149,8 @@
 			self.update_billing_status_for_zero_amount_refdoc("Sales Order")
 
 		self.validate_c_form_on_cancel()
-		
-		# Updating stock ledger should always be called after updating prevdoc status, 
+
+		# Updating stock ledger should always be called after updating prevdoc status,
 		# because updating reserved qty in bin depends upon updated delivered qty in SO
 		if self.update_stock == 1:
 			self.update_stock_ledger()
@@ -466,14 +466,14 @@
 				msgprint(_("POS Profile required to make POS Entry"), raise_exception=True)
 
 		return warehouse
-		
+
 	def set_income_account_for_fixed_assets(self):
 		disposal_account = depreciation_cost_center = None
 		for d in self.get("items"):
 			if d.is_fixed_asset:
 				if not disposal_account:
 					disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(self.company)
-					
+
 				d.income_account = disposal_account
 				if not d.cost_center:
 					d.cost_center = depreciation_cost_center
@@ -573,12 +573,12 @@
 			if flt(item.base_net_amount):
 				if item.is_fixed_asset:
 					asset = frappe.get_doc("Asset", item.asset)
-				
+
 					fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset, item.base_net_amount)
 					for gle in fixed_asset_gl_entries:
 						gle["against"] = self.customer
 						gl_entries.append(self.get_gl_dict(gle))
-					
+
 					asset.db_set("disposal_date", self.posting_date)
 					asset.set_status("Sold" if self.docstatus==1 else None)
 				else:
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 7208c2a..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",
@@ -955,8 +954,7 @@
 def create_sales_invoice(**args):
 	si = frappe.new_doc("Sales Invoice")
 	args = frappe._dict(args)
-	if args.posting_date:
-		si.posting_date = args.posting_date or nowdate()
+	si.posting_date = args.posting_date or nowdate()
 
 	si.company = args.company or "_Test Company"
 	si.customer = args.customer or "_Test Customer"
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index a61ad11..351cd56 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -3,6 +3,7 @@
 
 from __future__ import unicode_literals
 import frappe
+from frappe import _
 from frappe.model.document import Document
 from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
 
@@ -19,6 +20,12 @@
 			where is_default = 1 and name != %s and company = %s""".format(doc.doctype),
 			(doc.name, doc.company))
 
+	validate_disabled(doc)
+
 	for tax in doc.get("taxes"):
 		validate_taxes_and_charges(tax)
 		validate_inclusive_tax(tax, doc)
+
+def validate_disabled(doc):
+	if doc.is_default and doc.disabled:
+		frappe.throw(_("Disabled template must not be default template"))
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 ce20d3a..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
 
@@ -140,4 +144,11 @@
 			if rule.get(key): rule.no_of_keys_matched += 1
 
 	rule = sorted(tax_rule, lambda b, a: cmp(a.no_of_keys_matched, b.no_of_keys_matched) or cmp(a.priority, b.priority))[0]
-	return rule.sales_tax_template or rule.purchase_tax_template
+
+	tax_template = rule.sales_tax_template or rule.purchase_tax_template
+	doctype = "{0} Taxes and Charges Template".format(rule.tax_type)
+
+	if frappe.db.get_value(doctype, tax_template, 'disabled')==1:
+		return None
+
+	return tax_template
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/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 2162563..4b3da28 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -4,7 +4,7 @@
 frappe.pages['pos'].on_page_load = function(wrapper) {
 	var page = frappe.ui.make_app_page({
 		parent: wrapper,
-		title: 'Point of Sale',
+		title: __('Point of Sale'),
 		single_column: true
 	});
 
@@ -27,11 +27,13 @@
 		this.set_interval_for_si_sync();
 		this.si_docs = this.get_doc_from_localstorage();
 	},
-	
+
 	on_refresh_page: function() {
 		var me = this;
 		if(this.load){
 			this.load = false;
+		}else if(this.connection_status){
+			this.onload();
 		}else{
 			this.create_new();
 		}
@@ -42,12 +44,13 @@
 		//Check Internet connection after every 30 seconds
 		setInterval(function(){
 			me.set_indicator();
-		}, 30000)
+		}, 5000)
 	},
 
 	set_indicator: function(){
 		var me = this;
 		// navigator.onLine
+		this.connection_status = false;
 		this.page.set_indicator("Offline", "grey")
 		frappe.call({
 			method:"frappe.handler.ping",
@@ -63,19 +66,24 @@
 	onload: function(){
 		var me = this;
 		this.get_data_from_server(function(){
-			me.create_new(); 
+			me.create_new();
 		});
-	
+
 		this.check_internet_connection();
 	},
 
 	make_menu_list: function(){
 		var me = this;
 
-		this.page.add_menu_item(__("Unsync Records"), function(){
+		this.page.add_menu_item(__("New Sales Invoice"), function() {
+			me.save_previous_entry()
+			me.create_new()
+		})
+
+		this.page.add_menu_item(__("View Offline Records"), function(){
 			me.show_unsync_invoice_list()
 		});
-	
+
 		this.page.add_menu_item(__("Sync Master Data"), function(){
 			me.get_data_from_server(function(){
 				me.load_data()
@@ -83,10 +91,10 @@
 				me.make_item_list()
 			})
 		});
-	
-		this.page.add_menu_item(__("New Sales Invoice"), function() {
-			me.create_new()
-		})
+
+		this.page.add_menu_item(__("POS Profile"), function() {
+			frappe.set_route('List', 'POS Profile');
+		});
 	},
 
 	show_unsync_invoice_list: function(){
@@ -96,14 +104,14 @@
 		this.list_dialog = new frappe.ui.Dialog({
 			title: 'Invoice List'
 		});
-	
+
 		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 class="col-xs-4 text-center">Grand Total</div>\
+				<div class="col-xs-2 text-left">Status</div>\
 		</div>')
 
 		$.each(this.si_docs, function(index, data){
@@ -113,11 +121,11 @@
 					name: key,
 					customer: data[key].customer,
 					grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
-					status: (data[key].docstatus == 1) ? 'Submitted' : 'Draft'
+					data: me.get_doctype_status(data[key])
 				})).appendTo($(me.list_body));
 			}
 		})
-	
+
 		$(this.list_body).find('.list-row').click(function() {
 			me.name = $(this).attr('invoice-name')
 			doc_data = me.get_invoice_doc(me.si_docs)
@@ -130,7 +138,17 @@
 			}
 		})
 	},
-	
+
+	get_doctype_status: function(doc){
+		if(doc.outstanding_amount == 0){
+			return {status: "Paid", indicator: "green"}
+		}else if(doc.docstatus == 0){
+			return {status: "Draft", indicator: "red"}
+		}else if(doc.paid_amount >= 0){
+			return {status: "Unpaid", indicator: "orange"}
+		}
+	},
+
 	set_missing_values: function(){
 		var me = this;
 		doc = JSON.parse(localStorage.getItem('doc'))
@@ -147,7 +165,7 @@
 			for(key in data){
 				return key == me.name
 			}
-		}) 
+		})
 	},
 
 	get_data_from_server: function(callback){
@@ -169,12 +187,17 @@
 			}
 		})
 	},
-	
+
+	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();
 	},
@@ -183,12 +206,13 @@
 		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)
 		})
 
-		this.print_template = frappe.render_template("print_template", 
+		this.print_template = frappe.render_template("print_template",
 			{content: window.print_template, title:"POS"})
 	},
 
@@ -227,15 +251,15 @@
 			parent: this.wrapper.find(".search-area"),
 			only_input: true,
 		});
-	
+
 		this.search.make_input();
 		this.search.$input.on("keyup", function() {
 			setTimeout(function() {
 				me.items = me.get_items();
-				me.make_item_list(); 
+				me.make_item_list();
 			}, 1000);
 		});
-	
+
 		this.party_field = frappe.ui.form.make_control({
 			df: {
 				"fieldtype": "Data",
@@ -247,23 +271,24 @@
 			parent: this.wrapper.find(".party-area"),
 			only_input: true,
 		});
-	
+
 		this.party_field.make_input();
 	},
 
 	make_customer: function() {
 		var me = this;
-	
+
 		if(this.customers.length == 1){
 			this.party_field.$input.val(this.customers[0].name);
 			this.frm.doc.customer = this.customers[0].name;
 		}
-	
+
 		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){
-					return {label: data.name, value: data.name, 
+					return {label: data.name, value: data.name,
 						customer_group: data.customer_group, territory: data.territory}
 				}))
 			},
@@ -278,18 +303,30 @@
 				}
 				me.refresh();
 			}
-		})
+		}).on("focus", function(){
+			setTimeout(function() {
+				if(!me.party_field.$input.val()) {
+					me.party_field.$input.autocomplete( "search", " " );
+				}
+			}, 500);
+		});
 	},
 
 	get_customers: function(key){
 		var me = this;
-		key = key.toLowerCase()
-		return $.grep(this.customers, function(data) {
-			if(data.name.toLowerCase().match(key) || data.customer_name.toLowerCase().match(key)
-					|| data.customer_group.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() {
@@ -300,7 +337,7 @@
 		}
 
 		me.item_timeout = null;
-	
+
 		var $wrap = me.wrapper.find(".item-list");
 		me.wrapper.find(".item-list").empty();
 
@@ -318,7 +355,7 @@
 				}
 			});
 		}
-	
+
 		if(this.items.length == 1){
 			this.search.$input.val("");
 			this.add_to_cart();
@@ -339,7 +376,7 @@
 
 		var me = this;
 		this.item_serial_no = {}
-	
+
 		if(item_code){
 			return $.grep(window.items, function(item){
 				if(item.item_code == item_code ){
@@ -372,39 +409,52 @@
 
 		$(this.wrapper).find(".pos-item-qty").on("change", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
-			me.update_qty_against_item_code(item_code, $(this).val());
+			me.update_qty_rate_against_item_code(item_code, "qty", $(this).val());
 		})
-	
+
 		$(this.wrapper).find("[data-action='increase-qty']").on("click", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) + 1;
-			me.update_qty_against_item_code(item_code, qty);
+			me.update_qty_rate_against_item_code(item_code, "qty", qty);
 		})
-	
+
 		$(this.wrapper).find("[data-action='decrease-qty']").on("click", function(){
 			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
 			var qty = flt($(this).parents(".pos-bill-item").find('.pos-item-qty').val()) - 1;
-			me.update_qty_against_item_code(item_code, qty);
+			me.update_qty_rate_against_item_code(item_code, "qty", qty);
 		})
 	},
 
-	update_qty_against_item_code: function(item_code, qty){
+	update_rate: function() {
 		var me = this;
-		if(qty < 0){
-			frappe.throw(__("Quantity must be positive"));
+
+		$(this.wrapper).find(".pos-item-rate").on("change", function(){
+			var item_code = $(this).parents(".pos-bill-item").attr("data-item-code");
+			me.update_qty_rate_against_item_code(item_code, "rate", $(this).val());
+		})
+	},
+
+	update_qty_rate_against_item_code: function(item_code, field, value){
+		var me = this;
+		if(value < 0){
+			frappe.throw(__("Enter value must be positive"));
 		}
-	
+
 		this.remove_item = []
 		$.each(this.frm.doc["items"] || [], function(i, d) {
 			if (d.item_code == item_code) {
-				d.qty = flt(qty);
+				d[field] = flt(value);
 				d.amount = flt(d.rate) * flt(d.qty);
 				if(d.qty==0){
 					me.remove_item.push(d.idx)
 				}
 			}
 		});
-		this.remove_zero_qty_item();
+
+		if(field == 'qty'){
+			this.remove_zero_qty_item();
+		}
+
 		this.refresh();
 	},
 
@@ -417,10 +467,10 @@
 			if(!in_list(me.remove_item, d.idx)){
 				d.idx = idx;
 				me.items.push(d);
-				idx++; 
+				idx++;
 			}
 		});
-	
+
 		this.frm.doc["items"] = this.items;
 	},
 
@@ -430,11 +480,11 @@
 		this.wrapper.find('input.discount-percentage').on("change", function() {
 			me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage"));
 			total = me.frm.doc.grand_total
-		
+
 			if(me.frm.doc.apply_discount_on == 'Net Total'){
 				total = me.frm.doc.net_total
 			}
-		
+
 			me.frm.doc.discount_amount = flt(total*flt(me.frm.doc.additional_discount_percentage) / 100, precision("discount_amount"));
 			me.wrapper.find('input.discount-amount').val(me.frm.doc.discount_amount)
 			me.refresh();
@@ -450,7 +500,7 @@
 
 	customer_validate: function(){
 		var me = this;
-	
+
 		if(!this.frm.doc.customer){
 			frappe.throw(__("Please select customer"))
 		}
@@ -500,13 +550,14 @@
 		this.child.rate = flt(this.items[0].price_list_rate, 9) / flt(this.frm.doc.conversion_rate, 9);
 		this.child.actual_qty = this.items[0].actual_qty;
 		this.child.amount = flt(this.child.qty) * flt(this.child.rate);
-		this.child.serial_no = this.item_serial_no[this.child.item_code]; 
+		this.child.serial_no = this.item_serial_no[this.child.item_code];
 	},
 
 	refresh: function() {
 		var me = this;
 		this.refresh_fields();
 		this.update_qty();
+		this.update_rate();
 		this.set_primary_action();
 	},
 	refresh_fields: function() {
@@ -519,15 +570,15 @@
 		this.calculate_outstanding_amount();
 		this.set_totals();
 	},
-	
+
 	get_company_currency: function() {
 		return erpnext.get_currency(this.frm.doc.company);
 	},
-	
+
 	show_item_wise_taxes: function(){
 		return null;
 	},
-	
+
 	show_items_in_item_cart: function() {
 		var me = this;
 		var $items = this.wrapper.find(".items").empty();
@@ -539,7 +590,7 @@
 				qty: d.qty,
 				actual_qty: d.actual_qty,
 				projected_qty: d.projected_qty,
-				rate: format_currency(d.rate, me.frm.doc.currency),
+				rate: format_number(d.rate, me.frm.doc.currency),
 				amount: format_currency(d.amount, me.frm.doc.currency)
 			})).appendTo($items);
 		});
@@ -547,6 +598,10 @@
 		this.wrapper.find("input.pos-item-qty").on("focus", function() {
 			$(this).select();
 		});
+
+		this.wrapper.find("input.pos-item-rate").on("focus", function() {
+			$(this).select();
+		});
 	},
 
 	set_taxes: function(){
@@ -557,7 +612,7 @@
 		$(this.wrapper)
 			.find(".tax-area").toggleClass("hide", (taxes && taxes.length) ? false : true)
 			.find(".tax-table").empty();
-	
+
 		$.each(taxes, function(i, d) {
 			if (d.tax_amount && cint(d.included_in_print_rate) == 0) {
 				$(frappe.render_template("pos_tax_row", {
@@ -591,20 +646,25 @@
 		}else if(this.frm.doc.docstatus == 1){
 			this.page.set_primary_action(__("Print"), function() {
 				html = frappe.render(me.print_template, me.frm.doc)
-				frappe.require("/assets/js/print_format_v3.min.js", function() {
-					w = _p.preview(html);
-					setTimeout(function(){
-						w.print();
-					}, 1000)
-				});
+				me.print_document(html)
 			})
 		}else {
 			this.page.clear_primary_action()
 		}
 	},
-	
+
+	print_document: function(html){
+		var w = window.open();
+		w.document.write(html);
+		w.document.close();
+		setTimeout(function(){
+			w.print();
+			w.close();
+		}, 1000)
+	},
+
 	write_off_amount: function(){
-		var me = this; 
+		var me = this;
 		var value = 0.0;
 
 		if(this.frm.doc.outstanding_amount > 0){
@@ -614,9 +674,9 @@
 					{fieldtype: "Check", fieldname: "write_off_amount", label: __("Write of Outstanding Amount")},
 				]
 			});
-  
+
 			dialog.show();
-			  
+
 			dialog.fields_dict.write_off_amount.$input.change(function(){
 				write_off_amount = dialog.get_values().write_off_amount
 				me.frm.doc.write_off_outstanding_amount_automatically = write_off_amount;
@@ -624,7 +684,7 @@
 				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();
 			})
-			
+
 			dialog.set_primary_action(__("Submit"), function(){
 				dialog.hide()
 				me.submit_invoice()
@@ -633,7 +693,7 @@
 			this.submit_invoice()
 		}
 	},
-	
+
 	submit_invoice: function(){
 		var me = this;
 		frappe.confirm(__("Do you really want to submit the invoice?"), function () {
@@ -652,12 +712,12 @@
 	disable_input_field: function(){
 		var pointer_events = 'inherit'
 		$(this.wrapper).find('input').attr("disabled", false);
-	
+
 		if(this.frm.doc.docstatus == 1){
 			pointer_events = 'none'
-			$(this.wrapper).find('input').attr("disabled", true);	
+			$(this.wrapper).find('input').attr("disabled", true);
 		}
-	
+
 		$(this.wrapper).find('.pos-bill-wrapper').css('pointer-events', pointer_events);
 		$(this.wrapper).find('.pos-items-section').css('pointer-events', pointer_events);
 		this.set_primary_action();
@@ -718,7 +778,7 @@
 		var me = this;
 		this.si_docs = this.get_submitted_invoice()
 
-		if(this.connection_status && this.si_docs.length){
+		if(this.si_docs.length){
 			frappe.call({
 				method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
 				args: {
@@ -735,12 +795,14 @@
 	},
 
 	get_submitted_invoice: function(){
-		invoices = []
-		docs = this.get_doc_from_localstorage()
+		var invoices = [];
+		var index = 1;
+		docs = this.get_doc_from_localstorage();
 		if(docs){
 			invoices = $.map(docs, function(data){
 				for(key in data){
-					if(data[key].docstatus == 1){
+					if(data[key].docstatus == 1 && index < 50){
+						index++
 						return data
 					}
 				}
@@ -786,7 +848,7 @@
 			item_code = key;
 			serial_no = me.item_serial_no[key]
 		}
-	
+
 		if(item_code && serial_no){
 			$.each(this.frm.doc.items, function(index, data){
 				if(data.item_code == item_code){
@@ -852,16 +914,16 @@
 		var priority_list = []
 
 		if(pricing_rule.length > 1){
-		
+
 			$.each(pricing_rule, function(index, data){
-				pricing_rule_name += data.name + ','				
+				pricing_rule_name += data.name + ','
 				priority_list.push(data.priority)
 				if(priority <= data.priority){
 					priority = data.priority
 					pricing_rule_list.push(data)
 				}
 			})
-		
+
 			count = 0
 			$.each(priority_list, function(index, value){
 				if(value == priority){
@@ -874,11 +936,11 @@
 					'pricing_rule': pricing_rule_name
 				})))
 			}
-		
+
 			return pricing_rule_list
 		}
 	},
-	
+
 	validate_warehouse: function(){
 		if(!this.items[0].default_warehouse){
 			frappe.throw(__("Deafault warehouse is required for selected item"))
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index d348715..8d11374 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -7,7 +7,7 @@
 import datetime
 from frappe import _, msgprint, scrub
 from frappe.defaults import get_user_permissions
-from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff
+from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years
 from erpnext.utilities.doctype.address.address import get_address_display
 from erpnext.utilities.doctype.contact.contact import get_contact_details
 from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
@@ -332,6 +332,8 @@
 def get_timeline_data(doctype, name):
 	'''returns timeline data for the past one year'''
 	from frappe.desk.form.load import get_communication_data
-	data = get_communication_data(doctype, name, fields = 'unix_timestamp(date(creation)), count(name)',
+	data = get_communication_data(doctype, name,
+		fields = 'unix_timestamp(date(creation)), count(name)',
+		after = add_years(None, -1).strftime('%Y-%m-%d'),
 		group_by='group by date(creation)', as_dict=False)
 	return dict(data)
\ No newline at end of file
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/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
index 581531b..ca8e50b 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -8,6 +8,7 @@
 			"label": __("Bank Account"),
 			"fieldtype": "Link",
 			"options": "Account",
+			"default": locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"],
 			"reqd": 1,
 			"get_query": function() {
 				return {
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/delivered_items_to_be_billed/delivered_items_to_be_billed.json b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
index 691a5c3..5a8877f 100644
--- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
+++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.json
@@ -7,12 +7,12 @@
  "doctype": "Report", 
  "idx": 1, 
  "is_standard": "Yes", 
- "modified": "2016-04-04 17:27:19.104519", 
+ "modified": "2016-05-17 08:40:18.711626", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Delivered Items To Be Billed", 
  "owner": "Administrator", 
- "query": "select\n    `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabDelivery Note Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n    `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n    `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n    `tabDelivery Note`.per_billed < 100\norder by `tabDelivery Note`.`name` desc", 
+ "query": "select\n    `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`base_amount` - `tabDelivery Note Item`.`billed_amt`*ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere  \n    `tabDelivery Note`.name = `tabDelivery Note Item`.parent \n    and `tabDelivery Note`.docstatus = 1 \n    and `tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") \n    and `tabDelivery Note Item`.amount > 0\n    and `tabDelivery Note Item`.billed_amt < `tabDelivery Note Item`.amount\norder by `tabDelivery Note`.`name` desc", 
  "ref_doctype": "Sales Invoice", 
  "report_name": "Delivered Items To Be Billed", 
  "report_type": "Query Report"
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/ordered_items_to_be_billed/ordered_items_to_be_billed.json b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
index 47b62a8..983ec22 100644
--- a/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
+++ b/erpnext/accounts/report/ordered_items_to_be_billed/ordered_items_to_be_billed.json
@@ -7,12 +7,12 @@
  "doctype": "Report", 
  "idx": 1, 
  "is_standard": "Yes", 
- "modified": "2016-04-01 08:26:43.868609", 
+ "modified": "2016-05-17 08:26:50.810208", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Ordered Items To Be Billed", 
  "owner": "Administrator", 
- "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc", 
+ "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (`tabSales Order Item`.base_amount - (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Closed\"\n and `tabSales Order Item`.amount > 0\n and `tabSales Order Item`.billed_amt < `tabSales Order Item`.amount\norder by `tabSales Order`.transaction_date asc", 
  "ref_doctype": "Sales Invoice", 
  "report_name": "Ordered Items To Be Billed", 
  "report_type": "Query Report"
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/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json
index 72e9396..a64e7cf 100644
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json
+++ b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json
@@ -7,12 +7,12 @@
  "doctype": "Report", 
  "idx": 1, 
  "is_standard": "Yes", 
- "modified": "2016-04-01 08:27:32.122070", 
+ "modified": "2016-05-17 08:28:26.093139", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Purchase Order Items To Be Billed", 
  "owner": "Administrator", 
- "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc", 
+ "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n        and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc", 
  "ref_doctype": "Purchase Invoice", 
  "report_name": "Purchase Order Items To Be Billed", 
  "report_type": "Query Report"
diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
index c38a7bb..41843ac 100644
--- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
+++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.json
@@ -7,12 +7,12 @@
  "doctype": "Report", 
  "idx": 1, 
  "is_standard": "Yes", 
- "modified": "2016-04-04 17:27:29.449124", 
+ "modified": "2016-05-17 08:38:49.654749", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Received Items To Be Billed", 
  "owner": "Administrator", 
- "query": "select\n    `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n    `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabPurchase Receipt Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n    `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n    `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n    `tabPurchase Receipt`.per_billed < 100\norder by `tabPurchase Receipt`.`name` desc", 
+ "query": "select\n    `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n    `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`base_amount` - `tabPurchase Receipt Item`.`billed_amt`*ifnull(`tabPurchase Receipt`.conversion_rate, 1)) as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n    `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent \n    and `tabPurchase Receipt`.docstatus = 1 \n    and `tabPurchase Receipt`.status != \"Closed\" \n    and `tabPurchase Receipt Item`.amount > 0\n    and `tabPurchase Receipt Item`.billed_amt < `tabPurchase Receipt Item`.amount\norder by `tabPurchase Receipt`.`name` desc", 
  "ref_doctype": "Purchase Invoice", 
  "report_name": "Received Items To Be Billed", 
  "report_type": "Query Report"
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 8617a26..6416a23 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -10,6 +10,18 @@
 cur_frm.email_field = "contact_email";
 
 erpnext.buying.BuyingController = erpnext.TransactionController.extend({
+	setup: function() {
+		this._super();
+		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},
+				{fieldname: 'rate', columns: 3},
+				{fieldname: 'amount', columns: 2}
+			];
+		}
+	},
+
 	onload: function() {
 		this.setup_queries();
 		this._super();
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_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..c55b999 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -27,22 +27,6 @@
 
 		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"));
-		// 	}
-		// });
-	},
 });
 
 cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
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 2ede901..34f098e 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -81,10 +81,11 @@
 			convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))
 
 	def set_missing_values(self, for_validate=False):
-		for fieldname in ["posting_date", "transaction_date"]:
-			if not self.get(fieldname) and self.meta.get_field(fieldname):
-				self.set(fieldname, today())
-				break
+		if frappe.flags.in_test:
+			for fieldname in ["posting_date","transaction_date"]:
+				if self.meta.get_field(fieldname) and not self.get(fieldname):
+					self.set(fieldname, today())
+					break
 
 	def calculate_taxes_and_totals(self):
 		from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
@@ -246,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/stock_controller.py b/erpnext/controllers/stock_controller.py
index 845a4d0..1976cc6 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -62,6 +62,7 @@
 							"cost_center": detail.cost_center,
 							"remarks": self.get("remarks") or "Accounting Entry for Stock",
 							"credit": flt(sle.stock_value_difference, 2),
+							"project": detail.get("project") or self.get("project")
 						}))
 					elif sle.warehouse not in warehouse_with_no_account:
 						warehouse_with_no_account.append(sle.warehouse)
diff --git a/erpnext/crm/doctype/newsletter/newsletter.js b/erpnext/crm/doctype/newsletter/newsletter.js
index 77eecac..9bee9b3 100644
--- a/erpnext/crm/doctype/newsletter/newsletter.js
+++ b/erpnext/crm/doctype/newsletter/newsletter.js
@@ -38,7 +38,7 @@
 		var total = frappe.utils.sum($.map(stat, function(v) { return v; }));
 		if(total) {
 			$.each(stat, function(k, v) {
-				stat[k] = flt(v * 100 / total, 2);
+				stat[k] = flt(v * 100 / total, 2) + '%';
 			});
 
 			cur_frm.dashboard.add_progress("Status", [
diff --git a/erpnext/crm/doctype/newsletter/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/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/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/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 aef612b..fcf2646 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.27.17"
+app_version = "6.27.21"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
diff --git a/erpnext/hr/doctype/designation/designation.js b/erpnext/hr/doctype/designation/designation.js
new file mode 100644
index 0000000..952c73f
--- /dev/null
+++ b/erpnext/hr/doctype/designation/designation.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Designation', {
+	refresh: function(frm) {
+
+	}
+});
diff --git a/erpnext/hr/doctype/designation/designation.json b/erpnext/hr/doctype/designation/designation.json
index 1a1cc32..73f4446 100644
--- a/erpnext/hr/doctype/designation/designation.json
+++ b/erpnext/hr/doctype/designation/designation.json
@@ -3,6 +3,7 @@
  "allow_import": 1, 
  "allow_rename": 1, 
  "autoname": "field:designation_name", 
+ "beta": 0, 
  "creation": "2013-01-10 16:34:13", 
  "custom": 0, 
  "docstatus": 0, 
@@ -17,6 +18,7 @@
    "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Designation", 
@@ -26,12 +28,38 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "fieldname": "description", 
+   "fieldtype": "Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_list_view": 0, 
+   "label": "Description", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -44,7 +72,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:45.227540", 
+ "modified": "2016-06-01 12:52:03.787578", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "Designation", 
@@ -71,6 +99,9 @@
    "write": 1
   }
  ], 
+ "quick_entry": 1, 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "sort_order": "ASC", 
+ "track_seen": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.js b/erpnext/hr/doctype/job_applicant/job_applicant.js
index eac1a9a..6541a8c 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.js
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.js
@@ -20,11 +20,11 @@
 						"applicant_name": frm.doc.applicant_name,
 						"designation": frm.doc.job_opening,
 					};
-					new_doc("Offer Letter");
+					frappe.new_doc("Offer Letter");
 				}, __("Make"));
 				cur_frm.page.set_inner_btn_group_as_primary(__("Make"));
 			}
 		}
-		
+
 	}
 });
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 10af7b6..210a9e8 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -264,4 +264,7 @@
 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
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 2cb6b40..604d7d4 100644
--- a/erpnext/patches/v7_0/update_home_page.py
+++ b/erpnext/patches/v7_0/update_home_page.py
@@ -2,7 +2,9 @@
 import erpnext
 
 def execute():
-	frappe.reload_doctype('Homepage')
+	frappe.reload_doc('portal', 'doctype', 'homepage_featured_product')
+	frappe.reload_doc('portal', 'doctype', 'homepage')
+	frappe.reload_doc('portal', 'doctype', 'products_settings')
 
 	website_settings = frappe.get_doc('Website Settings', 'Website Settings')
 	if frappe.db.exists('Web Page', website_settings.home_page):
@@ -10,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.tagline = 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/css/erpnext.css b/erpnext/public/css/erpnext.css
index 346cfa0..91e1d6b 100644
--- a/erpnext/public/css/erpnext.css
+++ b/erpnext/public/css/erpnext.css
@@ -124,55 +124,47 @@
 .dashboard-list-item:last-child {
   border-bottom: none;
 }
-
 .payment-toolbar {
-	margin-left: 35px;
+  margin-left: 35px;
 }
-
 .payment-mode {
-	cursor: pointer;
-	font-family: sans-serif;
-	font-size: 15px;
+  cursor: pointer;
+  font-family: sans-serif;
+  font-size: 15px;
 }
-
 .pos-payment-row .col-xs-6 {
-	padding :10px;
+  padding: 10px;
 }
-
 .pos-payment-row {
-	border-bottom:1px solid #d1d8dd;
-    margin: 2px 0px 5px 0px;
+  border-bottom: 1px solid #d1d8dd;
+  margin: 2px 0px 5px 0px;
 }
-
-.pos-payment-row:hover, .pos-keyboard-key:hover{
-	background-color: #FAFBFC;
-	cursor: pointer;
+.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;
+.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;
+  margin-top: 5px;
 }
-
 .amount-label {
-	font-size: 16px;
+  font-size: 16px;
 }
-
 .selected-payment-mode {
-	background-color: #FAFBFC;
-	cursor: pointer;
+  background-color: #FAFBFC;
+  cursor: pointer;
 }
-
 .pos-invoice-list {
-	padding: 15px 10px;
+  padding: 15px 10px;
 }
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 6c239c5..db8f2fc 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -71,10 +71,6 @@
 .featured-products {
   border-top: 1px solid #EBEFF2;
 }
-.transaction-list-item {
-  padding: 30px;
-  margin: 0px -30px;
-}
 .transaction-list-item:hover,
 .transaction-list-item:active,
 .transaction-list-item:focus {
@@ -83,7 +79,6 @@
 .transaction-list-item .indicator {
   font-weight: inherit;
   color: #8D99A6;
-  margin-left: -15px;
 }
 .transaction-list-item .items-preview,
 .transaction-list-item .transaction-time {
@@ -123,8 +118,8 @@
   margin-top: 15px;
 }
 .order-container .tax-grand-total-row {
-  border-top: 1px solid #d1d8dd;
   padding-top: 15px;
+  padding-bottom: 30px;
 }
 .order-container .tax-grand-total {
   display: inline-block;
@@ -217,6 +212,10 @@
 .item-group-nav-buttons {
   margin-top: 15px;
 }
+.footer-subscribe .btn-default {
+  background-color: transparent;
+  border: 1px solid #d1d8dd;
+}
 @media (min-width: 992px) {
   .footer-subscribe {
     max-width: 350px;
@@ -238,20 +237,3 @@
 .product-image-wrapper {
   padding-bottom: 40px;
 }
-.featured-product-heading,
-.all-products {
-  text-transform: uppercase;
-  letter-spacing: 0.5px;
-  font-size: 12px;
-  font-weight: 500;
-}
-.all-products {
-  font-weight: 300;
-  padding-left: 25px;
-  padding-right: 25px;
-  padding-top: 10px;
-  padding-bottom: 10px;
-}
-.homepage-tagline {
-  font-size: 40px !important;
-}
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index af651c9..a471911 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -87,15 +87,7 @@
 			var today = get_today(),
 				currency = frappe.defaults.get_user_default("currency");
 
-			$.each(["posting_date", "transaction_date"], function(i, fieldname) {
-				if (me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname] && me.frm[fieldname]) {
-					me.frm.set_value(fieldname, me.frm[fieldname]);
-				}
-			});
-
 			$.each({
-				posting_date: today,
-				transaction_date: today,
 				currency: currency,
 				price_list_currency: currency,
 				status: "Draft",
@@ -974,6 +966,9 @@
 	},
 
 	setup_item_selector: function() {
+		// TODO: remove item selector
+
+		return;
 		if(!this.item_selector) {
 			this.item_selector = new erpnext.ItemSelector({frm: this.frm});
 		}
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index 3c87dab..c1e53a2 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -28,7 +28,7 @@
 				{ "value": "Half-Yearly", "label": __("Half-Yearly") },
 				{ "value": "Yearly", "label": __("Yearly") }
 			],
-			"default": "Yearly",
+			"default": "Monthly",
 			"reqd": 1
 		}
 	],
@@ -83,5 +83,5 @@
 			var filters = report.get_values();
 			frappe.set_route('query-report', 'Cash Flow', {company: filters.company});
 		}, 'Financial Statements');
-	},
+	}
 };
diff --git a/erpnext/public/js/pos/pos_bill_item.html b/erpnext/public/js/pos/pos_bill_item.html
index fe521f6..c21e1d5 100644
--- a/erpnext/public/js/pos/pos_bill_item.html
+++ b/erpnext/public/js/pos/pos_bill_item.html
@@ -17,6 +17,7 @@
         </div>
     </div>
     <div class="col-xs-3 text-right">
-        <h6>{%= amount %}<div class="text-muted" style="margin-top: 5px;">{%= rate %}</div></h6>
+        <div class="text-muted" style="margin-top: 5px;"><input type="text" value="{%= rate %}" class="form-control input-sm pos-item-rate text-right"></div>
+		<p><h6>{%= amount %}</h6></p>
     </div>
 </div>
diff --git a/erpnext/public/js/pos/pos_invoice_list.html b/erpnext/public/js/pos/pos_invoice_list.html
index 8d2644c..cb25072 100644
--- a/erpnext/public/js/pos/pos_invoice_list.html
+++ b/erpnext/public/js/pos/pos_invoice_list.html
@@ -1,6 +1,6 @@
 <div class="row list-row pos-invoice-list" invoice-name = "{{name}}">
 	<div class="col-xs-3">{%= sr %}</div>
 	<div class="col-xs-3">{%= customer %}</div>
-	<div class="col-xs-3 text-right">{%= grand_total %}</div>
-	<div class="col-xs-3 text-right">{%= status %}</div>
+	<div class="col-xs-4 text-center">{%= grand_total %}</div>
+	<div class="col-xs-2 text-left"><span class="indicator {{data.indicator}}">{{ data.status }}</span></div>
 </div>
diff --git a/erpnext/public/js/stock_analytics.js b/erpnext/public/js/stock_analytics.js
index e9f9758..c64a2c9 100644
--- a/erpnext/public/js/stock_analytics.js
+++ b/erpnext/public/js/stock_analytics.js
@@ -78,7 +78,7 @@
 			this.trigger_refresh_on_change(["value_or_qty", "brand", "warehouse", "range"]);
 
 			this.show_zero_check();
-			this.setup_plot_check();
+			this.setup_chart_check();
 		},
 		init_filter_values: function() {
 			this._super();
@@ -198,9 +198,6 @@
 				}
 			});
 		},
-		get_plot_points: function(item, col, idx) {
-			return [[dateutil.user_to_obj(col.name).getTime(), item[col.field]]]
-		},
 		show_stock_ledger: function(item_code) {
 			frappe.route_options = {
 				item_code: item_code,
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 8bca282..ea28fd5 100644
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -93,7 +93,7 @@
 			.html(frappe.render_template("address_list",
 				cur_frm.doc.__onload))
 			.find(".btn-address").on("click", function() {
-				new_doc("Address");
+				frappe.new_doc("Address");
 			});
 
 		// render contact
@@ -102,7 +102,7 @@
 				.html(frappe.render_template("contact_list",
 					cur_frm.doc.__onload))
 				.find(".btn-contact").on("click", function() {
-					new_doc("Contact");
+					frappe.new_doc("Contact");
 				}
 			);
 		}
diff --git a/erpnext/public/less/erpnext.less b/erpnext/public/less/erpnext.less
index 58e8e62..7da54e7 100644
--- a/erpnext/public/less/erpnext.less
+++ b/erpnext/public/less/erpnext.less
@@ -156,3 +156,55 @@
 .dashboard-list-item:last-child {
 	border-bottom: none;
 }
+
+.payment-toolbar {
+	margin-left: 35px;
+}
+
+.payment-mode {
+	cursor: pointer;
+	font-family: sans-serif;
+	font-size: 15px;
+}
+
+.pos-payment-row .col-xs-6 {
+	padding :10px;
+}
+
+.pos-payment-row {
+	border-bottom:1px solid #d1d8dd;
+    margin: 2px 0px 5px 0px;
+}
+
+.pos-payment-row:hover, .pos-keyboard-key:hover{
+	background-color: #FAFBFC;
+	cursor: pointer;
+}
+
+.pos-keyboard-key, .delete-btn {
+	border: 1px solid #d1d8dd;
+	height:85px;
+	width:85px;
+	margin:10px 10px;
+	font-size:24px;
+	font-weight:200;
+	background-color: #FDFDFD;
+	border-color: #e8e8e8;
+}
+
+.amount {
+	margin-top: 5px;
+}
+
+.amount-label {
+	font-size: 16px;
+}
+
+.selected-payment-mode {
+	background-color: #FAFBFC;
+	cursor: pointer;
+}
+
+.pos-invoice-list {
+	padding: 15px 10px;
+}
diff --git a/erpnext/public/less/website.less b/erpnext/public/less/website.less
index 37e3616..5d89265 100644
--- a/erpnext/public/less/website.less
+++ b/erpnext/public/less/website.less
@@ -84,9 +84,6 @@
 }
 
 .transaction-list-item {
-	padding: 30px;
-	margin: 0px -30px;
-
 	&:hover,
 	&:active,
 	&:focus {
@@ -96,7 +93,6 @@
 	.indicator {
 		font-weight: inherit;
 		color: @text-muted;
-		margin-left: -15px;
 	}
 
 	.transaction-time {
@@ -155,8 +151,8 @@
 	}
 
 	.tax-grand-total-row {
-		border-top: 1px solid @border-color;
 		padding-top: 15px;
+		padding-bottom: 30px;
 	}
 
 	.tax-grand-total {
@@ -279,6 +275,13 @@
 	margin-top: 15px;
 }
 
+.footer-subscribe {
+	.btn-default {
+		background-color: transparent;
+		border: 1px solid @border-color;
+	}
+}
+
 @media (min-width: 992px) {
 	.footer-subscribe {
 		max-width: 350px;
@@ -305,23 +308,3 @@
 	padding-bottom: 40px;
 }
 
-
-.featured-product-heading, .all-products {
- text-transform: uppercase;
- letter-spacing: 0.5px;
- font-size: 12px;
- font-weight: 500;
-}
-
-.all-products {
- font-weight: 300;
- padding-left: 25px;
- padding-right: 25px;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-.homepage-tagline {
-	font-size:40px !important;
-}
-
diff --git a/erpnext/selling/doctype/customer/customer.js b/erpnext/selling/doctype/customer/customer.js
index 87d028f..2680470 100644
--- a/erpnext/selling/doctype/customer/customer.js
+++ b/erpnext/selling/doctype/customer/customer.js
@@ -30,22 +30,6 @@
 
 		frm.events.add_custom_buttons(frm);
 	},
-	add_custom_buttons: function(frm) {
-		// ["Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"].forEach(function(doctype, i) {
-		// 	if(frappe.model.can_read(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"customer": frm.doc.name};
-		// 			frappe.set_route("List", doctype);
-		// 		}, __("View"));
-		// 	}
-		// 	if(frappe.model.can_create(doctype)) {
-		// 		frm.add_custom_button(__(doctype), function() {
-		// 			frappe.route_options = {"customer": frm.doc.name};
-		// 			new_doc(doctype);
-		// 		}, __("Make"));
-		// 	}
-		// });
-	},
 	validate: function(frm) {
 		if(frm.doc.lead_name) frappe.model.clear_doc("Lead", frm.doc.lead_name);
 	}
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 17050ca..29501f5 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -8,6 +8,10 @@
 		erpnext.queries.setup_queries(frm, "Warehouse", function() {
 			return erpnext.queries.warehouse(frm.doc);
 		});
+
+		// formatter for material request item
+		frm.set_indicator_formatter('item_code',
+			function(doc) { return (doc.qty<=doc.delivered_qty) ? "green" : "orange" })
 	}
 });
 
@@ -117,7 +121,7 @@
 	tc_name: function() {
 		this.get_terms();
 	},
-	
+
 	make_material_request: function() {
 		frappe.model.open_mapped_doc({
 			method: "erpnext.selling.doctype.sales_order.sales_order.make_material_request",
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/doctype/sales_team/sales_team.json b/erpnext/selling/doctype/sales_team/sales_team.json
index d15ce08..8e7772c 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.json
+++ b/erpnext/selling/doctype/sales_team/sales_team.json
@@ -2,10 +2,12 @@
  "allow_copy": 0, 
  "allow_import": 0, 
  "allow_rename": 0, 
+ "beta": 0, 
  "creation": "2013-04-19 13:30:51", 
  "custom": 0, 
  "docstatus": 0, 
  "doctype": "DocType", 
+ "document_type": "Setup", 
  "fields": [
   {
    "allow_on_submit": 1, 
@@ -15,6 +17,7 @@
    "fieldtype": "Link", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 1, 
    "in_list_view": 1, 
    "label": "Sales Person", 
@@ -25,6 +28,7 @@
    "options": "Sales Person", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "200px", 
    "read_only": 0, 
    "report_hide": 0, 
@@ -42,6 +46,7 @@
    "fieldtype": "Data", 
    "hidden": 1, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contact No.", 
@@ -51,6 +56,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
    "report_hide": 0, 
@@ -61,27 +67,6 @@
    "width": "100px"
   }, 
   {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "col_break1", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "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": 1, 
    "bold": 0, 
    "collapsible": 0, 
@@ -89,6 +74,7 @@
    "fieldtype": "Float", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution (%)", 
@@ -98,6 +84,7 @@
    "oldfieldtype": "Currency", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "100px", 
    "read_only": 0, 
    "report_hide": 0, 
@@ -115,6 +102,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Contribution to Net Total", 
@@ -125,6 +113,7 @@
    "options": "Company:company:default_currency", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "print_width": "120px", 
    "read_only": 1, 
    "report_hide": 0, 
@@ -142,6 +131,7 @@
    "fieldtype": "Currency", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
    "in_filter": 0, 
    "in_list_view": 1, 
    "label": "Incentives", 
@@ -152,36 +142,13 @@
    "options": "Company:company:default_currency", 
    "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": "parenttype", 
-   "fieldtype": "Data", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 1, 
-   "in_list_view": 0, 
-   "label": "Parenttype", 
-   "length": 0, 
-   "no_copy": 0, 
-   "oldfieldname": "parenttype", 
-   "oldfieldtype": "Data", 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 1, 
-   "set_only_once": 0, 
-   "unique": 0
   }
  ], 
  "hide_heading": 0, 
@@ -193,12 +160,14 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:57.395852", 
+ "modified": "2016-05-20 11:48:34.343879", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Sales Team", 
  "owner": "Administrator", 
  "permissions": [], 
+ "quick_entry": 1, 
  "read_only": 0, 
- "read_only_onload": 0
+ "read_only_onload": 0, 
+ "track_seen": 0
 }
\ No newline at end of file
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/sales_common.js b/erpnext/selling/sales_common.js
index e613daf..d02fed2 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -10,12 +10,24 @@
 
 frappe.provide("erpnext.selling");
 erpnext.selling.SellingController = erpnext.TransactionController.extend({
+	setup: function() {
+		this._super();
+		this.frm.get_field('items').grid.editable_fields = [
+			{fieldname: 'item_code', columns: 4},
+			{fieldname: 'qty', columns: 2},
+			{fieldname: 'rate', columns: 3},
+			{fieldname: 'amount', columns: 2}
+		];
+	},
+
 	onload: function() {
 		this._super();
 		this.setup_queries();
 	},
 
 	setup_queries: function() {
+
+
 		var me = this;
 
 		this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
@@ -336,17 +348,21 @@
 
 frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {
 	if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) {
-		frappe.call({
-			method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
-			args: {	project: frm.doc.project	},
-			callback: function(r, rt) {
-				if(!r.exc) {
-					$.each(frm.doc["items"] || [], function(i, row) {
-						frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
-						msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
-					})
+		if(frm.doc.project) {
+			frappe.call({
+				method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
+				args: {	project: frm.doc.project	},
+				callback: function(r, rt) {
+					if(!r.exc) {
+						$.each(frm.doc["items"] || [], function(i, row) {
+							if(r.message) {
+								frappe.model.set_value(row.doctype, row.name, "cost_center", r.message);
+								msgprint(__("Cost Center For Item with Item Code '"+row.item_name+"' has been Changed to "+ r.message));
+							}
+						})
+					}
 				}
-			}
-		})
+			})
+		}
 	}
 })
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/naming_series/naming_series.js b/erpnext/setup/doctype/naming_series/naming_series.js
index 5917f52..e2584bf 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.js
+++ b/erpnext/setup/doctype/naming_series/naming_series.js
@@ -21,6 +21,7 @@
 }
 
 cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) {
+	cur_frm.set_value('user_must_always_select', 0);
 	cur_frm.toggle_display(['help_html','set_options', 'user_must_always_select', 'update'],
 		doc.select_doc_for_series);
 
diff --git a/erpnext/setup/setup_wizard/domainify.py b/erpnext/setup/setup_wizard/domainify.py
index 5985708..af4317e 100644
--- a/erpnext/setup/setup_wizard/domainify.py
+++ b/erpnext/setup/setup_wizard/domainify.py
@@ -16,9 +16,9 @@
 			['Stock Settings', None, 'show_barcode_field', 1]
 		]
 	},
-	
-	'Retail': { 
-		'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice',  'Purchase Order', 'Warranty Claim', 
+
+	'Retail': {
+		'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice',  'Purchase Order', 'Warranty Claim',
 		'Accounts', 'Buying'],
 		'remove_roles': ['Manufacturing User', 'Manufacturing Manager'],
 		'properties': [
@@ -29,7 +29,7 @@
 			['Stock Settings', None, 'show_barcode_field', 1]
 		]
 	},
-	
+
 	'Distribution': {
 		'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order',
 			 'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR'],
@@ -41,9 +41,9 @@
 			['Stock Settings', None, 'show_barcode_field', 1]
 		]
 	},
-	
+
 	'Services': {
-		'desktop_icons': ['Project', 'Time Log', 'Customer', 'Sales Invoice', 'Lead', 'Opportunity',
+		'desktop_icons': ['Project', 'Time Log', 'Customer', 'Sales Order', 'Sales Invoice', 'Lead', 'Opportunity',
 			'Expense Claim', 'Employee', 'HR'],
 		'remove_roles': ['Manufacturing User', 'Manufacturing Manager'],
 		'properties': [
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 48766bf..e3e47ae 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -20,6 +20,7 @@
 
 	install_fixtures.install(args.get("country"))
 
+	update_setup_wizard_access()
 	create_fiscal_year_and_company(args)
 	create_users(args)
 	set_defaults(args)
@@ -54,6 +55,16 @@
 
 			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':
+			roles.role = 'Administrator'
+	setup_wizard.flags.ignore_permissions = 1
+	setup_wizard.save()
+
 def create_fiscal_year_and_company(args):
 	if (args.get('fy_start_date')):
 		curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
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/startup/boot.py b/erpnext/startup/boot.py
index f3f620e..7bdcb0a 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -30,7 +30,7 @@
 				tabCompany limit 1""") and 'Yes' or 'No'
 
 		bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center,
-			default_terms, default_letter_head from `tabCompany`""",
+			default_terms, default_letter_head, default_bank_account from `tabCompany`""",
 			as_dict=1, update={"doctype":":Company"})
 
 def load_country_and_currency(bootinfo):
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 99edb0f..1c7e504 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -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/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index 699d8b6..f10b981 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -7,7 +7,7 @@
 import frappe
 import json
 import frappe.defaults
-from frappe.utils import cint, nowdate, nowtime, cstr, add_days, flt
+from frappe.utils import cint, nowdate, nowtime, cstr, add_days, flt, today
 from erpnext.stock.stock_ledger import get_previous_sle
 from erpnext.accounts.utils import get_balance_on
 from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt \
@@ -516,8 +516,7 @@
 def create_delivery_note(**args):
 	dn = frappe.new_doc("Delivery Note")
 	args = frappe._dict(args)
-	if args.posting_date:
-		dn.posting_date = args.posting_date
+	dn.posting_date = args.posting_date or today()
 	if args.posting_time:
 		dn.posting_time = args.posting_time
 
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/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 1dcbcb7..68ce231 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -3,7 +3,21 @@
 
 {% include 'erpnext/buying/doctype/purchase_common/purchase_common.js' %};
 
-
+frappe.ui.form.on('Material Request', {
+	setup: function(frm) {
+		frm.get_field('items').grid.editable_fields = [
+			{fieldname: 'item_code', columns: 4},
+			{fieldname: 'qty', columns: 2},
+			{fieldname: 'warehouse', columns: 3},
+			{fieldname: 'schedule_date', columns: 2},
+		];
+	},
+	onload: function(frm) {
+		// formatter for material request item
+		frm.set_indicator_formatter('item_code',
+			function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" })
+	}
+});
 
 frappe.ui.form.on("Material Request Item", {
 	"qty": function(frm, doctype, name) {
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index a950180..ef1c574 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -15,9 +15,9 @@
 from erpnext.manufacturing.doctype.production_order.production_order import get_item_details
 
 
-form_grid_templates = {
-	"items": "templates/form_grid/material_request_grid.html"
-}
+# form_grid_templates = {
+# 	"items": "templates/form_grid/material_request_grid.html"
+# }
 
 class MaterialRequest(BuyingController):
 	def get_feed(self):
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 7122459..43109a5 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -3,6 +3,7 @@
  "allow_import": 0, 
  "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, 
@@ -2416,7 +2418,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2016-04-06 05:39:45.971761", 
+ "modified": "2016-05-23 15:21:48.427994", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Purchase Receipt", 
@@ -2523,6 +2525,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/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index dc81405..eba9201 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -6,7 +6,7 @@
 import unittest
 import frappe
 import frappe.defaults
-from frappe.utils import cint, flt, cstr
+from frappe.utils import cint, flt, cstr, today
 from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
 
 class TestPurchaseReceipt(unittest.TestCase):
@@ -193,6 +193,7 @@
 		po = create_purchase_order()
 		
 		pr1 = make_purchase_receipt(po.name)
+		pr1.posting_date = today()
 		pr1.posting_time = "10:00"
 		pr1.get("items")[0].received_qty = 2
 		pr1.get("items")[0].qty = 2
@@ -209,6 +210,7 @@
 		pi2.submit()
 		
 		pr2 = make_purchase_receipt(po.name)
+		pr2.posting_date = today()
 		pr2.posting_time = "08:00"
 		pr2.get("items")[0].received_qty = 5
 		pr2.get("items")[0].qty = 5
@@ -236,8 +238,7 @@
 def make_purchase_receipt(**args):
 	pr = frappe.new_doc("Purchase Receipt")
 	args = frappe._dict(args)
-	if args.posting_date:
-		pr.posting_date = args.posting_date
+	pr.posting_date = args.posting_date or today()
 	if args.posting_time:
 		pr.posting_time = args.posting_time
 	pr.company = args.company or "_Test Company"
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 76b0395..69d9a76 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -49,6 +49,14 @@
 				};
 			});
 		}
+
+		this.frm.get_field('items').grid.editable_fields = [
+			{fieldname: 'item_code', columns: 3},
+			{fieldname: 'qty', columns: 2},
+			{fieldname: 's_warehouse', columns: 3},
+			{fieldname: 't_warehouse', columns: 3}
+		];
+
 	},
 
 	onload_post_render: function() {
@@ -59,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/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/form_grid/material_request_grid.html b/erpnext/templates/form_grid/material_request_grid.html
deleted file mode 100644
index 866c06e..0000000
--- a/erpnext/templates/form_grid/material_request_grid.html
+++ /dev/null
@@ -1,49 +0,0 @@
-{% var visible_columns = row.get_visible_columns(["item_code", "warehouse",
-	"item_name", "amount", "stock_uom", "uom", "qty", "schedule_date"]); %}
-
-{% if(!doc) { %}
-	<div class="row">
-		<div class="col-sm-4">{%= __("Item") %}</div>
-		<div class="col-sm-3">{%= __("Required On") %}</div>
-		<div class="col-sm-3">{%= __("Warehouse") %}</div>
-		<div class="col-sm-2 text-right">{%= __("Qty") %}</div>
-	</div>
-{% } else { %}
-	<div class="row">
-		<div class="col-sm-4">
-            <span class="indicator {%= (doc.qty<=doc.ordered_qty) ? "green" : "orange" %}">{%= doc.item_code %}</strong>
-			{% if(doc.item_name != doc.item_code) { %}
-				<br>{%= doc.item_name %}{% } %}
-            <!-- {% if(doc.item_name != doc.description) { %}
-                <p>{%= doc.description %}</p>{% } %} -->
-			{% include "templates/form_grid/includes/visible_cols.html" %}
-		</div>
-
-
-		<div class="col-sm-3">
-			{% if(doc.schedule_date) { %}
-                <span title="{%= __("Reqd By Date") %}" class="{%=
-				(frappe.datetime.get_diff(doc.schedule_date, frappe.datetime.get_today()) < 0
-					&& doc.ordered_qty < doc.qty)
-					? "text-danger" : "text-muted" %}">
-					{%= doc.get_formatted("schedule_date") %}</span>
-			{% } %}
-        </div>
-
-        <!-- warehouse -->
-		<div class="col-sm-3">
-			{% if(doc.warehouse) { %}
-				<span class="label label-default" title="{%= __("For Warehouse") %}"
-                    style="margin-right: 10px;">
-					{%= doc.warehouse %}
-				</span>
-			{% } %}
-        </div>
-
-		<!-- qty -->
-		<div class="col-sm-2 text-right">
-			{%= doc.get_formatted("qty") %}
-			<span class="small">{%= doc.uom || doc.stock_uom %}</span>
-		</div>
-	</div>
-{% } %}
diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html
index 17f9b90..f0fee97 100644
--- a/erpnext/templates/includes/transaction_row.html
+++ b/erpnext/templates/includes/transaction_row.html
@@ -9,7 +9,7 @@
 					{{ frappe.utils.format_datetime(doc.modified, "medium") }}
 				</div>
 			</div>
-			<div class="col-sm-4 items-preview text-ellipsis">
+			<div class="col-sm-4 items-preview text-ellipsis small">
 				{{ doc.items_preview }}
 			</div>
 			<div class="col-sm-3 text-right bold">
diff --git a/erpnext/templates/pages/home.html b/erpnext/templates/pages/home.html
index 689d94e..56bf019 100644
--- a/erpnext/templates/pages/home.html
+++ b/erpnext/templates/pages/home.html
@@ -7,8 +7,10 @@
 
 <div class="row">
 	<div class="col-sm-12">
-		<div class="homepage-tagline h1 text-center">{{ homepage.tag_line or '' }}</div>
-		<p class="text-center">{{ homepage.description or '' }}</p>
+		<div class="hero">
+			<h1 class="text-center">{{ homepage.tag_line or '' }}</h1>
+			<p class="text-center">{{ homepage.description or '' }}</p>
+		</div>
 		{% if homepage.products %}
 		<div class='featured-products-section' itemscope itemtype="http://schema.org/Product">
 			<h5 class='featured-product-heading'>{{ _("Featured Products") }}</h5>
@@ -27,7 +29,9 @@
 				</div>
 			</div>
 			<!-- TODO: remove hardcoding of /products -->
-			<div class="text-center"><a href="/products" class="btn btn-primary all-products">  {{ _("View All Products") }}</a></div>
+			<div class="text-center padding">
+				<a href="/products" class="btn btn-primary all-products">
+					{{ _("View All Products") }}</a></div>
 		</div>
 		{% endif %}
 	</div>
@@ -36,8 +40,14 @@
 
 {% block style %}
 <style>
-	.featured-products-section {
-		margin-top: 95px;
+	.hero {
+		padding-top: 50px;
+		padding-bottom: 100px;
+	}
+
+	.hero h1 {
+		font-size: 40px;
+		font-weight: 200;
 	}
 
 	.home-login {
@@ -47,6 +57,21 @@
 		width: 80px;
 	}
 
+	.featured-product-heading, .all-products {
+		 text-transform: uppercase;
+		 letter-spacing: 0.5px;
+		 font-size: 12px;
+		 font-weight: 500;
+	}
+
+	.all-products {
+		 font-weight: 300;
+		 padding-left: 25px;
+		 padding-right: 25px;
+		 padding-top: 10px;
+		 padding-bottom: 10px;
+	}
+
 
 </style>
 {% endblock %}
diff --git a/erpnext/translations/kn.csv b/erpnext/translations/kn.csv
index 6f5ee71..b7f23d6 100644
--- a/erpnext/translations/kn.csv
+++ b/erpnext/translations/kn.csv
@@ -2120,7 +2120,7 @@
 ,Pending SO Items For Purchase Request,ಖರೀದಿ ವಿನಂತಿ ಆದ್ದರಿಂದ ಐಟಂಗಳು ಬಾಕಿ
 apps/erpnext/erpnext/accounts/party.py +322,{0} {1} is disabled,{0} {1} ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಲಾಗಿದೆ
 DocType: Supplier,Billing Currency,ಬಿಲ್ಲಿಂಗ್ ಕರೆನ್ಸಿ
-apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ದೊಡ್ಡದು
+apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +148,Extra Large,ಎಕ್ಸ್ಟ್ರಾ ದೊಡ್ಡದು
 ,Profit and Loss Statement,ಲಾಭ ಮತ್ತು ನಷ್ಟ ಹೇಳಿಕೆ
 DocType: Bank Reconciliation Detail,Cheque Number,ಚೆಕ್ ಸಂಖ್ಯೆ
 DocType: Payment Tool Detail,Payment Tool Detail,ಪಾವತಿ ಉಪಕರಣ ವಿವರ
@@ -2130,7 +2130,7 @@
 apps/erpnext/erpnext/setup/setup_wizard/setup_wizard.py +362,Local,ಸ್ಥಳೀಯ
 apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +26,Loans and Advances (Assets),ಸಾಲ ಮತ್ತು ಅಡ್ವಾನ್ಸಸ್ ( ಆಸ್ತಿಗಳು )
 apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +12,Debtors,ಸಾಲಗಾರರು
-apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡದು
+apps/erpnext/erpnext/setup/setup_wizard/install_fixtures.py +147,Large,ದೊಡ್ಡ
 DocType: C-Form Invoice Detail,Territory,ಕ್ಷೇತ್ರ
 apps/erpnext/erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py +143,Please mention no of visits required,ನಮೂದಿಸಿ ಅಗತ್ಯವಿದೆ ಭೇಟಿ ಯಾವುದೇ
 DocType: Stock Settings,Default Valuation Method,ಡೀಫಾಲ್ಟ್ ಮೌಲ್ಯಮಾಪನ ವಿಧಾನ
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 9ced174..a1088bd 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 from pip.req import parse_requirements
 
-version = "6.27.17"
+version = "6.27.21"
 requirements = parse_requirements("requirements.txt", session="")
 
 setup(