Merge pull request #14002 from rohitwaghchaure/search_item_spelling_issue

Fixed spelling
diff --git a/.travis.yml b/.travis.yml
index ad9822d..70df757 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,6 +35,7 @@
   - bench reinstall --yes
   - bench build
   - bench scheduler disable
+  - sed -i 's/9000/9001/g' sites/common_site_config.json
   - bench start &
   - sleep 10
 
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 540e223..a20b21a 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.1.28'
+__version__ = '10.1.31'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
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 5452040..e0d8149 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
@@ -24,7 +24,8 @@
 	                "account_type": "Cash"
 	            },
 	            _("Loans and Advances (Assets)"): {
-	            	"is_group": 1
+                    	_("Employee Advances"): {
+                    	},
 	            },
 	            _("Securities and Deposits"): {
 	                _("Earnest Money"): {}
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
index bad8453..df7853f 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
@@ -29,7 +29,9 @@
                     "account_number": "1100"
                 },
                 _("Loans and Advances (Assets)"): {
-                    "is_group": 1,
+                    _("Employee Advances"): {
+                        "account_number": "1610"
+                    },
                     "account_number": "1600"
                 },
                 _("Securities and Deposits"): {
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
index 0439b73..f7ffc6c 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.js
@@ -2,7 +2,7 @@
 // For license information, please see license.txt
 
 frappe.ui.form.on('Bank Guarantee', {
-	refresh: function(frm) {
+	setup: function(frm) {
 		cur_frm.set_query("account", function() {
 			return {
 				"filters": {
@@ -19,6 +19,39 @@
 			};
 		});
 	},
+
+	bg_type: function(frm) {
+		if (frm.doc.bg_type == "Receiving") {
+			frm.set_value("reference_doctype", "Sales Order");
+		} else if (frm.doc.bg_type == "Providing") {
+			frm.set_value("reference_doctype", "Purchase Order");
+		}
+	},
+
+	reference_docname: function(frm) {
+		if (frm.doc.reference_docname && frm.doc.reference_doctype) {
+			let fields_to_fetch = ["project", "grand_total"];
+			let party_field = frm.doc.reference_doctype == "Sales Order" ? "customer" : "supplier";
+			fields_to_fetch.push(party_field);
+			frappe.call({
+				method: "erpnext.accounts.doctype.bank_guarantee.bank_guarantee.get_vouchar_detials",
+				args: {
+					"column_list": fields_to_fetch,
+					"doctype": frm.doc.reference_doctype,
+					"docname": frm.doc.reference_docname
+				},
+				callback: function(r) {
+					if (r.message) {
+						if (r.message[party_field]) frm.set_value(party_field, r.message[party_field]);
+						if (r.message.project) frm.set_value("project", r.message.project);
+						if (r.message.grand_total) frm.set_value("amount", r.message.grand_total);
+					}
+				}
+			});
+
+		}
+	},
+
 	start_date: function(frm) {
 		var end_date = frappe.datetime.add_days(cur_frm.doc.start_date, cur_frm.doc.validity - 1);
 		cur_frm.set_value("end_date", end_date);
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
index 807c544..b3cd157 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.json
@@ -19,6 +19,103 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "bg_type", 
+   "fieldtype": "Select", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Bank Guarantee Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "\nReceiving\nProviding", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 1, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reference_doctype", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference Document Type", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "DocType", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "reference_docname", 
+   "fieldtype": "Dynamic Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Reference Document Name", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "reference_doctype", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.bg_type == \"Receiving\"", 
    "fieldname": "customer", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -39,9 +136,43 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "eval: doc.bg_type == \"Providing\"", 
+   "fieldname": "supplier", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Supplier", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "Supplier", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -73,6 +204,37 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_6", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -101,9 +263,10 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -134,35 +297,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fieldname": "column_break_6", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -193,6 +328,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -221,9 +357,10 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -251,9 +388,103 @@
    "read_only": 1, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "section_break_14", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "more_information", 
+   "fieldtype": "Text Editor", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Clauses and Conditions", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "margin_details", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Other Details", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -281,19 +512,20 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 1, 
+   "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 1
   }, 
   {
    "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
-   "collapsible": 1, 
+   "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "section_break_10", 
-   "fieldtype": "Section Break", 
+   "fieldname": "name_of_beneficiary", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -301,7 +533,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "More Information", 
+   "label": "Name of Beneficiary", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -314,6 +546,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -322,8 +555,8 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "fieldname": "more_information", 
-   "fieldtype": "Text Editor", 
+   "fieldname": "name_of_bank", 
+   "fieldtype": "Data", 
    "hidden": 0, 
    "ignore_user_permissions": 0, 
    "ignore_xss_filter": 0, 
@@ -331,7 +564,7 @@
    "in_global_search": 0, 
    "in_list_view": 0, 
    "in_standard_filter": 0, 
-   "label": "Notes", 
+   "label": "Name of Bank", 
    "length": 0, 
    "no_copy": 0, 
    "permlevel": 0, 
@@ -344,6 +577,133 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_19", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "margin_money", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Margin Money", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "", 
+   "depends_on": "", 
+   "fieldname": "charges", 
+   "fieldtype": "Currency", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Charges Incurred", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "depends_on": "", 
+   "fieldname": "fixed_deposit_number", 
+   "fieldtype": "Data", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Fixed Deposit Number", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -374,6 +734,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -387,7 +748,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-04-25 13:31:49.627831", 
+ "modified": "2018-05-08 06:27:08.959864", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Bank Guarantee", 
@@ -396,7 +757,6 @@
  "permissions": [
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
    "delete": 0, 
@@ -416,7 +776,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 1, 
    "create": 1, 
    "delete": 1, 
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
index 71647b9..1a62c42 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
@@ -3,8 +3,26 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import frappe
+import frappe, json
 from frappe.model.document import Document
+from frappe import _
 
 class BankGuarantee(Document):
-	pass
+	def validate(self):
+		if not (self.customer or self.supplier):
+			frappe.throw(_("Select the customer or supplier."))
+
+	def on_submit(self):
+		if not self.bank_guarantee_number:
+			frappe.throw(_("Enter the Bank Guarantee Number before submittting."))
+		if not self.name_of_beneficiary:
+			frappe.throw(_("Enter the name of the Beneficiary before submittting."))
+		if not self.name_of_bank:
+			frappe.throw(_("Enter the name of the bank or lending institution before submittting."))
+
+@frappe.whitelist()
+def get_vouchar_detials(column_list, doctype, docname):
+	print (column_list, doctype, docname)
+	return frappe.db.sql(''' select {columns} from `tab{doctype}` where name=%s'''
+		.format(columns=", ".join(json.loads(column_list)), doctype=doctype), docname, as_dict=1)[0]
+
diff --git a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
deleted file mode 100644
index 0e56991..0000000
--- a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-# See license.txt
-from __future__ import unicode_literals
-
-import frappe
-import unittest
-
-# test_records = frappe.get_test_records('Bank Guarantee')
-
-class TestBankGuarantee(unittest.TestCase):
-	pass
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index 0556e9b..24cd3dd 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -27,10 +27,20 @@
 	doc = frappe.get_doc("Cheque Print Template", template_name)
 	
 	cheque_print.html = """
+<style>
+	.print-format {
+		padding: 0px;
+	}
+	@media screen {
+		.print-format {
+			padding: 0in;
+		}
+	}
+</style>
 <div style="position: relative; top:%(starting_position_from_top_edge)scm">
 	<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
 		<span style="top:%(acc_pay_dist_from_top_edge)scm; left:%(acc_pay_dist_from_left_edge)scm;
-			border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
+			border-bottom: solid 1px;border-top:solid 1px; width:2cm;text-align: center; position: absolute;">
 				%(message_to_show)s
 		</span>
 		<span style="top:%(date_dist_from_top_edge)scm; left:%(date_dist_from_left_edge)scm;
@@ -38,11 +48,11 @@
 			{{ frappe.utils.formatdate(doc.reference_date) or '' }}
 		</span>
 		<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
-			position: absolute;">
+			position: absolute;  min-width: 6cm;">
 			{{ doc.account_no or '' }}
 		</span>
 		<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
-			position: absolute;">
+			position: absolute;  min-width: 6cm;">
 			{{doc.party_name}}
 		</span>
 		<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
@@ -51,11 +61,11 @@
 				{{frappe.utils.money_in_words(doc.base_paid_amount or doc.base_received_amount)}}
 		</span>
 		<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
-			position: absolute;">
+			position: absolute; min-width: 4cm;">
 			{{doc.get_formatted("base_paid_amount") or doc.get_formatted("base_received_amount")}}
 		</span>
 		<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
-			position: absolute;">
+			position: absolute;  min-width: 6cm;">
 			{{doc.company}}
 		</span>
 	</div>
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
index f12de79..4ca9f6b 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.json
@@ -1,5 +1,6 @@
 {
  "allow_copy": 0, 
+ "allow_guest_to_view": 0, 
  "allow_import": 1, 
  "allow_rename": 0, 
  "autoname": "field:year", 
@@ -13,6 +14,7 @@
  "editable_grid": 0, 
  "fields": [
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -41,9 +43,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -70,9 +74,11 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -100,9 +106,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -128,9 +136,11 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
+   "allow_bulk_edit": 0, 
    "allow_on_submit": 0, 
    "bold": 0, 
    "collapsible": 0, 
@@ -158,21 +168,54 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "default": "0", 
+   "fieldname": "auto_created", 
+   "fieldtype": "Check", 
+   "hidden": 1, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Auto Created", 
+   "length": 0, 
+   "no_copy": 1, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
+ "has_web_view": 0, 
  "hide_heading": 0, 
  "hide_toolbar": 0, 
  "icon": "fa fa-calendar", 
  "idx": 1, 
  "image_view": 0, 
  "in_create": 0, 
- "in_dialog": 0, 
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-02-17 16:22:08.431278", 
+ "modified": "2018-04-25 14:21:41.273354", 
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Fiscal Year", 
@@ -180,7 +223,6 @@
  "permissions": [
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
    "delete": 1, 
@@ -200,7 +242,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
@@ -220,7 +261,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
@@ -240,7 +280,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
@@ -260,7 +299,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
@@ -280,7 +318,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 0, 
    "delete": 0, 
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 517a2a3..92da787 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -104,6 +104,7 @@
 			start_year = cstr(new_fy.year_start_date.year)
 			end_year = cstr(new_fy.year_end_date.year)
 			new_fy.year = start_year if start_year==end_year else (start_year + "-" + end_year)
+			new_fy.auto_created = 1
 
 			new_fy.insert(ignore_permissions=True)
 		except frappe.NameError:
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
index 062a2d2..f101b6a 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
@@ -9,7 +9,7 @@
 			'Payment Request': 'reference_name',
 			'Landed Cost Voucher': 'receipt_document',
 			'Purchase Invoice': 'return_against',
-			'Subscription': 'reference_document'
+			'Auto Repeat': 'reference_document'
 		},
 		'internal_links': {
 			'Purchase Order': ['items', 'purchase_order'],
@@ -30,7 +30,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 2fcca75..a01dc29 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -113,18 +113,6 @@
 		$.each(doc["items"], function(i, row) {
 			if(row.delivery_note) frappe.model.clear_doc("Delivery Note", row.delivery_note)
 		})
-
-		if(this.frm.doc.is_pos) {
-			this.frm.msgbox = frappe.msgprint(
-				`<a class="btn btn-primary" onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">
-					${__('Print')}</a>
-				<a class="btn btn-default" href="javascript:frappe.new_doc(cur_frm.doctype);">
-					${__('New')}</a>`
-				);
-
-		} else if(cint(frappe.boot.notification_settings.sales_invoice)) {
-			this.frm.email_doc(frappe.boot.notification_settings.sales_invoice_message);
-		}
 	},
 
 	set_default_print_format: function() {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
index efd18b5..71fce77 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
@@ -9,7 +9,7 @@
 			'Payment Entry': 'reference_name',
 			'Payment Request': 'reference_name',
 			'Sales Invoice': 'return_against',
-			'Subscription': 'reference_document',
+			'Auto Repeat': 'reference_document',
 		},
 		'internal_links': {
 			'Sales Order': ['items', 'sales_order']
@@ -29,7 +29,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/accounts/email_alert/__init__.py b/erpnext/accounts/email_alert/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/email_alert/__init__.py
diff --git a/erpnext/accounts/email_alert/notification_for_new_fiscal_year/__init__.py b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/__init__.py
diff --git a/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.json b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.json
new file mode 100644
index 0000000..2e524d6
--- /dev/null
+++ b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.json
@@ -0,0 +1,28 @@
+{
+ "attach_print": 0, 
+ "condition": "doc.auto_created", 
+ "creation": "2018-04-25 14:19:05.440361", 
+ "days_in_advance": 0, 
+ "docstatus": 0, 
+ "doctype": "Email Alert", 
+ "document_type": "Fiscal Year", 
+ "enabled": 1, 
+ "event": "New", 
+ "idx": 0, 
+ "is_standard": 1, 
+ "message": "<h3>{{_(\"Fiscal Year\")}}</h3>\n\n<p>{{ _(\"New fiscal year created :- \") }} {{ doc.name }}</p>", 
+ "modified": "2018-04-25 14:30:38.588534", 
+ "modified_by": "Administrator", 
+ "module": "Accounts", 
+ "name": "Notification for new fiscal year", 
+ "owner": "Administrator", 
+ "recipients": [
+  {
+   "email_by_role": "Accounts User"
+  }, 
+  {
+   "email_by_role": "Accounts Manager"
+  }
+ ], 
+ "subject": "Notification for new fiscal year {{ doc.name }}"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.md b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.md
new file mode 100644
index 0000000..c674ab6
--- /dev/null
+++ b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.md
@@ -0,0 +1,3 @@
+<h3>{{_("Fiscal Year")}}</h3>
+
+<p>{{ _("New fiscal year created :- ") }} {{ doc.name }}</p>
\ No newline at end of file
diff --git a/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
new file mode 100644
index 0000000..1bc4d18
--- /dev/null
+++ b/erpnext/accounts/email_alert/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
@@ -0,0 +1,5 @@
+from __future__ import unicode_literals
+
+def get_context(context):
+	# do your magic here
+	pass
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 6f272cf..f7179d6 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -130,15 +130,15 @@
 
 def set_price_list(out, party, party_type, given_price_list):
 	# price list
-	price_list = filter(None, get_user_permissions().get("Price List", []))
-	if isinstance(price_list, list):
-		price_list = price_list[0] if len(price_list)==1 else None
+	price_list = filter(None, get_user_permissions()
+		.get("Price List", {})
+		.get("docs", []))
+	price_list = list(price_list)
 
-	if not price_list:
-		price_list = get_default_price_list(party)
-
-	if not price_list:
-		price_list = given_price_list
+	if price_list:
+		price_list = price_list[0]
+	else:
+		price_list = get_default_price_list(party) or given_price_list
 
 	if price_list:
 		out.price_list_currency = frappe.db.get_value("Price List", price_list, "currency")
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index c97db6d..671408f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -409,12 +409,6 @@
 	}
 }
 
-cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(frappe.boot.notification_settings.purchase_order)) {
-		cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message);
-	}
-}
-
 function set_schedule_date(frm) {
 	if(frm.doc.schedule_date){
 		erpnext.utils.copy_value_in_all_row(frm.doc, frm.doc.doctype, frm.doc.name, "items", "schedule_date");
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
index d57b0e2..cce4b27 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
@@ -6,7 +6,7 @@
 		'non_standard_fieldnames': {
 			'Journal Entry': 'reference_name',
 			'Payment Entry': 'reference_name',
-			'Subscription': 'reference_document'
+			'Auto Repeat': 'reference_document'
 		},
 		'internal_links': {
 			'Material Request': ['items', 'material_request'],
@@ -24,7 +24,7 @@
 			},
 			{
 				'label': _('Reference'),
-				'items': ['Material Request', 'Supplier Quotation', 'Project', 'Subscription']
+				'items': ['Material Request', 'Supplier Quotation', 'Project', 'Auto Repeat']
 			},
 			{
 				'label': _('Sub-contracting'),
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
index 4321f27..0387437 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
@@ -4,7 +4,7 @@
 	return {
 		'fieldname': 'supplier_quotation',
 		'non_standard_fieldnames': {
-			'Subscription': 'reference_document'
+			'Auto Repeat': 'reference_document'
 		},
 		'internal_links': {
 			'Material Request': ['items', 'material_request'],
@@ -22,7 +22,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 
diff --git a/erpnext/config/accounts.py b/erpnext/config/accounts.py
index 088a119..2494562 100644
--- a/erpnext/config/accounts.py
+++ b/erpnext/config/accounts.py
@@ -34,8 +34,8 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Subscription",
-					"label": _("Subscription"),
+					"name": "Auto Repeat",
+					"label": _("Auto Repeat"),
 					"description": _("To make recurring documents")
 				},
 				{
diff --git a/erpnext/config/setup.py b/erpnext/config/setup.py
index 878b2f2..e38b30d 100644
--- a/erpnext/config/setup.py
+++ b/erpnext/config/setup.py
@@ -81,12 +81,6 @@
 					"type": "doctype",
 					"name": "Authorization Rule",
 					"description": _("Create rules to restrict transactions based on values.")
-				},
-				{
-					"type": "doctype",
-					"name": "Notification Control",
-					"label": _("Email Notifications"),
-					"description": _("Automatically compose message on submission of transactions.")
 				}
 			]
 		},
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index fd13c13..2ba32ce 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -168,6 +168,7 @@
 			and tabItem.disabled=0
 			and (tabItem.end_of_life > %(today)s or ifnull(tabItem.end_of_life, '0000-00-00')='0000-00-00')
 			and (tabItem.`{key}` LIKE %(txt)s
+				or tabItem.item_code LIKE %(txt)s
 				or tabItem.item_group LIKE %(txt)s
 				or tabItem.item_name LIKE %(txt)s
 				or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s
diff --git a/erpnext/docs/assets/img/human-resources/employee-loan-application.png b/erpnext/docs/assets/img/human-resources/employee-loan-application.png
deleted file mode 100644
index 317de4f..0000000
--- a/erpnext/docs/assets/img/human-resources/employee-loan-application.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/employee-loan.png b/erpnext/docs/assets/img/human-resources/employee-loan.png
deleted file mode 100644
index 19f3181..0000000
--- a/erpnext/docs/assets/img/human-resources/employee-loan.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/loan-application.png b/erpnext/docs/assets/img/human-resources/loan-application.png
new file mode 100644
index 0000000..3c6cfd2
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/loan-application.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/loan.png b/erpnext/docs/assets/img/human-resources/loan.png
new file mode 100644
index 0000000..f2f71d4
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/loan.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/repayment-schedule.png b/erpnext/docs/assets/img/human-resources/repayment-schedule.png
index f2ddf02..31085c1 100644
--- a/erpnext/docs/assets/img/human-resources/repayment-schedule.png
+++ b/erpnext/docs/assets/img/human-resources/repayment-schedule.png
Binary files differ
diff --git a/erpnext/docs/assets/img/users-and-permissions/user-perms/new-user-permission.png b/erpnext/docs/assets/img/users-and-permissions/user-perms/new-user-permission.png
index d2762dd..d9e1a6a 100644
--- a/erpnext/docs/assets/img/users-and-permissions/user-perms/new-user-permission.png
+++ b/erpnext/docs/assets/img/users-and-permissions/user-perms/new-user-permission.png
Binary files differ
diff --git a/erpnext/docs/user/manual/de/human-resources/offer-letter.md b/erpnext/docs/user/manual/de/human-resources/job-offer.md
similarity index 100%
rename from erpnext/docs/user/manual/de/human-resources/offer-letter.md
rename to erpnext/docs/user/manual/de/human-resources/job-offer.md
diff --git a/erpnext/docs/user/manual/de/manufacturing/tools/index.txt b/erpnext/docs/user/manual/de/manufacturing/tools/index.txt
index 1f798d0..bdd357c 100644
--- a/erpnext/docs/user/manual/de/manufacturing/tools/index.txt
+++ b/erpnext/docs/user/manual/de/manufacturing/tools/index.txt
@@ -1,2 +1 @@
-production-planning-tool
-bom-replace-tool
+bom-update-tool
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/de/manufacturing/tools/production-planning-tool.md b/erpnext/docs/user/manual/de/manufacturing/tools/production-planning-tool.md
deleted file mode 100644
index 63e51f8..0000000
--- a/erpnext/docs/user/manual/de/manufacturing/tools/production-planning-tool.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Werkzeug zur Fertigungsplanung
-<span class="text-muted contributed-by">Beigetragen von CWT Connector & Wire Technology GmbH</span>
-
-Das Werkzeug zur Fertigungsplanung unterstützt Sie dabei die Fertigung zu planen und Artikel für eine Periode einzukaufen (normalerweise eine Woche oder ein Monat).
-
-Die Liste der Artikel kann über die offenen Kundenaufträge im System erstellt werden. Folgendes wird angelegt:
-
-* Fertigungsaufträge für jeden Artikel.
-* Materialanforderung für Artikel deren vorhergesagte Menge wahrscheinlich unter 0 fällt.
-
-Um das Werkzeug zur Fertigungsplanung zu nutzen, gehen Sie zu:
-
-> Fertigung > Werkzeuge > Werkzeug zur Fertigungsplanung
-
-<img class="screenshot" alt="Werkzeug zur Fertigungsplanung" src="{{docs_base_url}}/assets/img/manufacturing/ppt.png">
-
-### Schritt 1: Auswahl und Kundenauftrag
-
-* Wählen Sie einen Kundenauftrag für die Materialanforderung über die Filterfunktion (Zeit, Artikel und Kunde) aus.
-* Klicken Sie auf "Kundenaufträge aufrufen" um eine Übersicht zu erhalten.
-
-<img class="screenshot" alt="Werkzeug zur Fertigungsplanung" src="{{docs_base_url}}/assets/img/manufacturing/ppt-get-sales-orders.png">
-
-### Schritt 2: Artikel aus Kundenaufträgen abrufen
-
-Sie können Artikel hinzufügen, entfernen oder die Menge dieser Artikel verändern.
-
-<img class="screenshot" alt="Werkzeug zur Fertigungsplanung" src="{{docs_base_url}}/assets/img/manufacturing/ppt-get-item.png">
-
-### Schritt 3: Fertigungsaufträge erstellen
-
-<img class="screenshot" alt="Werkzeug zur Fertigungsplanung" src="{{docs_base_url}}/assets/img/manufacturing/ppt-create-production-order.png">
-
-### Schritt 4: Materialanfragen erstellen
-
-Erstellen Sie für Artikel mit prognostiziertem Engpass Materialanfragen.
-
-<img class="screenshot" alt="Werkzeug zur Fertigungsplanung" src="{{docs_base_url}}/assets/img/manufacturing/ppt-create-material-request.png">
-
-Das Werkzeug zur Fertigungsplanung wird auf zwei Ebenend verwendet:
-
-* Auswahl von offenen Kundenaufträge einer Periode auf Basis des erwarteten Lieferdatums.
-* Auswahl von Artikeln aus diesen Kundenaufträgen.
-
-Das Werkzeug erstellt eine Aktualisierung, wenn Sie bereits einen Kundenauftrag für einen bestimmten Artikel zu einem Kundenauftrag erstellt haben ("geplante Menge").
-
-Sie könnenjederzeit die Artikelliste bearbeiten und die zur Fertigung geplante Menge erhöhen bzw. vermindern.
-
-> Anmerkung: Wie ändern Sie einen Fertigungsplan? Des Ergebnis des Werkzeuges zur Produktionsplanung ist der Fertigungsauftrag. Sobald Ihre Aufträge erstellt wurden, können Sie sie ändern, indem Sie die Fertigungsaufträge ändern.
-
-{next}
diff --git a/erpnext/docs/user/manual/en/human-resources/loan-management.md b/erpnext/docs/user/manual/en/human-resources/loan-management.md
index d8a548b..9457e1a 100644
--- a/erpnext/docs/user/manual/en/human-resources/loan-management.md
+++ b/erpnext/docs/user/manual/en/human-resources/loan-management.md
@@ -18,7 +18,7 @@
 
 > Human Resources > Loan Management > Loan Application > New Loan Application
 
-<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan-application.png">
+<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/loan-application.png">
 
 #### In the Loan Application,
 
@@ -35,7 +35,7 @@
 
 > Human Resources > Loan Management > Loan > New Loan
 
-<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/employee-loan.png">
+<img class="screenshot" alt="Loan Application" src="{{docs_base_url}}/assets/img/human-resources/loan.png">
 
 #### In the Loan,
 
diff --git a/erpnext/docs/user/manual/en/manufacturing/tools/index.txt b/erpnext/docs/user/manual/en/manufacturing/tools/index.txt
index a385154..bdd357c 100644
--- a/erpnext/docs/user/manual/en/manufacturing/tools/index.txt
+++ b/erpnext/docs/user/manual/en/manufacturing/tools/index.txt
@@ -1,2 +1 @@
-production-planning-tool
 bom-update-tool
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/manufacturing/tools/production-planning-tool.md b/erpnext/docs/user/manual/en/manufacturing/tools/production-planning-tool.md
deleted file mode 100644
index 4b7ee7a..0000000
--- a/erpnext/docs/user/manual/en/manufacturing/tools/production-planning-tool.md
+++ /dev/null
@@ -1,75 +0,0 @@
-# Production Planning Tool
-
-Production Planning Tool helps you plan production and purchase of Items for a
-period (usually a week or a month).
-
-<div class-"embed-container">
-  <iframe src="https://www.youtube.com/embed/i0E_RcngliQ?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
-  </iframe>
-</div>
-
-This list of Items can be generated from the open Sales Orders or pending Material Requests that can be Manufactured in the system
-and will generate:
-
-  * Work Orders for each Item.
-  * Purchase Requests for Items whose Projected Quantity is likely to fall below zero.
-
-To use the Production Planning Tool, go to:
-
-> Manufacturing > Tools > Production Planning Tool
-
-<img class="screenshot" alt="Production Planing Tool" src="{{docs_base_url}}/assets/img/manufacturing/ppt.png">
-
-#### Step 1: Specify source to get Production Items
-
-* You can select Sales Order or Material Request according to where you want to source the items from
-* If you plan to add items manually, keep the "Get items from" field empty
-
-
-
-#### Step 2: Select and get Sales Order / Material Request
-
-* Use filters to get the Sales Order / Material Request
-* Click on Get Sales Order / Get Material Requests to generate a list.
-
-<img class="screenshot" alt="Production Planing Tool" src="{{docs_base_url}}/assets/img/manufacturing/ppt-get-sales-orders.png">
-
-
-
-#### Step 3: Get Items
-
-* Get the items for the Sales Order / Material request list
-* You can add/remove or change quantity of these Items.
-
-<img class="screenshot" alt="Production Planing Tool" src="{{docs_base_url}}/assets/img/manufacturing/ppt-get-item.png">
-
-#### Step 4: Create Work Orders
-
-<img class="screenshot" alt="Production Planing Tool" src="{{docs_base_url}}/assets/img/manufacturing/ppt-create-production-order.png">
-
-
-
-#### Step 5: Create Material Request
-
-Create Material Request for Items with projected shortfall.
-
-<img class="screenshot" alt="Production Planing Tool" src="{{docs_base_url}}/assets/img/manufacturing/ppt-create-material-request.png">
-
-
-
-The Production Planning Tool is used in two stages:
-
-  * Selection of open Sales Orders / pending Material Request for the period based on “Expected Delivery Date”.
-  * Selection of Items from those Sales Orders / Material Requests
-
-The tool will update if you have already created Production Orde rs for a
-particular Item against its Sales Order (“Planned Quantity”) or Material Request.
-
-You can always edit the Item list and increase / reduce quantities to plan
-your production.
-
-> Note: How do you change a Production Plan? The output of the Production
-Planning Tool is the Work Order. Once your orders are created, you can
-change them by amending the Work Orders.
-
-{next}
diff --git a/erpnext/docs/user/manual/en/setting-up/users-and-permissions/user-permissions.md b/erpnext/docs/user/manual/en/setting-up/users-and-permissions/user-permissions.md
index db444d1..4ff84df 100644
--- a/erpnext/docs/user/manual/en/setting-up/users-and-permissions/user-permissions.md
+++ b/erpnext/docs/user/manual/en/setting-up/users-and-permissions/user-permissions.md
@@ -1,6 +1,6 @@
 # User Permissions
 
-Along with Role based permissions, you can also set user level permissions that are based on rules that are evaluated against the data containted in the document being accessed. This is particularly useful when you want to restrict based on:
+Along with Role based permissions, you can also set user level permissions that are based on rules that are evaluated against the data contained in the document being accessed. This is particularly useful when you want to restrict based on:
 
 1. Allow user to access data belonging to one Company
 1. Allow user to access data related to a specific Customer or Territory
@@ -17,28 +17,14 @@
 
 <img src="{{docs_base_url}}/assets/img/users-and-permissions/user-perms/new-user-permission.png" class="screenshot" alt="Creating a new user permission">
 
-If you want to apply the permissions to all Roles for that user, keep the "Apply Permissions for all Roles of this User" checked. If you check this, it will automatically setup the rules for Roles to check for User Permissions.
-
-### Choosing Which Roles to Apply
-
-You can also manually edit the the roles for which you want the user permissions to apply. To do that go the the **Role Permission Manager** and select the role for which you want to Edit the User Permissions.
-
-Note that the "Apply User Permissions" is already checked for this role. Then click on "Select Document Types"
-
-<img src="{{docs_base_url}}/assets/img/users-and-permissions/user-perms/select-document-types.png" class="screenshot" alt="Select Document Types to Edit the Setting">
-
-Here you will see that Company has already been checked. If you want user permissions not be applied for that particular rule, you can un check it.
-
-<img src="{{docs_base_url}}/assets/img/users-and-permissions/user-perms/view-selected-documents.png" class="screenshot" alt="Select Document Types to Edit the Setting">
-
 ### Ignoring User Permissions on Certain Fields
 
-Another way of allowing documents to be seen that have been restricited by User Permissions is to check "Ignore User Permissions" on a particular field by going to **Customize Form**
+Another way of allowing documents to be seen that have been restricted by User Permissions is to check "Ignore User Permissions" on a particular field by going to **Customize Form**
 
-For example you don't want Assets to be restricited for any user, then select **Asset** in **Customize Form** and in the Company field, check on "Ignore User Permissions"
+For example you don't want Assets to be restricted for any user, then select **Asset** in **Customize Form** and in the Company field, check on "Ignore User Permissions"
 
 
-<img src="{{docs_base_url}}/assets/img/users-and-permissions/user-perms/ignore-user-user-permissions.png" class="screenshot" alt="Ignore User Permissions on specific properties">
+<img src="{{docs_base_url}}/assets/img/users-and-permissions/user-perms/ignore-user-permissions.png" class="screenshot" alt="Ignore User Permissions on specific properties">
 
 
 ### Strict Permissions
diff --git a/erpnext/docs/user/videos/learn/index.md b/erpnext/docs/user/videos/learn/index.md
index 4457de0..f10061c 100644
--- a/erpnext/docs/user/videos/learn/index.md
+++ b/erpnext/docs/user/videos/learn/index.md
@@ -215,10 +215,6 @@
             Bill of Materials</a>
             <span class="text-muted pull-right">3:27</span>
         </li>
-        <li><a href="/docs/user/videos/learn/production-planning.html">
-            Production Planning Tool</a>
-              <span class="text-muted pull-right">1:41</span>
-        </li>
         <li><a href="/docs/user/videos/learn/work-order.html">
             Work Order</a>
             <span class="text-muted pull-right">2:24</span>
diff --git a/erpnext/docs/user/videos/learn/production-planning.md b/erpnext/docs/user/videos/learn/production-planning.md
deleted file mode 100644
index 2af4c91..0000000
--- a/erpnext/docs/user/videos/learn/production-planning.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Production Planning Tool
-
-<iframe width="660" height="371" src="https://www.youtube.com/embed/CzatSl4zJ2Y" frameborder="0" allowfullscreen></iframe>
-
-**Duration: 1:41**
-
-Production Planning Tool helps you plan production and purchase of Items for a period.
-
-This video walks you through production planning for Sales Order item. Material Planning allows you to check required quantity of raw materials for manufacturing. You can create Material Request for the raw-material items for which sufficient stock is not available. From Production Planning Tool, you can also create Work Order for the finished items.
diff --git a/erpnext/education/doctype/fees/fees.js b/erpnext/education/doctype/fees/fees.js
index 2a7218a..7346a8d 100644
--- a/erpnext/education/doctype/fees/fees.js
+++ b/erpnext/education/doctype/fees/fees.js
@@ -66,6 +66,9 @@
 				};
 				frappe.set_route("query-report", "General Ledger");
 			}, __("View"));
+			frm.add_custom_button(__("Payments"), function() {
+				frappe.set_route("List", "Payment Entry", {"Payment Entry Reference.reference_name": frm.doc.name});
+			}, __("View"));
 		}
 		if(frm.doc.docstatus===1 && frm.doc.outstanding_amount>0) {
 			frm.add_custom_button(__("Payment Request"), function() {
diff --git a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.js b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.js
index d5103ca..565074d 100644
--- a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.js
+++ b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.js
@@ -24,7 +24,7 @@
 		frm.page.clear_indicator();
 		frm.page.set_primary_action(__('Print Report Card'), () => {
 			let url = "/api/method/erpnext.education.doctype.student_report_generation_tool.student_report_generation_tool.preview_report_card";
-			open_url_post(url, frm.doc, true);
+			open_url_post(url, {"doc": frm.doc}, true);
 		});
 	},
 
diff --git a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
index 7b2e007..f997975 100644
--- a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
+++ b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
@@ -3,7 +3,7 @@
 # For license information, please see license.txt
 
 from __future__ import unicode_literals
-import frappe
+import frappe, json
 from frappe.model.document import Document
 from erpnext.education.api import get_grade
 from frappe.utils.pdf import get_pdf
@@ -16,8 +16,8 @@
 
 
 @frappe.whitelist()
-def preview_report_card(**kwargs):
-	doc = frappe._dict(**kwargs)
+def preview_report_card(doc):
+	doc = frappe._dict(json.loads(doc))
 	doc.students = [doc.student]
 	if not (doc.student_name and doc.student_batch):
 		program_enrollment = frappe.get_all("Program Enrollment", fields=["student_batch_name", "student_name"],
@@ -33,7 +33,7 @@
 	course_criteria = get_courses_criteria(courses)
 
 	# get the assessment group as per the user selection
-	if int(doc.include_all_assessment):
+	if doc.include_all_assessment:
 		assessment_groups = get_child_assessment_groups(doc.assessment_group)
 	else:
 		assessment_groups = [doc.assessment_group]
@@ -55,7 +55,7 @@
 			"assessment_groups": assessment_groups,
 			"course_criteria": course_criteria,
 			"letterhead": letterhead.content,
-			"add_letterhead": int(doc.add_letterhead) if int(doc.add_letterhead) else 0
+			"add_letterhead": doc.add_letterhead if doc.add_letterhead else 0
 		})
 	final_template = frappe.render_template(base_template_path, {"body": html, "title": "Report Card"})
 
diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py
index 451c491..472a2f2 100755
--- a/erpnext/healthcare/doctype/consultation/consultation.py
+++ b/erpnext/healthcare/doctype/consultation/consultation.py
@@ -108,9 +108,11 @@
 
 def update_consultation_to_medical_record(consultation):
 	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name))
-	if(medical_record_id[0][0]):
+	if medical_record_id and medical_record_id[0][0]:
 		subject = set_subject_field(consultation)
 		frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject)
+	else:
+		insert_consultation_to_medical_record(consultation)
 
 def delete_medical_record(consultation):
 	frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name))
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py
index 766491d..c910d7c 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.py
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.py
@@ -244,7 +244,7 @@
 def delete_lab_test_from_medical_record(self):
 	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(self.name))
 
-	if(medical_record_id[0][0]):
+	if medical_record_id and medical_record_id[0][0]:
 		frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
 
 def create_item_line(test_code, sales_invoice):
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
index a42ff02..41d9258 100644
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
@@ -27,7 +27,7 @@
 
 def delete_vital_signs_from_medical_record(doc):
 	medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(doc.name))
-	if(medical_record_id[0][0]):
+	if medical_record_id and medical_record_id[0][0]:
 		frappe.delete_doc("Patient Medical Record", medical_record_id[0][0])
 
 def set_subject_field(doc):
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index 7b04f7d..7a4cb64 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -8,6 +8,7 @@
 from frappe import _
 from frappe.model.document import Document
 from erpnext.hr.utils import set_employee_name
+from frappe.utils import cstr
 
 class Attendance(Document):
 	def validate_duplicate_record(self):
@@ -54,3 +55,36 @@
 		self.validate_attendance_date()
 		self.validate_duplicate_record()
 		self.check_leave_record()
+
+@frappe.whitelist()
+def get_events(start, end, filters=None):
+	events = []
+
+	employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user})
+
+	if not employee:
+		return events
+
+	from frappe.desk.reportview import get_filters_cond
+	conditions = get_filters_cond("Attendance", filters, [])
+	add_attendance(events, start, end, conditions=conditions)
+	return events
+
+def add_attendance(events, start, end, conditions=None):
+	query = """select name, attendance_date, status
+		from `tabAttendance` where
+		attendance_date between %(from_date)s and %(to_date)s
+		and docstatus < 2"""
+	if conditions:
+		query += conditions
+
+	for d in frappe.db.sql(query, {"from_date":start, "to_date":end}, as_dict=True):
+		e = {
+			"name": d.name,
+			"doctype": "Attendance",
+			"date": d.attendance_date,
+			"title": cstr(d.status),
+			"docstatus": d.docstatus
+		}
+		if e not in events:
+			events.append(e)
\ No newline at end of file
diff --git a/erpnext/hr/doctype/attendance/attendance_calendar.js b/erpnext/hr/doctype/attendance/attendance_calendar.js
new file mode 100644
index 0000000..b21afe5
--- /dev/null
+++ b/erpnext/hr/doctype/attendance/attendance_calendar.js
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+frappe.views.calendar["Attendance"] = {
+	field_map: {
+		"start": "date",
+		"end": "date",
+		"id": "name",
+		"docstatus": 1
+	},
+	options: {
+		header: {
+			left: 'prev,next today',
+			center: 'title',
+			right: 'month'
+		}
+	},
+	get_events_method: "erpnext.hr.doctype.attendance.attendance.get_events"
+};
\ No newline at end of file
diff --git a/erpnext/hr/doctype/department/department.js b/erpnext/hr/doctype/department/department.js
index 8f83db0..71cf2d2 100644
--- a/erpnext/hr/doctype/department/department.js
+++ b/erpnext/hr/doctype/department/department.js
@@ -3,21 +3,6 @@
 
 frappe.ui.form.on('Department', {
 	onload: function(frm) {
-		frm.set_query("leave_approver", "leave_approvers", function(doc) {
-			return {
-				query:"erpnext.hr.doctype.department_approver.department_approver.get_department_approvers",
-				filters:{
-					user: doc.user_id
-				}
-			};
-		});
-		frm.set_query("expense_approver", "expense_approvers", function(doc) {
-			return {
-				query:"erpnext.hr.doctype.department_approver.department_approver.get_department_approvers",
-				filters:{
-					user: doc.user_id
-				}
-			};
-		});
+
 	}
 });
diff --git a/erpnext/hr/doctype/department_approver/department_approver.py b/erpnext/hr/doctype/department_approver/department_approver.py
index b65e8ff..d30d801 100644
--- a/erpnext/hr/doctype/department_approver/department_approver.py
+++ b/erpnext/hr/doctype/department_approver/department_approver.py
@@ -10,16 +10,6 @@
 class DepartmentApprover(Document):
 	pass
 
-def get_department_approvers(doctype, txt, searchfield, start, page_len, filters):
-	return get_approver_list(filters.get("user"))
-
-def get_approver_list(name):
-	return frappe.db.sql("""select user.name, user.first_name, user.last_name from
-		tabUser user where
-		user.enabled and
-		user.name != %s 
-		""", name or "")
-
 @frappe.whitelist()
 def get_approvers(doctype, txt, searchfield, start, page_len, filters):
 
@@ -27,6 +17,8 @@
 		frappe.throw(_("Please select Employee Record first."))
 
 	approvers = []
+	department_details = {}
+	department_list = []
 	employee_department = filters.get("department") or frappe.get_value("Employee", filters.get("employee"), "department")
 	if employee_department:
 		department_details = frappe.db.get_value("Department", {"name": employee_department}, ["lft", "rgt"], as_dict=True)
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index 5e06488..f9d1c43 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -120,12 +120,6 @@
 	cur_frm.cscript.calculate_total(doc,cdt,cdn);
 };
 
-cur_frm.cscript.on_submit = function() {
-	if(cint(frappe.boot.notification_settings && frappe.boot.notification_settings.expense_claim)) {
-		cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message);
-	}
-};
-
 erpnext.expense_claim = {
 	set_title :function(frm) {
 		if (!frm.doc.task) {
@@ -156,6 +150,19 @@
 	},
 
 	onload: function(frm) {
+		if (frm.doc.docstatus == 0) {
+			return frappe.call({
+				method: "erpnext.hr.doctype.leave_application.leave_application.get_mandatory_approval",
+				args: {
+					doctype: frm.doc.doctype,
+				},
+				callback: function(r) {
+					if (!r.exc && r.message) {
+						frm.toggle_reqd("expense_approver", true);
+					}
+				}
+			});
+		}
 		frm.set_query("expense_approver", function() {
 			return {
 				query: "erpnext.hr.doctype.department_approver.department_approver.get_approvers",
@@ -187,11 +194,6 @@
 			frm.add_custom_button(__('Payment'),
 				function() { frm.events.make_payment_entry(frm); }, __("Make"));
 		}
-		frappe.db.get_value('HR Settings', {name: 'HR Settings'}, 'expense_approver_mandatory_in_expense_claim', (r) => {
-			if (frm.doc.docstatus < 1 && (r.expense_approver_mandatory_in_expense_claim == 1)) {
-				frm.toggle_reqd("expense_approver", true);
-			}
-		});
 	},
 
 	make_payment_entry: function(frm) {
@@ -211,7 +213,7 @@
 			}
 		});
 	},
-	
+
 	set_query_for_cost_center: function(frm) {
 		frm.fields_dict["cost_center"].get_query = function() {
 			return {
@@ -262,7 +264,7 @@
 					employee: frm.doc.employee
 				},
 				callback: function(r, rt) {
-				
+
 					if(r.message) {
 						$.each(r.message, function(i, d) {
 							var row = frappe.model.add_child(frm.doc, "Expense Claim Advance", "advances");
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.json b/erpnext/hr/doctype/hr_settings/hr_settings.json
index d1e02be..225785d 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.json
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.json
@@ -452,6 +452,66 @@
    "set_only_once": 0, 
    "translatable": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "leave_settings", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Leave Settings", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "show_leaves_of_all_department_members_in_calendar", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Show Leaves Of All Department Members In Calendar", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 0, 
@@ -465,7 +525,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-04-14 17:09:15.904645", 
+ "modified": "2018-05-03 15:36:13.015466", 
  "modified_by": "Administrator", 
  "module": "HR", 
  "name": "HR Settings", 
diff --git a/erpnext/hr/doctype/hr_settings/test_hr_settings.py b/erpnext/hr/doctype/hr_settings/test_hr_settings.py
index 00f183e..2d5b18b 100644
--- a/erpnext/hr/doctype/hr_settings/test_hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/test_hr_settings.py
@@ -3,6 +3,7 @@
 # See license.txt
 from __future__ import unicode_literals
 
+import frappe
 import unittest
 
 class TestHRSettings(unittest.TestCase):
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index 242c987..48d4650 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -9,7 +9,19 @@
 		if (!frm.doc.posting_date) {
 			frm.set_value("posting_date", frappe.datetime.get_today());
 		}
-
+		if (frm.doc.docstatus == 0) {
+			return frappe.call({
+				method: "erpnext.hr.doctype.leave_application.leave_application.get_mandatory_approval",
+				args: {
+					doctype: frm.doc.doctype,
+				},
+				callback: function(r) {
+					if (!r.exc && r.message) {
+						frm.toggle_reqd("leave_approver", true);
+					}
+				}
+			});
+		}
 		frm.set_query("leave_approver", function() {
 			return {
 				query: "erpnext.hr.doctype.department_approver.department_approver.get_approvers",
@@ -35,11 +47,6 @@
 		if(frm.doc.__islocal && !in_list(frappe.user_roles, "Employee")) {
 			frm.set_intro(__("Fill the form and save it"));
 		}
-		frappe.db.get_value('HR Settings', {name: 'HR Settings'}, 'leave_approver_mandatory_in_leave_application', (r) => {
-			if (frm.doc.docstatus < 1 && (r.leave_approver_mandatory_in_leave_application == 1)) {
-				frm.toggle_reqd("leave_approver", true);
-			}
-		});
 	},
 
 	employee: function(frm) {
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 4231cc2..069e6ee 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -404,16 +404,29 @@
 		and company=%s""", (department, company))
 
 	match_conditions = "and employee in (\"%s\")" % '", "'.join(department_employees)
-	add_leaves(events, start, end, match_conditions=match_conditions)
+	add_leaves(events, start, end, filter_conditions=match_conditions)
 
-def add_leaves(events, start, end, match_conditions=None):
-	query = """select name, from_date, to_date, employee_name, color, half_day,
-		employee, docstatus
+def add_leaves(events, start, end, filter_conditions=None):
+	conditions = []
+
+	if filter_conditions:
+		conditions.append(filter_conditions)
+
+	if not cint(frappe.db.get_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar")):
+		from frappe.desk.reportview import build_match_conditions
+		match_conditions = build_match_conditions("Leave Application")
+
+		if match_conditions:
+			conditions.append(match_conditions)
+
+	query = """select name, from_date, to_date, employee_name, half_day,
+		status, employee, docstatus
 		from `tabLeave Application` where
 		from_date <= %(end)s and to_date >= %(start)s <= to_date
 		and docstatus < 2"""
-	if match_conditions:
-		query += match_conditions
+
+	if conditions:
+		query += ' and '.join(conditions)
 
 	for d in frappe.db.sql(query, {"start":start, "end": end}, as_dict=True):
 		e = {
@@ -461,3 +474,16 @@
 				"title": _("Holiday") + ": " + cstr(holiday.description),
 				"name": holiday.name
 			})
+
+@frappe.whitelist()
+def get_mandatory_approval(doctype):
+	mandatory = ""
+	if doctype == "Leave Application":
+		mandatory = frappe.db.get_single_value('HR Settings', 
+				'leave_approver_mandatory_in_leave_application')
+	else:
+		mandatory = frappe.db.get_single_value('HR Settings', 
+				'expense_approver_mandatory_in_expense_claim')
+
+	return mandatory
+	
\ No newline at end of file
diff --git a/erpnext/hr/doctype/payroll_entry/payroll_entry.py b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
index 1025bc7..e5311f1 100644
--- a/erpnext/hr/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/hr/doctype/payroll_entry/payroll_entry.py
@@ -183,7 +183,7 @@
 			Get loan details from submitted salary slip based on selected criteria
 		"""
 		cond = self.get_filter_condition()
-		return frappe.db.sql(""" select eld.loan_account,
+		return frappe.db.sql(""" select eld.loan_account, eld.loan
 				eld.interest_income_account, eld.principal_amount, eld.interest_amount, eld.total_payment
 			from
 				`tabSalary Slip` t1, `tabSalary Slip Loan` eld
@@ -293,7 +293,7 @@
 					})
 
 				if data.interest_amount and not data.interest_income_account:
-					frappe.throw(_("Select interest income account in employee loan {0}").format(data.employee_loan))
+					frappe.throw(_("Select interest income account in loan {0}").format(data.loan))
 
 				if data.interest_income_account and data.interest_amount:
 					accounts.append({
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 982a721..d138587 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -525,3 +525,8 @@
 erpnext.patches.v10_0.taxes_issue_with_pos
 erpnext.patches.v10_1.transfer_subscription_to_auto_repeat
 erpnext.patches.v10_1.drop_old_subscription_records
+erpnext.patches.v11_0.update_brand_in_item_price
+erpnext.patches.v11_0.create_default_success_action
+erpnext.patches.v10_0.taxes_issue_with_pos
+erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input
+erpnext.patches.v10_0.show_leaves_of_all_department_members_in_calendar
diff --git a/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py b/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py
new file mode 100644
index 0000000..5dbcb1d
--- /dev/null
+++ b/erpnext/patches/v10_0/set_qty_in_transactions_based_on_serial_no_input.py
@@ -0,0 +1,12 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.reload_doc("stock", "doctype", "stock_settings")
+
+	ss = frappe.get_doc("Stock Settings")
+	ss.set_qty_in_transactions_based_on_serial_no_input = 1
+	ss.save()
\ No newline at end of file
diff --git a/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py b/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py
new file mode 100644
index 0000000..1ae8b4a
--- /dev/null
+++ b/erpnext/patches/v10_0/show_leaves_of_all_department_members_in_calendar.py
@@ -0,0 +1,5 @@
+import frappe
+
+def execute():
+	frappe.reload_doc("hr", "doctype", "hr_settings")
+	frappe.db.set_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar", 1)
\ No newline at end of file
diff --git a/erpnext/patches/v11_0/create_default_success_action.py b/erpnext/patches/v11_0/create_default_success_action.py
new file mode 100644
index 0000000..29687d2
--- /dev/null
+++ b/erpnext/patches/v11_0/create_default_success_action.py
@@ -0,0 +1,6 @@
+import frappe
+from erpnext.setup.install import create_default_success_action
+
+def execute():
+	frappe.reload_doc("core", "doctype", "success_action")
+	create_default_success_action()
diff --git a/erpnext/patches/v11_0/update_brand_in_item_price.py b/erpnext/patches/v11_0/update_brand_in_item_price.py
new file mode 100644
index 0000000..a19a6c4
--- /dev/null
+++ b/erpnext/patches/v11_0/update_brand_in_item_price.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import frappe
+
+def execute():
+	frappe.reload_doc('stock', 'doctype', 'item_price')
+
+	frappe.db.sql(""" update `tabItem Price`, `tabItem`
+		set
+			`tabItem Price`.brand = `tabItem`.brand
+		where
+			`tabItem Price`.item_code = `tabItem`.name 
+			and `tabItem`.brand is not null and `tabItem`.brand != ''""")
\ No newline at end of file
diff --git a/erpnext/patches/v9_0/fix_subscription_next_date.py b/erpnext/patches/v9_0/fix_subscription_next_date.py
index 07af712..ac9db31 100644
--- a/erpnext/patches/v9_0/fix_subscription_next_date.py
+++ b/erpnext/patches/v9_0/fix_subscription_next_date.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 import frappe
 from frappe.utils import getdate
-from erpnext.accounts.doctype.subscription.subscription import get_next_schedule_date
+from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date
 
 def execute():
 	frappe.reload_doctype('Subscription')
diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
index b948238..b1f7372 100644
--- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
+++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
@@ -264,7 +264,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval:parent.production_order", 
+   "depends_on": "eval:parent.work_order", 
    "fieldname": "completed_qty", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -296,7 +296,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval:parent.production_order", 
+   "depends_on": "eval:parent.work_order", 
    "fieldname": "workstation", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -359,7 +359,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval:parent.production_order", 
+   "depends_on": "eval:parent.work_order", 
    "fieldname": "operation", 
    "fieldtype": "Link", 
    "hidden": 0, 
@@ -392,7 +392,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "depends_on": "eval:parent.production_order", 
+   "depends_on": "eval:parent.work_order", 
    "fieldname": "operation_id", 
    "fieldtype": "Data", 
    "hidden": 1, 
@@ -932,7 +932,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-03-21 17:13:32.561550", 
+ "modified": "2018-05-07 15:12:31.510813", 
  "modified_by": "Administrator", 
  "module": "Projects", 
  "name": "Timesheet Detail", 
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 102090b..05bc104 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -400,7 +400,7 @@
 				item.serial_no = valid_serial_nos.join('\n');
 
 				refresh_field("serial_no", item.name, item.parentfield);
-				if(!doc.is_return) {
+				if(!doc.is_return && cint(user_defaults.set_qty_in_transactions_based_on_serial_no_input)) {
 					frappe.model.set_value(item.doctype, item.name,
 						"qty", valid_serial_nos.length / item.conversion_factor);
 					frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
diff --git a/erpnext/public/js/help_links.js b/erpnext/public/js/help_links.js
index e812f19..fa843bc 100644
--- a/erpnext/public/js/help_links.js
+++ b/erpnext/public/js/help_links.js
@@ -504,10 +504,6 @@
 	{ label: 'Operation', url: 'https://frappe.github.io/erpnext/user/manual/en/manufacturing/operation' },
 ]
 
-frappe.help.help_links['Form/Production Planning Tool'] = [
-	{ label: 'Production Planning Tool', url: 'https://frappe.github.io/erpnext/user/manual/en/manufacturing/tools/production-planning-tool' },
-]
-
 frappe.help.help_links['Form/BOM Update Tool'] = [
 	{ label: 'BOM Update Tool', url: 'https://frappe.github.io/erpnext/user/manual/en/manufacturing/tools/bom-update-tool' },
 ]
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index 50a2e0d..f9e0156 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -143,7 +143,17 @@
 		""" % (self.doctype, ', '.join(['%s']*len(self.invoices))), tuple(self.invoices), as_dict=1)
 
 		for d in items:
-			self.invoice_items.setdefault(d.parent, {}).setdefault(d.item_code, d.base_net_amount)
+			item_details = {}
+			item_details[d.item_code] = d.base_net_amount
+
+			if d.parent in self.invoice_items:
+				parent_dict = self.invoice_items[d.parent]
+				if d.item_code in parent_dict:
+					item_details[d.item_code] += parent_dict[d.item_code]
+				else:
+					item_details.update(parent_dict)
+
+			self.invoice_items[d.parent] = item_details
 
 	def get_items_based_on_tax_rate(self):
 		self.tax_details = frappe.db.sql("""
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/__init__.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/__init__.py
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js
new file mode 100644
index 0000000..df0ef25
--- /dev/null
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.js
@@ -0,0 +1,23 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["HSN-wise-summary of outward supplies"] = {
+	"filters": [
+		{
+			"fieldname":"company",
+			"label": __("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"reqd": 1,
+			"default": frappe.defaults.get_user_default("Company")
+		},
+		{
+			"fieldname":"gst_hsn_code",
+			"label": __("HSN/SAC"),
+			"fieldtype": "Link",
+			"options": "GST HSN Code",
+			"width": "80"
+		}
+	]
+}
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.json b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.json
new file mode 100644
index 0000000..0cafdc8
--- /dev/null
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.json
@@ -0,0 +1,29 @@
+{
+ "add_total_row": 0, 
+ "creation": "2018-04-26 10:49:29.159400", 
+ "disabled": 0, 
+ "docstatus": 0, 
+ "doctype": "Report", 
+ "idx": 0, 
+ "is_standard": "Yes", 
+ "letter_head": "Standard", 
+ "modified": "2018-04-26 12:59:38.603649", 
+ "modified_by": "Administrator", 
+ "module": "Regional", 
+ "name": "HSN-wise-summary of outward supplies", 
+ "owner": "Administrator", 
+ "ref_doctype": "Sales Invoice", 
+ "report_name": "HSN-wise-summary of outward supplies", 
+ "report_type": "Script Report", 
+ "roles": [
+  {
+   "role": "Accounts User"
+  }, 
+  {
+   "role": "Accounts Manager"
+  }, 
+  {
+   "role": "Auditor"
+  }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
new file mode 100644
index 0000000..165458c
--- /dev/null
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
@@ -0,0 +1,217 @@
+# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe, erpnext
+from frappe import _
+from frappe.utils import flt
+from frappe.model.meta import get_field_precision
+from frappe.utils.xlsxutils import handle_html
+
+def execute(filters=None):
+	return _execute(filters)
+
+def _execute(filters=None):
+	if not filters: filters = {}
+	columns = get_columns()
+
+	company_currency = erpnext.get_company_currency(filters.company)
+	item_list = get_items(filters)
+	if item_list:
+		itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency)
+
+	data = []
+	for d in item_list:
+		row = [d.gst_hsn_code, d.description, d.stock_uom, d.stock_qty]
+		total_tax = 0
+		for tax in tax_columns:
+			item_tax = itemised_tax.get(d.name, {}).get(tax, {})
+			total_tax += flt(item_tax.get("tax_amount"))
+
+		row += [d.base_net_amount + total_tax]
+		row += [d.base_net_amount]
+
+		for tax in tax_columns:
+			item_tax = itemised_tax.get(d.name, {}).get(tax, {})
+			row += [item_tax.get("tax_amount", 0)]
+
+		data.append(row)
+	if data:
+		data = get_merged_data(columns, data) # merge same hsn code data
+	return columns, data
+
+def get_columns():
+	columns = [
+		{
+			"fieldname": "gst_hsn_code",
+			"label": _("HSN/SAC"),
+			"fieldtype": "Link",
+			"options": "GST HSN Code",
+			"width": 100
+		},
+		{
+			"fieldname": "description",
+			"label": _("Description"),
+			"fieldtype": "Data",
+			"width": 300
+		},
+		{
+			"fieldname": "stock_uom",
+			"label": _("Stock UOM"),
+			"fieldtype": "Data",
+			"width": 100
+		},
+		{
+			"fieldname": "stock_qty",
+			"label": _("Stock Qty"),
+			"fieldtype": "Float",
+			"width": 90
+		},
+		{
+			"fieldname": "total_amount",
+			"label": _("Total Amount"),
+			"fieldtype": "Currency",
+			"width": 120
+		},
+		{
+			"fieldname": "taxable_amount",
+			"label": _("Total Taxable Amount"),
+			"fieldtype": "Currency",
+			"width": 170
+		}
+	]
+
+	return columns
+
+def get_conditions(filters):
+	conditions = ""
+
+	for opts in (("company", " and company=%(company)s"),
+		("gst_hsn_code", " and gst_hsn_code=%(gst_hsn_code)s")):
+			if filters.get(opts[0]):
+				conditions += opts[1]
+
+	return conditions
+
+def get_items(filters):
+	conditions = get_conditions(filters)
+	match_conditions = frappe.build_match_conditions("Sales Invoice")
+	if match_conditions:
+		match_conditions = " and {0} ".format(match_conditions)
+
+
+	return frappe.db.sql("""
+		select
+			`tabSales Invoice Item`.name, `tabSales Invoice Item`.base_price_list_rate,
+			`tabSales Invoice Item`.gst_hsn_code, `tabSales Invoice Item`.stock_qty,
+			`tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.base_net_amount,
+			`tabSales Invoice Item`.parent, `tabSales Invoice Item`.item_code,
+			`tabGST HSN Code`.description
+		from `tabSales Invoice`, `tabSales Invoice Item`, `tabGST HSN Code`
+		where `tabSales Invoice`.name = `tabSales Invoice Item`.parent
+			and `tabSales Invoice`.docstatus = 1
+			and `tabSales Invoice Item`.gst_hsn_code is not NULL
+			and `tabSales Invoice Item`.gst_hsn_code = `tabGST HSN Code`.name %s %s
+
+		""" % (conditions, match_conditions), filters, as_dict=1)
+
+
+def get_tax_accounts(item_list, columns, company_currency,
+		doctype="Sales Invoice", tax_doctype="Sales Taxes and Charges"):
+	import json
+	item_row_map = {}
+	tax_columns = []
+	invoice_item_row = {}
+	itemised_tax = {}
+	conditions = ""
+
+	tax_amount_precision = get_field_precision(frappe.get_meta(tax_doctype).get_field("tax_amount"),
+		currency=company_currency) or 2
+
+	for d in item_list:
+		invoice_item_row.setdefault(d.parent, []).append(d)
+		item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d)
+
+	tax_details = frappe.db.sql("""
+		select
+			parent, description, item_wise_tax_detail,
+			base_tax_amount_after_discount_amount
+		from `tab%s`
+		where
+			parenttype = %s and docstatus = 1
+			and (description is not null and description != '')
+			and parent in (%s)
+			%s
+		order by description
+	""" % (tax_doctype, '%s', ', '.join(['%s']*len(invoice_item_row)), conditions),
+		tuple([doctype] + list(invoice_item_row)))
+
+	for parent, description, item_wise_tax_detail, tax_amount in tax_details:
+		description = handle_html(description)
+		if description not in tax_columns and tax_amount:
+			# as description is text editor earlier and markup can break the column convention in reports
+			tax_columns.append(description)
+
+		if item_wise_tax_detail:
+			try:
+				item_wise_tax_detail = json.loads(item_wise_tax_detail)
+
+				for item_code, tax_data in item_wise_tax_detail.items():
+					if not frappe.db.get_value("Item", item_code, "gst_hsn_code"):
+						continue
+					itemised_tax.setdefault(item_code, frappe._dict())
+					if isinstance(tax_data, list):
+						tax_amount = tax_data[1]
+					else:
+						tax_amount = 0
+
+					for d in item_row_map.get(parent, {}).get(item_code, []):
+						item_tax_amount = tax_amount
+						if item_tax_amount:
+							itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
+								"tax_amount": flt(item_tax_amount, tax_amount_precision)
+							})
+			except ValueError:
+				continue
+
+	tax_columns.sort()
+	for desc in tax_columns:
+		columns.append(desc + " Amount:Currency/currency:160")
+
+	# columns += ["Total Amount:Currency/currency:110"]
+	return itemised_tax, tax_columns
+
+def get_merged_data(columns, data):
+	merged_hsn_dict = {} # to group same hsn under one key and perform row addition
+	add_column_index = [] # store index of columns that needs to be added
+	tax_col = len(get_columns())
+	fields_to_merge = ["stock_qty", "total_amount", "taxable_amount"] # columns for which index needs to be found
+
+	for i,d in enumerate(columns):
+		# check if fieldname in to_merge list and ignore tax-columns
+		if i < tax_col and d["fieldname"] in fields_to_merge:
+			add_column_index.append(i)
+
+	for row in data:
+		if merged_hsn_dict.has_key(row[0]):
+			to_add_row = merged_hsn_dict.get(row[0])
+
+			# add columns from the add_column_index table
+			for k in add_column_index:
+				to_add_row[k] += row[k]
+
+			# add tax columns
+			for k in range(len(columns)):
+				if tax_col <= k < len(columns):
+					to_add_row[k] += row[k]
+
+			# update hsn dict with the newly added data
+			merged_hsn_dict[row[0]] = to_add_row
+		else:
+			merged_hsn_dict[row[0]] = row
+
+	# extract data rows to be displayed in report
+	data = [merged_hsn_dict[d] for d in merged_hsn_dict]
+
+	return data
+
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 92db12b..63e85fd 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -206,11 +206,6 @@
 
 }
 
-cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(frappe.boot.notification_settings.quotation))
-		cur_frm.email_doc(frappe.boot.notification_settings.quotation_message);
-}
-
 frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, cdn) {
 	// enable tax_amount field if Actual
 })
diff --git a/erpnext/selling/doctype/quotation/quotation_dashboard.py b/erpnext/selling/doctype/quotation/quotation_dashboard.py
index c6297e2..d32fd0c 100644
--- a/erpnext/selling/doctype/quotation/quotation_dashboard.py
+++ b/erpnext/selling/doctype/quotation/quotation_dashboard.py
@@ -4,7 +4,7 @@
 	return {
 		'fieldname': 'prevdoc_docname',
 		'non_standard_fieldnames': {
-			'Subscription': 'reference_document',
+			'Auto Repeat': 'reference_document',
 		},
 		'transactions': [
 			{
@@ -13,7 +13,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 20685de..9a2311d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -442,11 +442,6 @@
 				frappe.ui.form.is_saving = false;
 			}
 		});
-	},
-	on_submit: function(doc, cdt, cdn) {
-		if(cint(frappe.boot.notification_settings.sales_order)) {
-			this.frm.email_doc(frappe.boot.notification_settings.sales_order_message);
-		}
 	}
 });
 $.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index ea1b573..711f9f4 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -541,7 +541,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
@@ -572,7 +572,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
@@ -754,7 +754,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
@@ -785,7 +785,7 @@
   }, 
   {
    "allow_bulk_edit": 0, 
-   "allow_on_submit": 0, 
+   "allow_on_submit": 1, 
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
diff --git a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
index 34ed6bc..35c643d 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
+++ b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
@@ -8,7 +8,7 @@
 			'Journal Entry': 'reference_name',
 			'Payment Entry': 'reference_name',
 			'Payment Request': 'reference_name',
-			'Subscription': 'reference_document',
+			'Auto Repeat': 'reference_document',
 		},
 		'internal_links': {
 			'Quotation': ['items', 'prevdoc_docname']
@@ -32,7 +32,7 @@
 			},
 			{
 				'label': _('Reference'),
-				'items': ['Quotation', 'Subscription']
+				'items': ['Quotation', 'Auto Repeat']
 			},
 			{
 				'label': _('Payment'),
diff --git a/erpnext/setup/default_success_action.py b/erpnext/setup/default_success_action.py
new file mode 100644
index 0000000..e8494a1
--- /dev/null
+++ b/erpnext/setup/default_success_action.py
@@ -0,0 +1,26 @@
+from frappe import _
+
+doctype_list = [
+    'Purchase Receipt',
+    'Purchase Invoice',
+    'Quotation',
+    'Sales Order',
+    'Delivery Note',
+    'Sales Invoice'
+]
+
+def get_message(doctype):
+    return _("{0} has been submitted successfully".format(_(doctype)))
+
+def get_first_success_message(doctype):
+    return _("{0} has been submitted successfully".format(_(doctype)))
+
+def get_default_success_action():
+    return [{
+        'doctype': 'Success Action',
+        'ref_doctype': doctype,
+        'message': get_message(doctype),
+        'first_success_message': get_first_success_message(doctype),
+        'next_actions': 'new\nprint\nemail'
+    } for doctype in doctype_list]
+
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index fdea1b1..776dad5 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -186,6 +186,36 @@
 		if not self.default_payable_account:
 			self.db_set("default_payable_account", self.default_payable_account)
 
+		if not self.default_payroll_payable_account:
+			payroll_payable_account = frappe.db.get_value("Account",
+				{"account_name": _("Payroll Payable"), "company": self.name, "is_group": 0})
+
+			self.db_set("default_payroll_payable_account", payroll_payable_account)
+
+		if not self.default_employee_advance_account:
+			employe_advance_account = frappe.db.get_value("Account",
+				{"account_name": _("Employee Advances"), "company": self.name, "is_group": 0})
+
+			self.db_set("default_employee_advance_account", employe_advance_account)
+
+		if not self.write_off_account:
+			write_off_acct = frappe.db.get_value("Account",
+				{"account_name": _("Write Off"), "company": self.name, "is_group": 0})
+
+			self.db_set("write_off_account", write_off_acct)
+
+		if not self.exchange_gain_loss_account:
+			exchange_gain_loss_acct = frappe.db.get_value("Account",
+				{"account_name": _("Exchange Gain/Loss"), "company": self.name, "is_group": 0})
+
+			self.db_set("exchange_gain_loss_account", exchange_gain_loss_acct)
+
+		if not self.disposal_account:
+			disposal_acct = frappe.db.get_value("Account",
+				{"account_name": _("Gain/Loss on Asset Disposal"), "company": self.name, "is_group": 0})
+
+			self.db_set("disposal_account", disposal_acct)
+
 	def _set_default_account(self, fieldname, account_type):
 		if self.get(fieldname):
 			return
diff --git a/erpnext/setup/doctype/notification_control/README.md b/erpnext/setup/doctype/notification_control/README.md
deleted file mode 100644
index 3c411b7..0000000
--- a/erpnext/setup/doctype/notification_control/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Tool to automatically prompt sending of Email on Submission of various records.
\ No newline at end of file
diff --git a/erpnext/setup/doctype/notification_control/__init__.py b/erpnext/setup/doctype/notification_control/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/erpnext/setup/doctype/notification_control/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/erpnext/setup/doctype/notification_control/notification_control.js b/erpnext/setup/doctype/notification_control/notification_control.js
deleted file mode 100644
index 7f58ede..0000000
--- a/erpnext/setup/doctype/notification_control/notification_control.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
-// License: GNU General Public License v3. See license.txt
-
-frappe.ui.form.on("Notification Control", {
-	refresh: function(frm) {
-		frm.page.set_primary_action(__('Update'), function() { frm.events.set_message(frm); });
-	},
-	select_transaction: function(frm) {
-		frm.set_value("custom_message", frm.doc[frm.events.get_fieldname(frm)]);
-	},
-	set_message: function(frm) {
-		if(frm.doc.select_transaction && frm.doc.select_transaction !== "") {
-			frm.set_value(frm.events.get_fieldname(frm), frm.doc.custom_message);
-		}
-		frm.save();
-	},
-	get_fieldname: function(frm) {
-		return frm.doc.select_transaction.replace(" ", "_").toLowerCase() + "_message";
-	},
-	after_save: function(frm) {
-		// update notification settings in current session
-		frappe.boot.notification_settings = frm.doc;
-	}
-});
diff --git a/erpnext/setup/doctype/notification_control/notification_control.json b/erpnext/setup/doctype/notification_control/notification_control.json
deleted file mode 100644
index fc3316e..0000000
--- a/erpnext/setup/doctype/notification_control/notification_control.json
+++ /dev/null
@@ -1,566 +0,0 @@
-{
- "allow_copy": 1, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "beta": 0, 
- "creation": "2012-07-12 23:29:45", 
- "custom": 0, 
- "description": "Send automatic emails to Contacts on Submitting transactions.", 
- "docstatus": 0, 
- "doctype": "DocType", 
- "fields": [
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "When any of the checked transactions are \"Submitted\", an email pop-up automatically opened to send an email to the associated \"Contact\" in that transaction, with the transaction as an attachment. The user may or may not send the email.", 
-   "fieldname": "send_autonotification_for", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Prompt for Email on Submission of", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sales", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Sales", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "50%", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
-   "width": "50%"
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "quotation", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Quotation", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sales_order", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Sales Order", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "delivery_note", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Delivery Note", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sales_invoice", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Sales Invoice", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "purchase", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Purchase", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "print_width": "50%", 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0, 
-   "width": "50%"
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "purchase_order", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Purchase Order", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "purchase_receipt", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 1, 
-   "label": "Purchase Receipt", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "expense_claim", 
-   "fieldtype": "Check", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Expense Claim", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "description": "Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.", 
-   "fieldname": "customize_the_notification", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Customize the Notification", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "select_transaction", 
-   "fieldtype": "Select", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Select Transaction", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "\nQuotation\nSales Order\nDelivery Note\nSales Invoice\nPurchase Order\nPurchase Receipt\nExpense Claim\nExpense Claim Approved\nExpense Claim Rejected", 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "custom_message", 
-   "fieldtype": "Text Editor", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Custom Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 0, 
-   "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": "quotation_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Quotation Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sales_order_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Sales Order Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "delivery_note_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Delivery Note Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "sales_invoice_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Sales Invoice Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "purchase_order_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Purchase Order Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "purchase_receipt_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Purchase Receipt Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "expense_claim_approved_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Expense Claim Approved Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "expense_claim_rejected_message", 
-   "fieldtype": "Text", 
-   "hidden": 1, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Expense Claim Rejected Message", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "print_hide": 1, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }
- ], 
- "hide_heading": 0, 
- "hide_toolbar": 0, 
- "icon": "fa fa-envelope", 
- "idx": 1, 
- "in_create": 0, 
- "in_dialog": 0, 
- "is_submittable": 0, 
- "issingle": 1, 
- "istable": 0, 
- "max_attachments": 0, 
- "modified": "2016-06-01 13:06:06.981905", 
- "modified_by": "Administrator", 
- "module": "Setup", 
- "name": "Notification Control", 
- "owner": "Administrator", 
- "permissions": [
-  {
-   "amend": 0, 
-   "apply_user_permissions": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 0, 
-   "email": 0, 
-   "export": 0, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 0, 
-   "read": 1, 
-   "report": 0, 
-   "role": "System Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
-   "write": 1
-  }
- ], 
- "quick_entry": 1, 
- "read_only": 0, 
- "read_only_onload": 0, 
- "sort_order": "ASC", 
- "track_seen": 0
-}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/notification_control/notification_control.py b/erpnext/setup/doctype/notification_control/notification_control.py
deleted file mode 100644
index c50baca..0000000
--- a/erpnext/setup/doctype/notification_control/notification_control.py
+++ /dev/null
@@ -1,11 +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 NotificationControl(Document):
-	def validate(self):
-		frappe.clear_cache()
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index 8548f92..03da833 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -5,6 +5,7 @@
 
 import frappe
 from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS
+from .default_success_action import get_default_success_action
 from frappe import _
 from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
 from frappe.custom.doctype.custom_field.custom_field import create_custom_field
@@ -20,6 +21,7 @@
 	create_print_zero_amount_taxes_custom_field()
 	add_all_roles_to("Administrator")
 	create_default_cash_flow_mapper_templates()
+	create_default_success_action()
 	frappe.db.commit()
 
 
@@ -72,9 +74,13 @@
 
 
 def create_default_cash_flow_mapper_templates():
-	mappers = DEFAULT_MAPPERS
-
-	for mapper in mappers:
+	for mapper in DEFAULT_MAPPERS:
 		if not frappe.db.exists('Cash Flow Mapper', mapper['section_name']):
 			doc = frappe.get_doc(mapper)
 			doc.insert(ignore_permissions=True)
+
+def create_default_success_action():
+	for success_action in get_default_success_action():
+		if not frappe.db.exists('Success Action', success_action.get("ref_doctype")):
+			doc = frappe.get_doc(success_action)
+			doc.insert(ignore_permissions=True)
diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py
index 08b8a06..086b60e 100644
--- a/erpnext/setup/setup_wizard/operations/defaults_setup.py
+++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py
@@ -36,6 +36,7 @@
 	stock_settings.auto_indent = 1
 	stock_settings.auto_insert_price_list_rate_if_missing = 1
 	stock_settings.automatically_set_serial_nos_based_on_fifo = 1
+	stock_settings.set_qty_in_transactions_based_on_serial_no_input = 1
 	stock_settings.save()
 
 	selling_settings = frappe.get_doc("Selling Settings")
@@ -53,12 +54,6 @@
 	buying_settings.allow_multiple_items = 1
 	buying_settings.save()
 
-	notification_control = frappe.get_doc("Notification Control")
-	notification_control.quotation = 1
-	notification_control.sales_invoice = 1
-	notification_control.purchase_order = 1
-	notification_control.save()
-
 	hr_settings = frappe.get_doc("HR Settings")
 	hr_settings.emp_created_by = "Naming Series"
 	hr_settings.leave_approval_notification_template = "Leave Approval Notification"
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index f22c70c..8c43306 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -25,9 +25,6 @@
 		bootinfo.sysdefaults.quotation_valid_till = cint(frappe.db.get_single_value('Selling Settings',
 			'default_valid_till'))
 
-		bootinfo.notification_settings = frappe.get_doc("Notification Control",
-			"Notification Control")
-
 		# if no company, show a dialog box to create a new company
 		bootinfo.customer_count = frappe.db.sql("""select count(*) from tabCustomer""")[0][0]
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index e6029aa..ba0268e 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -66,11 +66,6 @@
 	},
 	print_without_amount: function(frm) {
 		erpnext.stock.delivery_note.set_print_hide(frm.doc);
-	},
-	on_submit: function(frm) {
-		if(cint(frappe.boot.notification_settings.delivery_note)) {
-			frm.email_doc(frappe.boot.notification_settings.delivery_note_message);
-		}
 	}
 });
 
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
index 2e150f7..cf28a52 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
@@ -6,7 +6,7 @@
 		'non_standard_fieldnames': {
 			'Stock Entry': 'delivery_note_no',
 			'Quality Inspection': 'reference_name',
-			'Subscription': 'reference_document',
+			'Auto Repeat': 'reference_document',
 		},
 		'internal_links': {
 			'Sales Order': ['items', 'against_sales_order'],
@@ -26,7 +26,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.js b/erpnext/stock/doctype/delivery_trip/delivery_trip.js
index f7ec7e3..3e7dfc9 100644
--- a/erpnext/stock/doctype/delivery_trip/delivery_trip.js
+++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.js
@@ -3,6 +3,14 @@
 
 frappe.ui.form.on('Delivery Trip', {
 	setup: function(frm) {
+		frm.set_query("driver", function() {
+			return {
+				filters: {
+					"status": "Active"
+				}
+			};
+		});
+
 		frm.set_query("address", "delivery_stops", function(doc, cdt, cdn) {
 			var row = locals[cdt][cdn];
 			if (row.customer) {
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 8804043..31cb828 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -527,8 +527,8 @@
 
 	def update_item_price(self):
 		frappe.db.sql("""update `tabItem Price` set item_name=%s,
-			item_description=%s, modified=NOW() where item_code=%s""",
-                    (self.item_name, self.description, self.name))
+			item_description=%s, brand=%s, modified=NOW() where item_code=%s""",
+                    (self.item_name, self.description, self.brand, self.name))
 
 	def on_trash(self):
 		super(Item, self).on_trash()
@@ -631,19 +631,20 @@
 
 	def update_template_item(self):
 		"""Set Show in Website for Template Item if True for its Variant"""
-		if self.variant_of and self.show_in_website:
-			self.show_variant_in_website = 1
-			self.show_in_website = 0
+		if self.variant_of:
+			if self.show_in_website:
+				self.show_variant_in_website = 1
+				self.show_in_website = 0
 
-		if self.show_variant_in_website:
-			# show template
-			template_item = frappe.get_doc("Item", self.variant_of)
+			if self.show_variant_in_website:
+				# show template
+				template_item = frappe.get_doc("Item", self.variant_of)
 
-			if not template_item.show_in_website:
-				template_item.show_in_website = 1
-				template_item.flags.dont_update_variants = True
-				template_item.flags.ignore_permissions = True
-				template_item.save()
+				if not template_item.show_in_website:
+					template_item.show_in_website = 1
+					template_item.flags.dont_update_variants = True
+					template_item.flags.ignore_permissions = True
+					template_item.save()
 
 	def update_variants(self):
 		if self.flags.dont_update_variants or \
@@ -667,10 +668,10 @@
 
 	def validate_stock_exists_for_template_item(self):
 		if self.stock_ledger_created() and self._doc_before_save:
-			if (self._doc_before_save.has_variants != self.has_variants
-                                or self._doc_before_save.variant_of != self.variant_of):
-				frappe.throw(_("Cannot change Variant properties after stock transction. You will have to make a new Item to do this.").format(self.name),
-                                    StockExistsForTemplate)
+			if (cint(self._doc_before_save.has_variants) != cint(self.has_variants)
+				or self._doc_before_save.variant_of != self.variant_of):
+				frappe.throw(_("Cannot change Variant properties after stock transaction. You will have to make a new Item to do this.").format(self.name),
+					StockExistsForTemplate)
 
 			if self.has_variants or self.variant_of:
 				if not self.is_child_table_same('attributes'):
diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json
index fdc2df2..9f05937 100644
--- a/erpnext/stock/doctype/item_price/item_price.json
+++ b/erpnext/stock/doctype/item_price/item_price.json
@@ -42,6 +42,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -72,6 +73,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -101,6 +103,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -130,6 +133,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -159,6 +163,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -189,6 +194,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -219,6 +225,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -251,6 +258,7 @@
    "reqd": 1, 
    "search_index": 1, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -283,6 +291,7 @@
    "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -311,6 +320,39 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "brand", 
+   "fieldtype": "Read Only", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 1, 
+   "in_standard_filter": 0, 
+   "label": "Brand", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "item_code.brand", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 1, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -340,6 +382,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }, 
   {
@@ -369,6 +412,7 @@
    "reqd": 0, 
    "search_index": 0, 
    "set_only_once": 0, 
+   "translatable": 0, 
    "unique": 0
   }
  ], 
@@ -383,7 +427,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-12-01 13:03:53.397382", 
+ "modified": "2018-05-03 12:50:14.207842", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Price", 
@@ -391,7 +435,6 @@
  "permissions": [
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
    "delete": 1, 
@@ -411,7 +454,6 @@
   }, 
   {
    "amend": 0, 
-   "apply_user_permissions": 0, 
    "cancel": 0, 
    "create": 1, 
    "delete": 1, 
diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
index c3fe8f3..6cfb8af 100644
--- a/erpnext/stock/doctype/material_request/material_request_dashboard.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -7,7 +7,7 @@
 		'transactions': [
 			{
 				'label': _('Related'),
-				'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order']
+				'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order', "Stock Entry"]
 			},
 			{
 				'label': _('Manufacturing'),
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 791b253..034ea1e 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -213,11 +213,6 @@
 	}
 }
 
-cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
-	if(cint(frappe.boot.notification_settings.purchase_receipt))
-		cur_frm.email_doc(frappe.boot.notification_settings.purchase_receipt_message);
-}
-
 frappe.provide("erpnext.buying");
 
 frappe.ui.form.on("Purchase Receipt", "is_subcontracted", function(frm) {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
index 9ade1af..e83a89e 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
@@ -6,7 +6,7 @@
 		'non_standard_fieldnames': {
 			'Purchase Invoice': 'purchase_receipt',
 			'Landed Cost Voucher': 'receipt_document',
-			'Subscription': 'reference_document'
+			'Auto Repeat': 'reference_document'
 		},
 		'internal_links': {
 			'Purchase Order': ['items', 'purchase_order'],
@@ -28,7 +28,7 @@
 			},
 			{
 				'label': _('Subscription'),
-				'items': ['Subscription']
+				'items': ['Auto Repeat']
 			},
 		]
 	}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index a6d2a0b..020a8bc 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -200,7 +200,7 @@
 				frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
 
 			if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
-				frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(sle.actual_qty, sle.item_code, len(serial_nos)),
+				frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(abs(sle.actual_qty), sle.item_code, len(serial_nos)),
 					SerialNoQtyError)
 
 			if len(serial_nos) != len(set(serial_nos)):
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json
index 48f89ec..4d5423e 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.json
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.json
@@ -470,6 +470,37 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "1", 
+   "fieldname": "set_qty_in_transactions_based_on_serial_no_input", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Set Qty in Transactions based on Serial No Input", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "auto_material_request", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -773,7 +804,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-01-12 09:38:58.200950", 
+ "modified": "2018-05-03 12:38:12.905394", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Stock Settings", 
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index 23a18f4..97d24c6 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -11,8 +11,9 @@
 
 class StockSettings(Document):
 	def validate(self):
-		for key in ["item_naming_by", "item_group", "stock_uom", "allow_negative_stock", "default_warehouse"]:
-			frappe.db.set_default(key, self.get(key, ""))
+		for key in ["item_naming_by", "item_group", "stock_uom",
+			"allow_negative_stock", "default_warehouse", "set_qty_in_transactions_based_on_serial_no_input"]:
+				frappe.db.set_default(key, self.get(key, ""))
 
 		from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series
 		set_by_naming_series("Item", "item_code",
diff --git a/erpnext/stock/report/item_price_stock/item_price_stock.py b/erpnext/stock/report/item_price_stock/item_price_stock.py
index ed010cd..30fcad8 100644
--- a/erpnext/stock/report/item_price_stock/item_price_stock.py
+++ b/erpnext/stock/report/item_price_stock/item_price_stock.py
@@ -20,6 +20,12 @@
 			"width": 120
 		},
 		{
+			"label": _("Brand"),
+			"fieldname": "brand",
+			"fieldtype": "Data",
+			"width": 100
+		},
+		{
 			"label": _("Warehouse"),
 			"fieldname": "warehouse",
 			"fieldtype": "Link",
@@ -71,7 +77,7 @@
 		conditions += "where a.item_code=%(item_code)s"
 
 	item_results = frappe.db.sql("""select a.item_code as item_name, a.name as price_list_name,
-		b.warehouse as warehouse, b.actual_qty as actual_qty
+		a.brand as brand, b.warehouse as warehouse, b.actual_qty as actual_qty
 		from `tabItem Price` a left join `tabBin` b
 		ON a.item_code = b.item_code
 		{conditions}"""
@@ -87,6 +93,7 @@
 		for item_dict in item_results:
 			data = {
 				'item_name': item_dict.item_name,
+				'brand': item_dict.brand,
 				'warehouse': item_dict.warehouse,
 				'stock_available': item_dict.actual_qty or 0,
 				'buying_price_list': "",
diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py
index ca01d19..0375d8f 100644
--- a/erpnext/stock/report/item_prices/item_prices.py
+++ b/erpnext/stock/report/item_prices/item_prices.py
@@ -21,7 +21,7 @@
 	data = []
 	for item in sorted(item_map):
 		data.append([item, item_map[item]["item_name"],item_map[item]["item_group"],
-			item_map[item]["description"], item_map[item]["stock_uom"],
+			item_map[item]["brand"], item_map[item]["description"], item_map[item]["stock_uom"],
 			flt(last_purchase_rate.get(item, 0), precision),
 			flt(val_rate_map.get(item, 0), precision),
 			pl.get(item, {}).get("Selling"),
@@ -34,7 +34,8 @@
 def get_columns(filters):
 	"""return columns based on filters"""
 
-	columns = [_("Item") + ":Link/Item:100", _("Item Name") + "::150",_("Item Group") + ":Link/Item Group:125", _("Description") + "::150", _("UOM") + ":Link/UOM:80",
+	columns = [_("Item") + ":Link/Item:100", _("Item Name") + "::150",_("Item Group") + ":Link/Item Group:125",
+		_("Brand") + "::100", _("Description") + "::150", _("UOM") + ":Link/UOM:80",
 		_("Last Purchase Rate") + ":Currency:90", _("Valuation Rate") + ":Currency:80",	_("Sales Price List") + "::180",
 		_("Purchase Price List") + "::180", _("BOM Rate") + ":Currency:90"]
 
@@ -45,9 +46,9 @@
 
 	item_map = {}
 
-	for i in frappe.db.sql("select name, item_group, item_name, description, \
-		stock_uom from tabItem \
-		order by item_code, item_group", as_dict=1):
+	for i in frappe.db.sql("""select name, item_group, item_name, description,
+		brand, stock_uom from tabItem
+		order by item_code, item_group""", as_dict=1):
 			item_map.setdefault(i.name, i)
 
 	return item_map
diff --git a/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json b/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json
index 137d603..3b901dc 100644
--- a/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json
+++ b/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json
@@ -1,14 +1,13 @@
 {
  "add_total_row": 0, 
- "apply_user_permissions": 1, 
  "creation": "2013-09-25 10:21:15", 
  "disabled": 0, 
  "docstatus": 0, 
  "doctype": "Report", 
  "idx": 3, 
  "is_standard": "Yes", 
- "json": "{\"add_total_row\": 0, \"sort_by\": \"Item Price.modified\", \"sort_order\": \"desc\", \"sort_by_next\": null, \"filters\": [], \"sort_order_next\": \"desc\", \"columns\": [[\"name\", \"Item Price\"], [\"price_list\", \"Item Price\"], [\"item_code\", \"Item Price\"], [\"item_name\", \"Item Price\"], [\"item_description\", \"Item Price\"], [\"price_list_rate\", \"Item Price\"], [\"buying\", \"Item Price\"], [\"selling\", \"Item Price\"], [\"currency\", \"Item Price\"]]}", 
- "modified": "2017-02-24 20:02:09.364303", 
+ "json": "{\"fields\": [[\"name\", \"Item Price\"], [\"price_list\", \"Item Price\"], [\"currency\", \"Item Price\"], [\"item_code\", \"Item Price\"], [\"brand\", \"Item Price\"], [\"price_list_rate\", \"Item Price\"], [\"docstatus\", \"Item Price\"]], \"order_by\": \"`tabItem Price`.`modified` asc\", \"add_total_row\": 0, \"filters\": []}", 
+ "modified": "2018-05-03 12:48:39.802088", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item-wise Price List Rate", 
diff --git a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
index c5fb518..d73f83d 100644
--- a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
+++ b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
@@ -39,7 +39,7 @@
 		item_value.setdefault((item, item_map[item]["item_group"]),[])
 		item_value[(item, item_map[item]["item_group"])].append(total_stock_value)
 
-	
+
 	# sum bal_qty by item
 	for (item, item_group), wh_balance in item_balance.items():
 		total_stock_value = sum(item_value[(item, item_group)])
@@ -87,7 +87,9 @@
 def get_warehouse_list(filters):
 	from frappe.defaults import get_user_permissions
 	condition = ''
-	user_permitted_warehouse = filter(None, get_user_permissions().get("Warehouse", []))
+	user_permitted_warehouse = filter(None, get_user_permissions()
+		.get("Warehouse", {})
+		.get("docs", []))
 	value = ()
 	if user_permitted_warehouse:
 		condition = "and name in %s"
@@ -96,7 +98,7 @@
 		condition = "and name = %s"
 		value = filters.get("warehouse")
 
-	return frappe.db.sql("""select name  
+	return frappe.db.sql("""select name
 		from `tabWarehouse` where is_group = 0
 		{condition}""".format(condition=condition), value, as_dict=1)
 
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 0c2b6c5..d3769a2 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -13,12 +13,6 @@
 class UOMMustBeIntegerError(frappe.ValidationError): pass
 
 class TransactionBase(StatusUpdater):
-	def load_notification_message(self):
-		dt = self.doctype.lower().replace(" ", "_")
-		if int(frappe.db.get_value("Notification Control", None, dt) or 0):
-			self.set("__notification_message",
-				frappe.db.get_value("Notification Control", None, dt + "_message"))
-
 	def validate_posting_time(self):
 		# set Edit Posting Date and Time to 1 while data import
 		if frappe.flags.in_import and self.posting_date: