Merge pull request #22001 from nextchamp-saqib/price-rule-date-field-fix

fix: transaction date not found in sales invoice
diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py
index b57e678..4480110 100644
--- a/erpnext/accounts/deferred_revenue.py
+++ b/erpnext/accounts/deferred_revenue.py
@@ -199,10 +199,13 @@
 		if item.get(enable_check):
 			_book_deferred_revenue_or_expense(item)
 
-def process_deferred_accounting(posting_date=today()):
+def process_deferred_accounting(posting_date=None):
 	''' Converts deferred income/expense into income/expense
 		Executed via background jobs on every month end '''
 
+	if not posting_date:
+		posting_date = today()
+
 	if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')):
 		return
 
diff --git a/erpnext/accounts/desk_page/accounting/accounting.json b/erpnext/accounts/desk_page/accounting/accounting.json
index 576d10c..42fb9f4 100644
--- a/erpnext/accounts/desk_page/accounting/accounting.json
+++ b/erpnext/accounts/desk_page/accounting/accounting.json
@@ -18,7 +18,7 @@
   {
    "hidden": 0,
    "label": "Accounts Payable",
-   "links": "[\n    {\n        \"description\": \"Bills raised by Suppliers.\",\n        \"label\": \"Purchase Invoice\",\n        \"name\": \"Purchase Invoice\",\n        \"onboard\": 1,\n        \"type\": \"doctype\"\n    },\n    {\n        \"description\": \"Supplier database.\",\n        \"label\": \"Supplier\",\n        \"name\": \"Supplier\",\n        \"onboard\": 1,\n        \"type\": \"doctype\"\n    },\n    {\n        \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n        \"label\": \"Payment Entry\",\n        \"name\": \"Payment Entry\",\n        \"type\": \"doctype\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Accounts Payable\",\n        \"name\": \"Accounts Payable\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Accounts Payable Summary\",\n        \"name\": \"Accounts Payable Summary\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Register\",\n        \"name\": \"Purchase Register\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Item-wise Purchase Register\",\n        \"name\": \"Item-wise Purchase Register\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Order Items To Be Billed\",\n        \"name\": \"Purchase Order Items To Be Billed\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Received Items To Be Billed\",\n        \"name\": \"Received Items To Be Billed\",\n        \"type\": \"report\"\n    }\n]"
+   "links": "[\n    {\n        \"description\": \"Bills raised by Suppliers.\",\n        \"label\": \"Purchase Invoice\",\n        \"name\": \"Purchase Invoice\",\n        \"onboard\": 1,\n        \"type\": \"doctype\"\n    },\n    {\n        \"description\": \"Supplier database.\",\n        \"label\": \"Supplier\",\n        \"name\": \"Supplier\",\n        \"onboard\": 1,\n        \"type\": \"doctype\"\n    },\n    {\n        \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n        \"label\": \"Payment Entry\",\n        \"name\": \"Payment Entry\",\n        \"type\": \"doctype\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Accounts Payable\",\n        \"name\": \"Accounts Payable\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Accounts Payable Summary\",\n        \"name\": \"Accounts Payable Summary\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Register\",\n        \"name\": \"Purchase Register\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Item-wise Purchase Register\",\n        \"name\": \"Item-wise Purchase Register\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Order\"\n        ],\n        \"doctype\": \"Purchase Order\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Order Analysis\",\n        \"name\": \"Purchase Order Analysis\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Invoice\"\n        ],\n        \"doctype\": \"Purchase Invoice\",\n        \"is_query_report\": true,\n        \"label\": \"Received Items To Be Billed\",\n        \"name\": \"Received Items To Be Billed\",\n        \"type\": \"report\"\n    }\n]"
   },
   {
    "hidden": 0,
@@ -94,10 +94,11 @@
  "docstatus": 0,
  "doctype": "Desk Page",
  "extends_another_page": 0,
+ "hide_custom": 0,
  "idx": 0,
  "is_standard": 1,
  "label": "Accounting",
- "modified": "2020-05-18 17:27:26.882340",
+ "modified": "2020-05-27 20:34:50.949772",
  "modified_by": "Administrator",
  "module": "Accounts",
  "name": "Accounting",
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
index 4d8da37..699eb08 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.js
@@ -11,21 +11,9 @@
 			};
 		});
 
-		frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) {
-			return {
-				filters: {
-					'company': doc.company
-				}
-			};
-		});
-
-		frm.set_query('cost_center', function(doc) {
-			return {
-				filters: {
-					'company': doc.company
-				}
-			};
-		});
+		if (frm.doc.company) {
+			frm.trigger('setup_company_filters');
+		}
 	},
 
 	refresh: function(frm) {
@@ -51,19 +39,50 @@
 		});
 	},
 
-	company: function(frm) {
-		frappe.call({
-			method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account',
-			args: {
-				company: frm.doc.company
-			},
-			callback: (r) => {
-				if (r.message) {
-					frm.doc.__onload.temporary_opening_account = r.message;
-					frm.trigger('update_invoice_table');
+	setup_company_filters: function(frm) {
+		frm.set_query('cost_center', 'invoices', function(doc, cdt, cdn) {
+			return {
+				filters: {
+					'company': doc.company
+				}
+			};
+		});
+
+		frm.set_query('cost_center', function(doc) {
+			return {
+				filters: {
+					'company': doc.company
+				}
+			};
+		});
+
+		frm.set_query('temporary_opening_account', 'invoices', function(doc, cdt, cdn) {
+			return {
+				filters: {
+					'company': doc.company
 				}
 			}
-		})
+		});
+	},
+
+	company: function(frm) {
+		if (frm.doc.company) {
+
+			frm.trigger('setup_company_filters');
+
+			frappe.call({
+				method: 'erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool.get_temporary_opening_account',
+				args: {
+					company: frm.doc.company
+				},
+				callback: (r) => {
+					if (r.message) {
+						frm.doc.__onload.temporary_opening_account = r.message;
+						frm.trigger('update_invoice_table');
+					}
+				}
+			})
+		}
 	},
 
 	invoice_type: function(frm) {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 05b85da..57dc179 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -1519,14 +1519,22 @@
 	def update_details(source_doc, target_doc, source_parent):
 		target_doc.inter_company_invoice_reference = source_doc.name
 		if target_doc.doctype in ["Purchase Invoice", "Purchase Order"]:
+			currency = frappe.db.get_value('Supplier', details.get('party'), 'default_currency')
 			target_doc.company = details.get("company")
 			target_doc.supplier = details.get("party")
 			target_doc.buying_price_list = source_doc.selling_price_list
+
+			if currency:
+				target_doc.currency = currency
 		else:
+			currency = frappe.db.get_value('Customer', details.get('party'), 'default_currency')
 			target_doc.company = details.get("company")
 			target_doc.customer = details.get("party")
 			target_doc.selling_price_list = source_doc.buying_price_list
 
+			if currency:
+				target_doc.currency = currency
+
 	doclist = get_mapped_doc(doctype, source_name,	{
 		doctype: {
 			"doctype": target_doctype,
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 4d43919..83d7967 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -180,7 +180,7 @@
 	if company:
 		condition += "and company =%s" % (company)
 	if from_date and to_date:
-		condition += "and posting_date between %s and %s" % (company, from_date, to_date)
+		condition += "and posting_date between %s and %s" % (from_date, to_date)
 
 	## Appending the same supplier again if length of suppliers list is 1
 	## since tuple of single element list contains None, For example ('Test Supplier 1', )
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 528fb4e..db91b66 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -602,10 +602,14 @@
 	else:
 		return ''
 
-def get_partywise_advanced_payment_amount(party_type, posting_date = None, company=None):
+def get_partywise_advanced_payment_amount(party_type, posting_date = None, future_payment=0, company=None):
 	cond = "1=1"
 	if posting_date:
-		cond = "posting_date <= '{0}'".format(posting_date)
+		if future_payment:
+			cond = "posting_date <= '{0}' OR DATE(creation) <= '{0}' """.format(posting_date)
+		else:
+			cond = "posting_date <= '{0}'".format(posting_date)
+
 	if company:
 		cond += "and company = '{0}'".format(company)
 
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js
index 4e09f99..2aa9618 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.js
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js
@@ -135,12 +135,5 @@
 	}
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Accounts Payable"].filters.splice(9, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('Accounts Payable', 9);
 
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
index d5f18b0..9c6b063 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.js
@@ -104,12 +104,5 @@
 	}
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Accounts Payable Summary"].filters.splice(9, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('Accounts Payable Summary', 9);
 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
index 6208eb6..8dc558a 100644
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.js
@@ -199,12 +199,5 @@
 	}
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Accounts Receivable"].filters.splice(9, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('Accounts Receivable', 9);
 
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index a0a1b97..d40e58b 100755
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -534,7 +534,7 @@
 
 	def get_ageing_data(self, entry_date, row):
 		# [0-30, 30-60, 60-90, 90-120, 120-above]
-		row.range1 = row.range2 = row.range3 = row.range4 = range5 = 0.0
+		row.range1 = row.range2 = row.range3 = row.range4 = row.range5 = 0.0
 
 		if not (self.age_as_on and entry_date):
 			return
@@ -559,6 +559,14 @@
 		conditions, values = self.prepare_conditions()
 		order_by = self.get_order_by_condition()
 
+		if self.filters.show_future_payments:
+			values.insert(2, self.filters.report_date)
+
+			date_condition = """AND (posting_date <= %s
+				OR (against_voucher IS NULL AND DATE(creation) <= %s))"""
+		else:
+			date_condition = "AND posting_date <=%s"
+
 		if self.filters.get(scrub(self.party_type)):
 			select_fields = "debit_in_account_currency as debit, credit_in_account_currency as credit"
 		else:
@@ -574,9 +582,8 @@
 				docstatus < 2
 				and party_type=%s
 				and (party is not null and party != '')
-				and posting_date <= %s
-				{1} {2}"""
-			.format(select_fields, conditions, order_by), values, as_dict=True)
+				{1} {2} {3}"""
+			.format(select_fields, date_condition, conditions, order_by), values, as_dict=True)
 
 	def get_sales_invoices_or_customers_based_on_sales_person(self):
 		if self.filters.get("sales_person"):
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
index b316f10..305cddb 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.js
@@ -111,7 +111,12 @@
 			"fieldname":"based_on_payment_terms",
 			"label": __("Based On Payment Terms"),
 			"fieldtype": "Check",
-		}
+		},
+		{
+			"fieldname":"show_future_payments",
+			"label": __("Show Future Payments"),
+			"fieldtype": "Check",
+		},
 	],
 
 	onload: function(report) {
@@ -122,11 +127,4 @@
 	}
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Accounts Receivable Summary"].filters.splice(9, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('Accounts Receivable Summary', 9);
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index aa6b42e..657b3e8 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -33,7 +33,7 @@
 		self.get_party_total(args)
 
 		party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
-			self.filters.report_date, self.filters.company) or {}
+			self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {}
 
 		for party, party_dict in iteritems(self.party_total):
 			if party_dict.outstanding == 0:
diff --git a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
index d7efbad..80bccaf 100644
--- a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
+++ b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
@@ -111,7 +111,7 @@
 								   0
 							  end), 0) as depreciation_amount_during_the_period
 			from `tabAsset` a, `tabDepreciation Schedule` ds
-			where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent
+			where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != ''
 			group by a.asset_category
 			union
 			SELECT a.asset_category,
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.js b/erpnext/accounts/report/balance_sheet/balance_sheet.js
index c4c24c0..4a4ad4d 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.js
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.js
@@ -4,6 +4,8 @@
 frappe.require("assets/erpnext/js/financial_statements.js", function() {
 	frappe.query_reports["Balance Sheet"] = $.extend({}, erpnext.financial_statements);
 
+	erpnext.utils.add_dimensions('Balance Sheet', 10);
+
 	frappe.query_reports["Balance Sheet"]["filters"].push({
 		"fieldname": "accumulated_values",
 		"label": __("Accumulated Values"),
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.js b/erpnext/accounts/report/cash_flow/cash_flow.js
index e5d0c89..a984bf4 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.js
+++ b/erpnext/accounts/report/cash_flow/cash_flow.js
@@ -5,6 +5,8 @@
 	frappe.query_reports["Cash Flow"] = $.extend({},
 		erpnext.financial_statements);
 
+	erpnext.utils.add_dimensions('Cash Flow', 10);
+
 	// The last item in the array is the definition for Presentation Currency
 	// filter. It won't be used in cash flow for now so we pop it. Please take
 	// of this if you are working here.
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js
index 2aecd6b..1fc0f79 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.js
+++ b/erpnext/accounts/report/general_ledger/general_ledger.js
@@ -164,12 +164,5 @@
 	]
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["General Ledger"].filters.splice(15, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('General Ledger', 15)
 
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
index f88906a..b709ab9 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -4,11 +4,18 @@
 frappe.query_reports["Item-wise Purchase Register"] = {
 	"filters": [
 		{
-			"fieldname":"date_range",
-			"label": __("Date Range"),
-			"fieldtype": "DateRange",
-			"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
-			"reqd": 1
+			"fieldname":"from_date",
+			"label": __("From Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
+			"reqd": 1,
+		},
+		{
+			"fieldname":"to_date",
+			"label": __("To Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today(),
+			"reqd": 1,
 		},
 		{
 			"fieldname": "item_code",
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 1f78c7a..9777ed1 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -14,7 +14,6 @@
 
 def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
 	if not filters: filters = {}
-	filters.update({"from_date": filters.get("date_range")[0], "to_date": filters.get("date_range")[1]})
 	columns = get_columns(additional_table_columns, filters)
 
 	company_currency = erpnext.get_company_currency(filters.company)
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
index 8a9c76f..39fb3ca 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -4,11 +4,18 @@
 frappe.query_reports["Item-wise Sales Register"] = {
 	"filters": [
 		{
-			"fieldname": "date_range",
-			"label": __("Date Range"),
-			"fieldtype": "DateRange",
-			"default": [frappe.datetime.add_months(frappe.datetime.get_today(),-1), frappe.datetime.get_today()],
-			"reqd": 1
+			"fieldname":"from_date",
+			"label": __("From Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
+			"reqd": 1,
+		},
+		{
+			"fieldname":"to_date",
+			"label": __("To Date"),
+			"fieldtype": "Date",
+			"default": frappe.datetime.get_today(),
+			"reqd": 1,
 		},
 		{
 			"fieldname": "customer",
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 92a22e6..bb78ee2 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -14,7 +14,6 @@
 
 def _execute(filters=None, additional_table_columns=None, additional_query_columns=None):
 	if not filters: filters = {}
-	filters.update({"from_date": filters.get("date_range") and filters.get("date_range")[0], "to_date": filters.get("date_range") and filters.get("date_range")[1]})
 	columns = get_columns(additional_table_columns, filters)
 
 	company_currency = frappe.get_cached_value('Company',  filters.get("company"),  "default_currency")
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
index 2b946c0..1c461ef 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.js
@@ -6,6 +6,8 @@
 	frappe.query_reports["Profit and Loss Statement"] = $.extend({},
 		erpnext.financial_statements);
 
+	erpnext.utils.add_dimensions('Profit and Loss Statement', 10);
+
 	frappe.query_reports["Profit and Loss Statement"]["filters"].push(
 		{
 			"fieldname": "project",
diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/__init__.py b/erpnext/accounts/report/purchase_order_items_to_be_billed/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/__init__.py
+++ /dev/null
diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js
deleted file mode 100644
index 24c9592..0000000
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-
-frappe.query_reports["Purchase Order Items To Be Billed"] = {
-	"filters": [
-
-	]
-}
diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json
deleted file mode 100644
index 3645ec0..0000000
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "add_total_row": 1, 
- "apply_user_permissions": 1, 
- "creation": "2013-05-28 15:54:16", 
- "disabled": 0, 
- "docstatus": 0, 
- "doctype": "Report", 
- "idx": 3, 
- "is_standard": "Yes", 
- "modified": "2017-02-24 20:00:24.302988", 
- "modified_by": "Administrator", 
- "module": "Accounts", 
- "name": "Purchase Order Items To Be Billed", 
- "owner": "Administrator", 
- "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Closed\"\n        and `tabPurchase Order Item`.amount > 0\n\tand (`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) < `tabPurchase Order Item`.base_amount\norder by `tabPurchase Order`.transaction_date asc", 
- "ref_doctype": "Purchase Invoice", 
- "report_name": "Purchase Order Items To Be Billed", 
- "report_type": "Script Report", 
- "roles": [
-  {
-   "role": "Accounts User"
-  }, 
-  {
-   "role": "Purchase User"
-  }, 
-  {
-   "role": "Auditor"
-  }, 
-  {
-   "role": "Accounts Manager"
-  }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py b/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py
deleted file mode 100644
index 99d0a36..0000000
--- a/erpnext/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
-# For license information, please see license.txt
-
-from __future__ import unicode_literals
-import frappe
-from frappe import _
-from erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data
-
-def execute(filters=None):
-	columns = get_column()
-	args = get_args()
-	data = get_ordered_to_be_billed_data(args)
-	return columns, data
-
-def get_column():
-	return [
-		_("Purchase Order") + ":Link/Purchase Order:120", _("Status") + "::120", _("Date") + ":Date:100",
-		_("Suplier") + ":Link/Supplier:120", _("Suplier Name") + "::120",
-		_("Project") + ":Link/Project:120", _("Item Code") + ":Link/Item:120",
-		_("Amount") + ":Currency:100", _("Billed Amount") + ":Currency:100", _("Amount to Bill") + ":Currency:100",
-		_("Item Name") + "::120", _("Description") + "::120", _("Company") + ":Link/Company:120",
-	]
-
-def get_args():
-	return {'doctype': 'Purchase Order', 'party': 'supplier',
-		'date': 'transaction_date', 'order': 'transaction_date', 'order_by': 'asc'}
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.js b/erpnext/accounts/report/purchase_register/purchase_register.js
index b2b95b2..f34ea57 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.js
+++ b/erpnext/accounts/report/purchase_register/purchase_register.js
@@ -56,11 +56,4 @@
 	]
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Purchase Register"].filters.splice(7, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
\ No newline at end of file
+erpnext.utils.add_dimensions('Purchase Register', 7);
\ No newline at end of file
diff --git a/erpnext/accounts/report/sales_register/sales_register.js b/erpnext/accounts/report/sales_register/sales_register.js
index 9dee656..85bbcea 100644
--- a/erpnext/accounts/report/sales_register/sales_register.js
+++ b/erpnext/accounts/report/sales_register/sales_register.js
@@ -68,12 +68,5 @@
 	]
 }
 
-erpnext.dimension_filters.forEach((dimension) => {
-	frappe.query_reports["Sales Register"].filters.splice(7, 0 ,{
-		"fieldname": dimension["fieldname"],
-		"label": __(dimension["label"]),
-		"fieldtype": "Link",
-		"options": dimension["document_type"]
-	});
-});
+erpnext.utils.add_dimensions('Sales Register', 7);
 
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index 07752e1..9c0854c 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -102,14 +102,7 @@
 		"initial_depth": 3
 	}
 
-	erpnext.dimension_filters.forEach((dimension) => {
-		frappe.query_reports["Trial Balance"].filters.splice(6, 0 ,{
-			"fieldname": dimension["fieldname"],
-			"label": __(dimension["label"]),
-			"fieldtype": "Link",
-			"options": dimension["document_type"]
-		});
-	});
+	erpnext.utils.add_dimensions('Trial Balance', 6);
 });
 
 
diff --git a/erpnext/buying/dashboard_fixtures.py b/erpnext/buying/dashboard_fixtures.py
index 0e2f78f..186bfb2 100644
--- a/erpnext/buying/dashboard_fixtures.py
+++ b/erpnext/buying/dashboard_fixtures.py
@@ -41,7 +41,7 @@
 			{ "chart": "Top Suppliers", "width": "Full"}
 		],
 		"cards": [
-			{ "card": "This Year Purchases"},
+			{ "card": "Annual Purchase"},
 			{ "card": "Purchase Orders to Receive"},
 			{ "card": "Purchase Orders to Bill"},
 			{ "card": "Active Suppliers"}
@@ -142,7 +142,7 @@
 def get_number_cards():
 	return [
 		{
-			"name": "This Year Purchases",
+			"name": "Annual Purchase",
 			"aggregate_function_based_on": "base_net_total",
 			"doctype": "Number Card",
 			"document_type": "Purchase Order",
@@ -155,7 +155,7 @@
 			]),
 			"function": "Sum",
 			"is_public": 1,
-			"label": _("This Year Purchases"),
+			"label": _("Annual Purchase"),
 			"owner": "Administrator",
 			"show_percentage_stats": 1,
 			"stats_time_interval": "Monthly"
diff --git a/erpnext/buying/desk_page/buying/buying.json b/erpnext/buying/desk_page/buying/buying.json
index ee18545..31b26d4 100644
--- a/erpnext/buying/desk_page/buying/buying.json
+++ b/erpnext/buying/desk_page/buying/buying.json
@@ -34,6 +34,11 @@
    "hidden": 0,
    "label": "Other Reports",
    "links": "[\n    {\n        \"is_query_report\": true,\n        \"label\": \"Items To Be Requested\",\n        \"name\": \"Items To Be Requested\",\n        \"onboard\": 1,\n        \"reference_doctype\": \"Item\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Item-wise Purchase History\",\n        \"name\": \"Item-wise Purchase History\",\n        \"onboard\": 1,\n        \"reference_doctype\": \"Item\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Subcontracted Raw Materials To Be Transferred\",\n        \"name\": \"Subcontracted Raw Materials To Be Transferred\",\n        \"reference_doctype\": \"Purchase Order\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Subcontracted Item To Be Received\",\n        \"name\": \"Subcontracted Item To Be Received\",\n        \"reference_doctype\": \"Purchase Order\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Quoted Item Comparison\",\n        \"name\": \"Quoted Item Comparison\",\n         \"onboard\": 1,\n        \"reference_doctype\": \"Supplier Quotation\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Material Requests for which Supplier Quotations are not created\",\n        \"name\": \"Material Requests for which Supplier Quotations are not created\",\n        \"reference_doctype\": \"Material Request\",\n        \"type\": \"report\"\n    },\n    {\n        \"is_query_report\": true,\n        \"label\": \"Supplier Addresses And Contacts\",\n        \"name\": \"Address And Contacts\",\n        \"reference_doctype\": \"Address\",\n        \"route_options\": {\n            \"party_type\": \"Supplier\"\n        },\n        \"type\": \"report\"\n    }\n]"
+  },
+  {
+   "hidden": 0,
+   "label": "Regional",
+   "links": "[\n     {\n        \"description\": \"Import Italian Purchase Invoices\",\n        \"label\": \"Import Supplier Invoice\",\n        \"name\": \"Import Supplier Invoice\",\n        \"type\": \"doctype\"\n    }    \n]"
   }
  ],
  "cards_label": "Masters & Reports ",
@@ -55,7 +60,7 @@
  "idx": 0,
  "is_standard": 1,
  "label": "Buying",
- "modified": "2020-05-19 19:44:36.260982",
+ "modified": "2020-05-27 22:23:38.529720",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Buying",
@@ -66,7 +71,7 @@
  "shortcuts": [
   {
    "color": "#cef6d1",
-   "format": "{} available",
+   "format": "{} Available",
    "label": "Item",
    "link_to": "Item",
    "stats_filter": "{\n    \"disabled\": 0\n}",
@@ -82,7 +87,7 @@
   },
   {
    "color": "#ffe8cd",
-   "format": "{}  to Receive",
+   "format": "{}  To Receive",
    "label": "Purchase Order",
    "link_to": "Purchase Order",
    "stats_filter": "{\n    \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n    \"status\":[\"in\", [\"To Receive\", \"To Receive and Bill\"]]\n}",
@@ -99,7 +104,7 @@
    "type": "Report"
   },
   {
-   "label": "Buying Dashboard",
+   "label": "Dashboard",
    "link_to": "Buying",
    "type": "Dashboard"
   }
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.js b/erpnext/buying/doctype/buying_settings/buying_settings.js
index a27950a..01b40cd 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.js
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.js
@@ -11,7 +11,7 @@
 	{
 		fieldname: "supp_master_name",
 		title: "Supplier Naming By",
-		description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series'>Naming Series</a>" + __(" choose the 'Naming Series' option."),
+		description: __("By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a set ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/setting-up/settings/naming-series' target='_blank'>Naming Series</a>" + __(" choose the 'Naming Series' option."),
 	},
 	{
 		fieldname: "buying_price_list",
diff --git a/erpnext/buying/module_onboarding/buying/buying.json b/erpnext/buying/module_onboarding/buying/buying.json
index 8c798b3..8fe2f38 100644
--- a/erpnext/buying/module_onboarding/buying/buying.json
+++ b/erpnext/buying/module_onboarding/buying/buying.json
@@ -19,7 +19,7 @@
  "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/buying",
  "idx": 0,
  "is_complete": 0,
- "modified": "2020-05-19 20:03:55.776080",
+ "modified": "2020-05-27 17:17:52.075947",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Buying",
@@ -49,6 +49,6 @@
  ],
  "subtitle": "Products, Purchases, Analysis and more.",
  "success_message": "The Buying Module is all set up!",
- "title": "Let's Setup the Buying Module.",
+ "title": "Let's Set Up the Buying Module.",
  "user_can_dismiss": 1
 }
\ No newline at end of file
diff --git a/erpnext/buying/report/requested_items_to_be_ordered/__init__.py b/erpnext/buying/report/requested_items_to_be_ordered/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/buying/report/requested_items_to_be_ordered/__init__.py
+++ /dev/null
diff --git a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json b/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json
deleted file mode 100644
index bb11269..0000000
--- a/erpnext/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-    "add_total_row": 1,
-    "creation": "2013-05-13 16:10:02",
-    "disable_prepared_report": 0,
-    "disabled": 0,
-    "docstatus": 0,
-    "doctype": "Report",
-    "idx": 3,
-    "is_standard": "Yes",
-    "modified": "2019-04-18 19:02:03.099422",
-    "modified_by": "Administrator",
-    "module": "Buying",
-    "name": "Requested Items To Be Ordered",
-    "owner": "Administrator",
-    "prepared_report": 0,
-    "query": "select \n    mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.stock_qty, 0)) as \"Qty:Float:100\",\n\tifnull(mr_item.stock_uom, '') as \"UOM:Link/UOM:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.stock_qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.stock_qty, 0))\norder by mr.transaction_date asc",
-    "ref_doctype": "Purchase Order",
-    "report_name": "Requested Items To Be Ordered",
-    "report_type": "Query Report",
-    "roles": [
-     {
-      "role": "Stock User"
-     },
-     {
-      "role": "Purchase Manager"
-     },
-     {
-      "role": "Purchase User"
-     }
-    ]
-   }
\ No newline at end of file
diff --git a/erpnext/buying/report/requested_items_to_order/requested_items_to_order.js b/erpnext/buying/report/requested_items_to_order/requested_items_to_order.js
index 21adb13..9555e82 100644
--- a/erpnext/buying/report/requested_items_to_order/requested_items_to_order.js
+++ b/erpnext/buying/report/requested_items_to_order/requested_items_to_order.js
@@ -35,7 +35,7 @@
 			"fieldtype": "Link",
 			"width": "80",
 			"options": "Material Request",
-			"get_query": () =>{
+			"get_query": () => {
 				return {
 					filters: {
 						"docstatus": 1,
@@ -46,6 +46,18 @@
 			}
 		},
 		{
+			"fieldname": "item_code",
+			"label": __("Item"),
+			"fieldtype": "Link",
+			"width": "80",
+			"options": "Item",
+			"get_query": () => {
+				return {
+					query: "erpnext.controllers.queries.item_query"
+				}
+			}
+		},
+		{
 			"fieldname": "group_by_mr",
 			"label": __("Group by Material Request"),
 			"fieldtype": "Check",
diff --git a/erpnext/buying/report/requested_items_to_order/requested_items_to_order.py b/erpnext/buying/report/requested_items_to_order/requested_items_to_order.py
index a021d3c..cca01b1 100644
--- a/erpnext/buying/report/requested_items_to_order/requested_items_to_order.py
+++ b/erpnext/buying/report/requested_items_to_order/requested_items_to_order.py
@@ -44,6 +44,9 @@
 	if filters.get("material_request"):
 		conditions += " and mr.name = '{0}'".format(filters.get("material_request"))
 
+	if filters.get("item_code"):
+		conditions += " and mr_item.item_code = '{0}'".format(filters.get("item_code"))
+
 	return conditions
 
 def get_data(filters, conditions):
@@ -74,25 +77,41 @@
 
 	return data
 
+def update_qty_columns(row_to_update, data_row):
+	fields = ["qty", "ordered_qty", "qty_to_order"]
+	for field in fields:
+		row_to_update[field] += flt(data_row[field])
+
 def prepare_data(data, filters):
 	"""Prepare consolidated Report data and Chart data"""
-	material_request_map = {}
+	material_request_map, item_qty_map = {}, {}
 
 	for row in data:
-		if not row["material_request"] in material_request_map:
-			# create an entry with mr as key
-			row_copy = copy.deepcopy(row)
-			material_request_map[row["material_request"]] = row_copy
+		# item wise map for charts
+		if not row["item_code"] in item_qty_map:
+			item_qty_map[row["item_code"]] = {
+				"qty" : row["qty"],
+				"ordered_qty" : row["ordered_qty"],
+				"qty_to_order" : row["qty_to_order"]
+			}
 		else:
-			mr_row = material_request_map[row["material_request"]]
-			mr_row["required_date"] = min(getdate(mr_row["required_date"]), getdate(row["required_date"]))
+			item_entry = item_qty_map[row["item_code"]]
+			update_qty_columns(item_entry, row)
 
-			#sum numeric rows
-			fields = ["qty", "ordered_qty", "qty_to_order"]
-			for field in fields:
-					mr_row[field] = flt(mr_row[field]) + flt(row[field])
+		if filters.get("group_by_mr"):
+			# consolidated material request map for group by filter
+			if not row["material_request"] in material_request_map:
+				# create an entry with mr as key
+				row_copy = copy.deepcopy(row)
+				material_request_map[row["material_request"]] = row_copy
+			else:
+				mr_row = material_request_map[row["material_request"]]
+				mr_row["required_date"] = min(getdate(mr_row["required_date"]), getdate(row["required_date"]))
 
-	chart_data = prepare_chart_data(material_request_map)
+				#sum numeric columns
+				update_qty_columns(mr_row, row)
+
+	chart_data = prepare_chart_data(item_qty_map)
 
 	if filters.get("group_by_mr"):
 		data =[]
@@ -102,12 +121,15 @@
 
 	return data, chart_data
 
-def prepare_chart_data(data):
+def prepare_chart_data(item_data):
 	labels, qty_to_order, ordered_qty = [], [], []
 
-	for row in data:
-		mr_row = data[row]
-		labels.append(mr_row["material_request"])
+	if len(item_data) > 30:
+		item_data = dict(list(item_data.items())[:30])
+
+	for row in item_data:
+		mr_row = item_data[row]
+		labels.append(row)
 		qty_to_order.append(mr_row["qty_to_order"])
 		ordered_qty.append(mr_row["ordered_qty"])
 
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index 16b49a1..b06bb76 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -1,8 +1,9 @@
 from __future__ import unicode_literals
+import frappe
 from frappe import _
 
 def get_data():
-	return [
+	config =  [
 		{
 			"label": _("Purchasing"),
 			"icon": "fa fa-star",
@@ -243,3 +244,21 @@
 		},
 
 	]
+
+	regional = {
+			"label": _("Regional"),
+			"items": [
+				{
+				"type": "doctype",
+				"name": "Import Supplier Invoice",
+				"description": _("Import Italian Supplier Invoice."),
+				"onboard": 1,
+				}
+			]
+		}
+
+	countries = frappe.get_all("Company", fields="country")
+	countries = [country["country"] for country in countries]
+	if "Italy" in countries:
+		config.append(regional)
+	return config
\ No newline at end of file
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 1e0a48c..b696ac3 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -361,7 +361,7 @@
 					self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
 
 	def set_gross_profit(self):
-		if self.doctype == "Sales Order":
+		if self.doctype in ["Sales Order", "Quotation"]:
 			for item in self.items:
 				item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
 
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 86de808..90d2930 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -226,7 +226,7 @@
 
 	def check_expense_account(self, item):
 		if not item.get("expense_account"):
-			frappe.throw(_("Expense or Difference account is mandatory for Item {0} as it impacts overall stock value").format(item.item_code))
+			frappe.throw(_("Expense Account not set for Item {0}. Please set an Expense Account for the item in the Items table").format(item.item_code))
 
 		else:
 			is_expense_account = frappe.db.get_value("Account",
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index ed37938..ecf041e 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -155,7 +155,7 @@
 		return frappe.db.exists(doctype, get_customer_filter(doc, customers))
 	elif suppliers:
 		fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier'
-		return frappe.db.exists(doctype, filters={
+		return frappe.db.exists(doctype, {
 			'name': doc.name,
 			fieldname: ["in", suppliers]
 		})
diff --git a/erpnext/crm/dashboard_fixtures.py b/erpnext/crm/dashboard_fixtures.py
index 16904b3..0535cbb 100644
--- a/erpnext/crm/dashboard_fixtures.py
+++ b/erpnext/crm/dashboard_fixtures.py
@@ -21,8 +21,8 @@
                 { "chart": "Opportunity Trends", "width": "Full"},
                 { "chart": "Won Opportunities", "width": "Full" },
                 { "chart": "Territory Wise Opportunity Count", "width": "Half"},
-                { "chart": "Territory Wise Sales", "width": "Half"},
                 { "chart": "Opportunities via Campaigns", "width": "Half" },
+                { "chart": "Territory Wise Sales", "width": "Full"},
                 { "chart": "Lead Source", "width": "Half"}
             ],
             "cards": [
@@ -59,7 +59,7 @@
         'is_public': 1,
         'timeseries': 1,
         "owner": "Administrator",
-        "filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
+        "filters_json": json.dumps([]),
         "type": "Bar"
     },
     {
@@ -90,7 +90,11 @@
         'timeseries': 1,
         "owner": "Administrator",
         "filters_json": json.dumps([["Opportunity", "company", "=", company, False]]),
-        "type": "Pie"
+        "type": "Pie",
+        "custom_options": json.dumps({
+            "truncateLegends": 1,
+            "maxSlices": 8
+        })
     },
     {
         "name": "Won Opportunities",
@@ -123,7 +127,11 @@
             ["Opportunity", "company", "=", company, False]
         ]),
         "owner": "Administrator",
-        "type": "Donut"
+        "type": "Donut",
+        "custom_options": json.dumps({
+            "truncateLegends": 1,
+            "maxSlices": 8
+        })
     },
     {
         "name": "Territory Wise Sales",
@@ -140,7 +148,7 @@
             ["Opportunity", "company", "=", company, False],
             ["Opportunity", "status", "=", "Converted", False]
         ]),
-        "type": "Donut"
+        "type": "Bar"
     },
     {
         "name": "Lead Source",
@@ -152,7 +160,11 @@
         "document_type": "Lead",
         'is_public': 1,
         "owner": "Administrator",
-        "type": "Pie"
+        "type": "Pie",
+        "custom_options": json.dumps({
+            "truncateLegends": 1,
+            "maxSlices": 8
+        })
     }]
 
 def get_number_cards():
diff --git a/erpnext/crm/desk_page/crm/crm.json b/erpnext/crm/desk_page/crm/crm.json
index 2fc4582..013fabe 100644
--- a/erpnext/crm/desk_page/crm/crm.json
+++ b/erpnext/crm/desk_page/crm/crm.json
@@ -42,7 +42,7 @@
  "idx": 0,
  "is_standard": 1,
  "label": "CRM",
- "modified": "2020-05-20 12:11:36.250491",
+ "modified": "2020-05-28 13:29:28.253749",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "CRM",
@@ -76,7 +76,7 @@
    "type": "Report"
   },
   {
-   "label": "CRM Dashboard",
+   "label": "Dashboard",
    "link_to": "CRM",
    "type": "Dashboard"
   }
diff --git a/erpnext/crm/module_onboarding/crm/crm.json b/erpnext/crm/module_onboarding/crm/crm.json
index 694763f..9b3d91e 100644
--- a/erpnext/crm/module_onboarding/crm/crm.json
+++ b/erpnext/crm/module_onboarding/crm/crm.json
@@ -16,7 +16,7 @@
  "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/CRM",
  "idx": 0,
  "is_complete": 0,
- "modified": "2020-05-20 12:53:47.029412",
+ "modified": "2020-05-27 11:33:09.941263",
  "modified_by": "Administrator",
  "module": "CRM",
  "name": "CRM",
diff --git a/erpnext/crm/onboarding_step/create_and_send_quotation/create_and_send_quotation.json b/erpnext/crm/onboarding_step/create_and_send_quotation/create_and_send_quotation.json
index a6edfd7..9201d77 100644
--- a/erpnext/crm/onboarding_step/create_and_send_quotation/create_and_send_quotation.json
+++ b/erpnext/crm/onboarding_step/create_and_send_quotation/create_and_send_quotation.json
@@ -8,12 +8,12 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-14 17:30:07.887411",
+ "modified": "2020-05-27 11:30:28.237263",
  "modified_by": "Administrator",
  "name": "Create and Send Quotation",
  "owner": "Administrator",
  "reference_document": "Quotation",
- "show_full_form": 0,
+ "show_full_form": 1,
  "title": "Create and Send Quotation",
- "validate_action": 0
+ "validate_action": 1
 }
\ No newline at end of file
diff --git a/erpnext/crm/onboarding_step/create_lead/create_lead.json b/erpnext/crm/onboarding_step/create_lead/create_lead.json
index 47a45d7..6ff0bd6 100644
--- a/erpnext/crm/onboarding_step/create_lead/create_lead.json
+++ b/erpnext/crm/onboarding_step/create_lead/create_lead.json
@@ -8,12 +8,12 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-14 17:28:36.441387",
+ "modified": "2020-05-27 11:30:59.493720",
  "modified_by": "Administrator",
  "name": "Create Lead",
  "owner": "Administrator",
  "reference_document": "Lead",
- "show_full_form": 0,
+ "show_full_form": 1,
  "title": "Create Lead",
- "validate_action": 0
+ "validate_action": 1
 }
\ No newline at end of file
diff --git a/erpnext/crm/onboarding_step/create_opportunity/create_opportunity.json b/erpnext/crm/onboarding_step/create_opportunity/create_opportunity.json
index 231cf17..9f996d9 100644
--- a/erpnext/crm/onboarding_step/create_opportunity/create_opportunity.json
+++ b/erpnext/crm/onboarding_step/create_opportunity/create_opportunity.json
@@ -15,5 +15,5 @@
  "reference_document": "Opportunity",
  "show_full_form": 0,
  "title": "Create Opportunity",
- "validate_action": 0
+ "validate_action": 1
 }
\ No newline at end of file
diff --git a/erpnext/crm/onboarding_step/introduction_to_crm/introduction_to_crm.json b/erpnext/crm/onboarding_step/introduction_to_crm/introduction_to_crm.json
index 552ade0..545a756 100644
--- a/erpnext/crm/onboarding_step/introduction_to_crm/introduction_to_crm.json
+++ b/erpnext/crm/onboarding_step/introduction_to_crm/introduction_to_crm.json
@@ -8,12 +8,12 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-14 17:28:16.448676",
+ "modified": "2020-05-27 11:28:07.452857",
  "modified_by": "Administrator",
  "name": "Introduction to CRM",
  "owner": "Administrator",
  "show_full_form": 0,
  "title": "Introduction to CRM",
- "validate_action": 0,
+ "validate_action": 1,
  "video_url": "https://www.youtube.com/watch?v=o9XCSZHJfpA"
 }
\ No newline at end of file
diff --git a/erpnext/education/desk_page/education/education.json b/erpnext/education/desk_page/education/education.json
index fc2697f..b341ec4 100644
--- a/erpnext/education/desk_page/education/education.json
+++ b/erpnext/education/desk_page/education/education.json
@@ -64,6 +64,11 @@
    "hidden": 0,
    "label": "Assessment Reports",
    "links": "[\n    {\n        \"dependencies\": [\n            \"Assessment Result\"\n        ],\n        \"doctype\": \"Assessment Result\",\n        \"is_query_report\": true,\n        \"label\": \"Course wise Assessment Report\",\n        \"name\": \"Course wise Assessment Report\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Assessment Result\"\n        ],\n        \"doctype\": \"Assessment Result\",\n        \"is_query_report\": true,\n        \"label\": \"Final Assessment Grades\",\n        \"name\": \"Final Assessment Grades\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Assessment Plan\"\n        ],\n        \"doctype\": \"Assessment Plan\",\n        \"is_query_report\": true,\n        \"label\": \"Assessment Plan Status\",\n        \"name\": \"Assessment Plan Status\",\n        \"type\": \"report\"\n    },\n    {\n        \"label\": \"Student Report Generation Tool\",\n        \"name\": \"Student Report Generation Tool\",\n        \"type\": \"doctype\"\n    }\n]"
+  },
+  {
+   "hidden": 0,
+   "label": "Reports",
+   "links": "[\n    {\n        \"dependencies\": [\n            \"Fees\"\n        ],\n        \"doctype\": \"Fees\",\n        \"is_query_report\": true,\n        \"label\": \"Student Fee Collection\",\n        \"name\": \"Student Fee Collection\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Student Attendance\"\n        ],\n        \"doctype\": \"Student Attendance\",\n        \"is_query_report\": true,\n        \"label\": \"Student Monthly Attendance Sheet\",\n        \"name\": \"Student Monthly Attendance Sheet\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Student Attendance\"\n        ],\n        \"doctype\": \"Student Attendance\",\n        \"is_query_report\": true,\n        \"label\": \"Absent Student Report\",\n        \"name\": \"Absent Student Report\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Program Enrollment\"\n        ],\n        \"doctype\": \"Program Enrollment\",\n        \"is_query_report\": true,\n        \"label\": \"Student and Guardian Contact Details\",\n        \"name\": \"Student and Guardian Contact Details\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Student Attendance\"\n        ],\n        \"doctype\": \"Student Attendance\",\n        \"is_query_report\": true,\n        \"label\": \"Student Batch-Wise Attendance\",\n        \"name\": \"Student Batch-Wise Attendance\",\n        \"type\": \"report\"\n    }\n]"
   }
  ],
  "category": "Domains",
@@ -77,7 +82,7 @@
  "idx": 0,
  "is_standard": 1,
  "label": "Education",
- "modified": "2020-04-01 11:28:51.011309",
+ "modified": "2020-05-22 01:09:13.058482",
  "modified_by": "Administrator",
  "module": "Education",
  "name": "Education",
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
new file mode 100644
index 0000000..c36dfb1
--- /dev/null
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+	return {
+		'fieldname': 'assessment_plan',
+		'non_standard_fieldnames': {
+		},
+		'transactions': [
+			{
+				'label': _('Assessment'),
+				'items': ['Assessment Result']
+			}
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/education/doctype/course/course_dashboard.py b/erpnext/education/doctype/course/course_dashboard.py
new file mode 100644
index 0000000..752af29
--- /dev/null
+++ b/erpnext/education/doctype/course/course_dashboard.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+	return {
+		'fieldname': 'course',
+		'non_standard_fieldnames': {
+		},
+		'transactions': [
+			{
+				'label': _('Course'),
+				'items': ['Course Enrollment', 'Course Schedule']
+			},
+			{
+				'label': _('Student'),
+				'items': ['Student Group']
+			},
+			{
+				'label': _('Assessment'),
+				'items': ['Assessment Plan']
+			},
+		]
+	}
\ No newline at end of file
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.json b/erpnext/education/doctype/fee_schedule/fee_schedule.json
index 1e98709..7918318 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.json
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.json
@@ -1,4 +1,5 @@
 {
+ "actions": [],
  "allow_import": 1,
  "autoname": "naming_series:",
  "creation": "2017-07-18 15:21:21.527136",
@@ -7,6 +8,7 @@
  "engine": "InnoDB",
  "field_order": [
   "fee_structure",
+  "posting_date",
   "due_date",
   "naming_series",
   "fee_creation_status",
@@ -259,10 +261,18 @@
   {
    "fieldname": "dimension_col_break",
    "fieldtype": "Column Break"
+  },
+  {
+   "default": "Today",
+   "fieldname": "posting_date",
+   "fieldtype": "Date",
+   "label": "Posting Date",
+   "reqd": 1
   }
  ],
  "is_submittable": 1,
- "modified": "2019-05-26 09:10:34.522409",
+ "links": [],
+ "modified": "2020-05-15 08:39:20.682837",
  "modified_by": "Administrator",
  "module": "Education",
  "name": "Fee Schedule",
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.py b/erpnext/education/doctype/fee_schedule/fee_schedule.py
index a42800a..1543acd 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.py
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.py
@@ -87,6 +87,7 @@
 						}
 					}
 				})
+				fees_doc.posting_date = doc.posting_date
 				fees_doc.student = student.student
 				fees_doc.student_name = student.student_name
 				fees_doc.program = student.program
diff --git a/erpnext/erpnext_integrations/connectors/shopify_connection.py b/erpnext/erpnext_integrations/connectors/shopify_connection.py
index ca0e160..7046038 100644
--- a/erpnext/erpnext_integrations/connectors/shopify_connection.py
+++ b/erpnext/erpnext_integrations/connectors/shopify_connection.py
@@ -95,10 +95,10 @@
 		items = get_order_items(shopify_order.get("line_items"), shopify_settings)
 
 		if not items:
-			message = 'Following items are exists in order but relevant record not found in Product master'
+			message = 'Following items exists in the shopify order but relevant records were not found in the shopify Product master'
 			message += "\n" + ", ".join(product_not_exists)
 
-			make_shopify_log(status="Error", exception=e, rollback=True)
+			make_shopify_log(status="Error", exception=message, rollback=True)
 
 			return ''
 
diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
index 44f87e0..1b0c9f6 100644
--- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
+++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
@@ -182,7 +182,8 @@
 	company_abbr = frappe.db.get_value('Company', woocommerce_settings.company, 'abbr')
 
 	default_warehouse = _("Stores - {0}", sys_lang).format(company_abbr)
-	if not frappe.db.exists("Warehouse", default_warehouse):
+	if not frappe.db.exists("Warehouse", default_warehouse) \
+		and not woocommerce_settings.warehouse:
 		frappe.throw(_("Please set Warehouse in Woocommerce Settings"))
 
 	for item in order.get("line_items"):
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
index a706223..a45c6b1 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
@@ -124,10 +124,11 @@
 
 @frappe.whitelist()
 def sync_transactions(bank, bank_account):
-
-	last_sync_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date")
-	if last_sync_date:
-		start_date = formatdate(last_sync_date, "YYYY-MM-dd")
+	'''Sync transactions based on the last integration date as the start date, after the sync is completed
+		add the transaction date of the oldest transaction as the last integration date'''
+	last_transaction_date = frappe.db.get_value("Bank Account", bank_account, "last_integration_date")
+	if last_transaction_date:
+		start_date = formatdate(last_transaction_date, "YYYY-MM-dd")
 	else:
 		start_date = formatdate(add_months(today(), -12), "YYYY-MM-dd")
 	end_date = formatdate(today(), "YYYY-MM-dd")
@@ -139,12 +140,14 @@
 		for transaction in reversed(transactions):
 			result += new_bank_transaction(transaction)
 
-		frappe.logger().info("Plaid added {} new Bank Transactions from '{}' between {} and {}".format(
-			len(result), bank_account, start_date, end_date))
+		if result:
+			end_date = frappe.db.get_value('Bank Transaction', result.pop(), 'date')
 
-		frappe.db.set_value("Bank Account", bank_account, "last_integration_date", getdate(end_date))
+			frappe.logger().info("Plaid added {} new Bank Transactions from '{}' between {} and {}".format(
+				len(result), bank_account, start_date, end_date))
 
-		return result
+		frappe.db.set_value("Bank Account", bank_account, "last_integration_date", end_date)
+
 	except Exception:
 		frappe.log_error(frappe.get_traceback(), _("Plaid transactions sync error"))
 
diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
index 8f1b746..5339c99 100644
--- a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
+++ b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
@@ -133,7 +133,7 @@
    "label": "Customer Settings"
   },
   {
-   "description": "If Shopify not contains a customer in Order, then while syncing Orders, the system will consider default customer for order",
+   "description": "If Shopify does not have a customer in the order, then while syncing the orders, the system will consider the default customer for the order",
    "fieldname": "default_customer",
    "fieldtype": "Link",
    "label": "Default Customer",
@@ -258,7 +258,7 @@
   }
  ],
  "issingle": 1,
- "modified": "2019-09-13 12:32:11.384757",
+ "modified": "2020-05-28 12:32:11.384757",
  "modified_by": "umair@erpnext.com",
  "module": "ERPNext Integrations",
  "name": "Shopify Settings",
@@ -277,4 +277,4 @@
  ],
  "sort_field": "modified",
  "sort_order": "DESC"
-}
\ No newline at end of file
+}
diff --git a/erpnext/healthcare/dashboard_fixtures.py b/erpnext/healthcare/dashboard_fixtures.py
index 59da71a..967117d 100644
--- a/erpnext/healthcare/dashboard_fixtures.py
+++ b/erpnext/healthcare/dashboard_fixtures.py
@@ -19,7 +19,7 @@
 	else:
 		company = frappe.get_list("Company", limit=1)
 		if company:
-			return company.name
+			return company[0].name
 	return None
 
 def get_dashboards():
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
index c266ba8..cf2276f 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
@@ -57,19 +57,19 @@
 		description: __('Checking this will automatically create a Sales Invoice whenever an appointment is booked for a Patient.')
 	},
 	{
-		fieldname: 'healthcare_service_items',
+		fieldname: 'inpatient_visit_charge_item',
 		title: __('Healthcare Service Items'),
-		description: __('Set up the Healthcare Service Items for billing. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#2-default-healthcare-service-items' target='_blank'>here</a>" + __(' to know more')
+		description: __('You can create a service item for Inpatient Visit Charge and set it here. Similarly, you can set up other Healthcare Service Items for billing in this section. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#2-default-healthcare-service-items' target='_blank'>here</a>" + __(' to know more')
 	},
 	{
-		fieldname: 'sb_in_ac',
+		fieldname: 'income_account',
 		title: __('Set up default Accounts for the Healthcare Facility'),
 		description: __('If you wish to override default accounts settings and configure the Income and Receivable accounts for Healthcare, you can do so here.')
 
 	},
 	{
-		fieldname: 'out_patient_sms_alerts',
+		fieldname: 'send_registration_msg',
 		title: __('Out Patient SMS alerts'),
-		description: __('You can set up Out Patient SMS alerts here. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#4-out-patient-sms-alerts' target='_blank'>here</a>" + __(' to know more')
+		description: __('If you want to send SMS alert on Patient Registration, you can enable this option. Similary, you can set up Out Patient SMS alerts for other functionalities in this section. Click ') + "<a href='https://docs.erpnext.com/docs/user/manual/en/healthcare/healthcare_settings#4-out-patient-sms-alerts' target='_blank'>here</a>" + __(' to know more')
 	}
 ];
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
index 3952a81..15c9434 100644
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
+++ b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.json
@@ -11,6 +11,7 @@
   "patient",
   "assessment_template",
   "column_break_4",
+  "company",
   "healthcare_practitioner",
   "assessment_datetime",
   "assessment_description",
@@ -127,11 +128,18 @@
    "fieldname": "assessment_description",
    "fieldtype": "Small Text",
    "label": "Assessment Description"
+  },
+  {
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_standard_filter": 1,
+   "label": "Company",
+   "options": "Company"
   }
  ],
  "is_submittable": 1,
  "links": [],
- "modified": "2020-04-21 13:23:09.815007",
+ "modified": "2020-05-25 14:38:38.302399",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Patient Assessment",
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.json b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
index c352287..016cfbc 100644
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.json
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.json
@@ -85,11 +85,9 @@
   {
    "fieldname": "company",
    "fieldtype": "Link",
-   "hidden": 1,
+   "in_standard_filter": 1,
    "label": "Company",
-   "options": "Company",
-   "print_hide": 1,
-   "report_hide": 1
+   "options": "Company"
   },
   {
    "fieldname": "section_break_6",
@@ -167,7 +165,7 @@
  ],
  "is_submittable": 1,
  "links": [],
- "modified": "2020-04-04 19:17:02.707203",
+ "modified": "2020-05-25 14:36:46.990469",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Sample Collection",
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
index ca78b66..9edfeb2 100644
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
+++ b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.json
@@ -10,6 +10,7 @@
   "patient",
   "patient_name",
   "column_break_4",
+  "company",
   "status",
   "start_date",
   "section_break_3",
@@ -98,10 +99,17 @@
    "label": "Status",
    "options": "Not Started\nIn Progress\nCompleted\nCancelled",
    "read_only": 1
+  },
+  {
+   "fieldname": "company",
+   "fieldtype": "Link",
+   "in_standard_filter": 1,
+   "label": "Company",
+   "options": "Company"
   }
  ],
  "links": [],
- "modified": "2020-04-21 13:13:43.956014",
+ "modified": "2020-05-25 14:38:53.649315",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Therapy Plan",
diff --git a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json b/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
index db35149..3e50726 100644
--- a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
+++ b/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
@@ -10,7 +10,7 @@
  "documentation_url": "https://docs.erpnext.com/docs/user/manual/en/healthcare",
  "idx": 0,
  "is_complete": 0,
- "modified": "2020-05-19 12:52:09.757729",
+ "modified": "2020-05-26 23:16:37.603361",
  "modified_by": "Administrator",
  "module": "Healthcare",
  "name": "Healthcare",
@@ -20,13 +20,13 @@
    "step": "Create Patient"
   },
   {
-   "step": "Create Practitioner"
-  },
-  {
    "step": "Create Practitioner Schedule"
   },
   {
-   "step": "Setup Schedule and Employee for Healthcare Practitioner"
+   "step": "Introduction to Healthcare Practitioner"
+  },
+  {
+   "step": "Create Healthcare Practitioner"
   },
   {
    "step": "Explore Healthcare Settings"
diff --git a/erpnext/healthcare/onboarding_step/create_practitioner/create_practitioner.json b/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
similarity index 64%
rename from erpnext/healthcare/onboarding_step/create_practitioner/create_practitioner.json
rename to erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
index 614b201..c45a347 100644
--- a/erpnext/healthcare/onboarding_step/create_practitioner/create_practitioner.json
+++ b/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
@@ -1,6 +1,6 @@
 {
  "action": "Create Entry",
- "creation": "2020-05-19 10:39:55.728057",
+ "creation": "2020-05-19 10:39:55.728058",
  "docstatus": 0,
  "doctype": "Onboarding Step",
  "idx": 0,
@@ -8,12 +8,12 @@
  "is_mandatory": 1,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-19 12:27:39.851375",
+ "modified": "2020-05-26 23:16:31.965521",
  "modified_by": "Administrator",
- "name": "Create Practitioner",
+ "name": "Create Healthcare Practitioner",
  "owner": "Administrator",
  "reference_document": "Healthcare Practitioner",
  "show_full_form": 1,
- "title": "Create Practitioner",
+ "title": "Create Healthcare Practitioner",
  "validate_action": 1
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json b/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
index f0c0f61..697b761 100644
--- a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
+++ b/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
@@ -8,7 +8,7 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-19 11:46:35.085270",
+ "modified": "2020-05-26 23:10:24.504030",
  "modified_by": "Administrator",
  "name": "Explore Clinical Procedure Templates",
  "owner": "Administrator",
diff --git a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json b/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
index 2bdab69..b2d5aef 100644
--- a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
+++ b/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
@@ -8,7 +8,7 @@
  "is_mandatory": 1,
  "is_single": 1,
  "is_skipped": 0,
- "modified": "2020-05-19 12:26:48.682673",
+ "modified": "2020-05-26 23:10:24.507648",
  "modified_by": "Administrator",
  "name": "Explore Healthcare Settings",
  "owner": "Administrator",
diff --git a/erpnext/healthcare/onboarding_step/setup_schedule_and_employee_for_healthcare_practitioner/setup_schedule_and_employee_for_healthcare_practitioner.json b/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
similarity index 67%
rename from erpnext/healthcare/onboarding_step/setup_schedule_and_employee_for_healthcare_practitioner/setup_schedule_and_employee_for_healthcare_practitioner.json
rename to erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
index c5af177..fa4c903 100644
--- a/erpnext/healthcare/onboarding_step/setup_schedule_and_employee_for_healthcare_practitioner/setup_schedule_and_employee_for_healthcare_practitioner.json
+++ b/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
@@ -9,12 +9,12 @@
  "is_mandatory": 1,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-19 12:26:42.492734",
+ "modified": "2020-05-26 22:07:07.482530",
  "modified_by": "Administrator",
- "name": "Setup Schedule and Employee for Healthcare Practitioner",
+ "name": "Introduction to Healthcare Practitioner",
  "owner": "Administrator",
  "reference_document": "Healthcare Practitioner",
  "show_full_form": 0,
- "title": "Setup Schedule and Employee for Healthcare Practitioner",
+ "title": "Introduction to Healthcare Practitioner",
  "validate_action": 0
 }
\ No newline at end of file
diff --git a/erpnext/healthcare/setup.py b/erpnext/healthcare/setup.py
index 2087f49..0684080 100644
--- a/erpnext/healthcare/setup.py
+++ b/erpnext/healthcare/setup.py
@@ -195,10 +195,21 @@
 
 def add_healthcare_service_unit_tree_root():
 	record = [
-	 {
-	  "doctype": "Healthcare Service Unit",
-	  "healthcare_service_unit_name": "All Healthcare Service Units",
-	  "is_group": 1
-	 }
+		{
+			"doctype": "Healthcare Service Unit",
+			"healthcare_service_unit_name": "All Healthcare Service Units",
+			"is_group": 1,
+			"company": get_company()
+	 	}
 	]
 	insert_record(record)
+
+def get_company():
+	company = frappe.defaults.get_defaults().company
+	if company:
+		return company
+	else:
+		company = frappe.get_list("Company", limit=1)
+		if company:
+			return company[0].name
+	return None
diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py
index f092578..9abaa07 100644
--- a/erpnext/healthcare/utils.py
+++ b/erpnext/healthcare/utils.py
@@ -512,10 +512,10 @@
 def get_patient_vitals(patient, from_date=None, to_date=None):
 	if not patient: return
 
-	vitals = frappe.db.get_all('Vital Signs', {
+	vitals = frappe.db.get_all('Vital Signs', filters={
 			'docstatus': 1,
 			'patient': patient
-		}, order_by='signs_date, signs_time')
+		}, order_by='signs_date, signs_time', fields=['*'])
 
 	if len(vitals):
 		return vitals
diff --git a/erpnext/hr/desk_page/hr/hr.json b/erpnext/hr/desk_page/hr/hr.json
index 2d0e885..33132a6 100644
--- a/erpnext/hr/desk_page/hr/hr.json
+++ b/erpnext/hr/desk_page/hr/hr.json
@@ -89,11 +89,10 @@
  "docstatus": 0,
  "doctype": "Desk Page",
  "extends_another_page": 0,
- "hide_custom": 0,
  "idx": 0,
  "is_standard": 1,
  "label": "HR",
- "modified": "2020-05-20 11:20:54.255557",
+ "modified": "2020-05-23 12:41:52.543438",
  "modified_by": "Administrator",
  "module": "HR",
  "name": "HR",
@@ -127,7 +126,7 @@
    "type": "DocType"
   },
   {
-   "label": "Salary Register",
+   "label": "Monthly Attendance Sheet",
    "link_to": "Monthly Attendance Sheet",
    "type": "Report"
   },
diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
index bab6fb5..e369ba7 100644
--- a/erpnext/hr/doctype/additional_salary/additional_salary.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -37,7 +37,7 @@
 				frappe.throw(_("Payroll date can not be less than employee's joining date."))
 			elif getdate(self.from_date) < getdate(date_of_joining):
 				frappe.throw(_("From date can not be less than employee's joining date."))
-			elif getdate(self.to_date) > getdate(relieving_date):
+			elif relieving_date and getdate(self.to_date) > getdate(relieving_date):
 				frappe.throw(_("To date can not be greater than employee's relieving date."))
 
 	def get_amount(self, sal_start_date, sal_end_date):
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 84f2c83..f2968bc 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -438,14 +438,23 @@
 	leave_allocation = {}
 	for d in allocation_records:
 		allocation = allocation_records.get(d, frappe._dict())
+
+		total_allocated_leaves = frappe.db.get_value('Leave Allocation', {
+			'from_date': ('<=', date),
+			'to_date': ('>=', date),
+			'leave_type': allocation.leave_type,
+		}, 'SUM(total_leaves_allocated)') or 0
+
 		remaining_leaves = get_leave_balance_on(employee, d, date, to_date = allocation.to_date,
 			consider_all_leaves_in_the_allocation_period=True)
+
 		end_date = allocation.to_date
 		leaves_taken = get_leaves_for_period(employee, d, allocation.from_date, end_date) * -1
 		leaves_pending = get_pending_leaves_for_period(employee, d, allocation.from_date, end_date)
 
 		leave_allocation[d] = {
-			"total_leaves": allocation.total_leaves_allocated,
+			"total_leaves": total_allocated_leaves,
+			"expired_leaves": total_allocated_leaves - (remaining_leaves + leaves_taken),
 			"leaves_taken": leaves_taken,
 			"pending_leaves": leaves_pending,
 			"remaining_leaves": remaining_leaves}
diff --git a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
index 2385b6a..295f3b4 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
+++ b/erpnext/hr/doctype/leave_application/leave_application_dashboard.html
@@ -4,11 +4,12 @@
 <table class="table table-bordered small">
 	<thead>
 		<tr>
-			<th style="width: 20%">{{ __("Leave Type") }}</th>
-			<th style="width: 20%" class="text-right">{{ __("Total Allocated Leaves") }}</th>
-			<th style="width: 20%" class="text-right">{{ __("Used Leaves") }}</th>
-			<th style="width: 20%" class="text-right">{{ __("Pending Leaves") }}</th>
-			<th style="width: 20%" class="text-right">{{ __("Available Leaves") }}</th>
+			<th style="width: 16%">{{ __("Leave Type") }}</th>
+			<th style="width: 16%" class="text-right">{{ __("Total Allocated Leaves") }}</th>
+			<th style="width: 16%" class="text-right">{{ __("Expired Leaves") }}</th>
+			<th style="width: 16%" class="text-right">{{ __("Used Leaves") }}</th>
+			<th style="width: 16%" class="text-right">{{ __("Pending Leaves") }}</th>
+			<th style="width: 16%" class="text-right">{{ __("Available Leaves") }}</th>
 		</tr>
 
 	</thead>
@@ -17,6 +18,7 @@
 			<tr>
 				<td> {%= key %} </td>
 				<td class="text-right"> {%= value["total_leaves"] %} </td>
+				<td class="text-right"> {%= value["expired_leaves"] %} </td>
 				<td class="text-right"> {%= value["leaves_taken"] %} </td>
 				<td class="text-right"> {%= value["pending_leaves"] %} </td>
 				<td class="text-right"> {%= value["remaining_leaves"] %} </td>
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index 61faea1..edf05e8 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -22,6 +22,9 @@
 
 	args = frappe.local.form_dict
 
+	if getdate(args.from_date) > getdate(args.to_date):
+		frappe.throw(_("To Date should be greater than From Date"))
+
 	w = UnicodeWriter()
 	w = add_header(w)
 
diff --git a/erpnext/hr/onboarding_step/create_holiday_list/create_holiday_list.json b/erpnext/hr/onboarding_step/create_holiday_list/create_holiday_list.json
index 25cb9fe..208e394 100644
--- a/erpnext/hr/onboarding_step/create_holiday_list/create_holiday_list.json
+++ b/erpnext/hr/onboarding_step/create_holiday_list/create_holiday_list.json
@@ -1,6 +1,6 @@
 {
  "action": "Create Entry",
- "creation": "2020-05-14 11:47:34.700174",
+ "creation": "2020-05-27 11:47:34.700174",
  "docstatus": 0,
  "doctype": "Onboarding Step",
  "idx": 0,
@@ -13,7 +13,7 @@
  "name": "Create Holiday list",
  "owner": "Administrator",
  "reference_document": "Holiday List",
- "show_full_form": 0,
+ "show_full_form": 1,
  "title": "Create Holiday list",
  "validate_action": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/onboarding_step/create_leave_type/create_leave_type.json b/erpnext/hr/onboarding_step/create_leave_type/create_leave_type.json
index e8b97c2..8cbfc5c 100644
--- a/erpnext/hr/onboarding_step/create_leave_type/create_leave_type.json
+++ b/erpnext/hr/onboarding_step/create_leave_type/create_leave_type.json
@@ -1,6 +1,6 @@
 {
  "action": "Create Entry",
- "creation": "2020-05-20 11:17:31.119312",
+ "creation": "2020-05-27 11:17:31.119312",
  "docstatus": 0,
  "doctype": "Onboarding Step",
  "idx": 0,
@@ -13,7 +13,7 @@
  "name": "Create Leave Type",
  "owner": "Administrator",
  "reference_document": "Leave Type",
- "show_full_form": 0,
+ "show_full_form": 1,
  "title": "Create Leave Type",
  "validate_action": 0
 }
\ No newline at end of file
diff --git a/erpnext/hr/report/employee_analytics/employee_analytics.py b/erpnext/hr/report/employee_analytics/employee_analytics.py
index df64006..8f39388 100644
--- a/erpnext/hr/report/employee_analytics/employee_analytics.py
+++ b/erpnext/hr/report/employee_analytics/employee_analytics.py
@@ -26,7 +26,7 @@
 	return [
 		_("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date of Birth")+ ":Date:100",
 		_("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120",
-		_("Designation") + ":Link/Designation:120", _("Gender") + "::60", _("Company") + ":Link/Company:120"
+		_("Designation") + ":Link/Designation:120", _("Gender") + "::100", _("Company") + ":Link/Company:120"
 	]
 
 def get_conditions(filters):
@@ -43,7 +43,12 @@
 	gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1)
 
 def get_parameters(filters):
-	return frappe.db.sql("""select name from `tab"""+filters.get("parameter")+"""` """, as_list=1)
+	if filters.get("parameter") == "Grade":
+		parameter = "Employee Grade"
+	else:
+		parameter = filters.get("parameter")
+
+	return frappe.db.sql("""select name from `tab"""+ parameter +"""` """, as_list=1)
 
 def get_chart_data(parameters,employees, filters):
 	if not parameters:
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index 97be5cd..db1d191 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -3,13 +3,13 @@
 
 from __future__ import unicode_literals
 import frappe
-from frappe.utils import flt
+from frappe.utils import flt, add_days
 from frappe import _
-from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on, get_leave_allocation_records
+from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on
 
 def execute(filters=None):
 	if filters.to_date <= filters.from_date:
-		frappe.throw(_('From date can not be greater than than To date'))
+		frappe.throw(_('"From date" can not be greater than or equal to "To date"'))
 
 	columns = get_columns()
 	data = get_data(filters)
@@ -104,14 +104,17 @@
 				new_allocation, expired_leaves = get_allocated_and_expired_leaves(filters.from_date, filters.to_date, employee.name, leave_type)
 
 
-				opening = get_leave_balance_on(employee.name, leave_type, filters.from_date)
-				closing = get_leave_balance_on(employee.name, leave_type, filters.to_date)
+				opening = get_leave_balance_on(employee.name, leave_type, add_days(filters.from_date, -1)) #allocation boundary condition
 
 				row.leaves_allocated = new_allocation
 				row.leaves_expired = expired_leaves - leaves_taken if expired_leaves - leaves_taken > 0 else 0
 				row.opening_balance = opening
 				row.leaves_taken = leaves_taken
-				row.closing_balance = closing
+
+				# not be shown on the basis of days left it create in user mind for carry_forward leave
+				row.closing_balance = (new_allocation + opening - (row.leaves_expired + leaves_taken))
+
+
 				row.indent = 1
 				data.append(row)
 				new_leaves_allocated = 0
@@ -177,7 +180,7 @@
 	}, as_dict=1)
 
 	for record in records:
-		if record.to_date <= getdate(to_date):
+		if record.to_date < getdate(to_date):
 			expired_leaves += record.leaves
 
 		if record.from_date >= getdate(from_date):
diff --git a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
index a5cdecf..92715d3 100644
--- a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
+++ b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
@@ -6,7 +6,7 @@
 from frappe import _
 from frappe.utils import flt
 from erpnext.hr.doctype.leave_application.leave_application \
-	import get_leave_balance_on, get_leaves_for_period
+	import get_leave_details
 
 from erpnext.hr.report.employee_leave_balance.employee_leave_balance \
 	import get_department_leave_approver_map
@@ -61,14 +61,14 @@
 
 		if (len(leave_approvers) and user in leave_approvers) or (user in ["Administrator", employee.user_id]) or ("HR Manager" in frappe.get_roles(user)):
 			row = [employee.name, employee.employee_name, employee.department]
-
+			available_leave = get_leave_details(employee.name, filters.date)
 			for leave_type in leave_types:
-
+				remaining = 0
+				if leave_type in available_leave["leave_allocation"]:
 				# opening balance
-				opening = get_leave_balance_on(employee.name, leave_type, filters.date)
+					remaining = available_leave["leave_allocation"][leave_type]['remaining_leaves']
 
-
-				row += [opening]
+				row += [remaining]
 
 			data.append(row)
 
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index 60767b5..47daab1 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -135,7 +135,7 @@
 		row += [emp, emp_det.employee_name]
 
 		total_p = total_a = total_l = total_h = total_um= 0.0
-		ggg = []
+		emp_status_map = []
 		for day in range(filters["total_days_in_month"]):
 			status = None
 			status = att_map.get(emp).get(day + 1)
@@ -152,11 +152,10 @@
 								status = "Holiday"
 							total_h += 1
 
-			ggg.append(status_map.get(status, ""))
+			abbr = status_map.get(status, "")
+			emp_status_map.append(abbr)
 
-			if not filters.summarized_view:
-				row += ggg
-			else:
+			if  filters.summarized_view:
 				if status == "Present" or status == "Work From Home":
 					total_p += 1
 				elif status == "Absent":
@@ -170,6 +169,9 @@
 				elif not status:
 					total_um += 1
 
+		if not filters.summarized_view:
+			row += emp_status_map
+
 		if filters.summarized_view:
 			row += [total_p, total_l, total_a, total_h, total_um]
 
@@ -203,7 +205,7 @@
 					row.append("0.0")
 
 			row.extend([time_default_counts[0][0],time_default_counts[0][1]])
-		emp_att_map[emp] = ggg
+		emp_att_map[emp] = emp_status_map
 		record.append(row)
 
 	return record, emp_att_map
@@ -216,7 +218,7 @@
 		columns = [_(filters.group_by)+ ":Link/Branch:120"]
 
 	columns += [
-		_("Employee") + ":Link/Employee:120", _("Employee Name") + ":Link/Employee:120"
+		_("Employee") + ":Link/Employee:120", _("Employee Name") + ":Data/:120"
 	]
 	days = []
 	for day in range(filters["total_days_in_month"]):
diff --git a/erpnext/loan_management/desk_page/loan_management/loan_management.json b/erpnext/loan_management/desk_page/loan_management/loan_management.json
index f9ea978..d2a1763 100644
--- a/erpnext/loan_management/desk_page/loan_management/loan_management.json
+++ b/erpnext/loan_management/desk_page/loan_management/loan_management.json
@@ -36,11 +36,11 @@
  "extends_another_page": 0,
  "idx": 0,
  "is_standard": 1,
- "label": "Loan Management",
- "modified": "2020-04-02 11:28:51.380509",
+ "label": "Loan",
+ "modified": "2020-05-22 11:28:51.380509",
  "modified_by": "Administrator",
  "module": "Loan Management",
- "name": "Loan Management",
+ "name": "Loan",
  "owner": "Administrator",
  "pin_to_bottom": 0,
  "pin_to_top": 0,
diff --git a/erpnext/manufacturing/dashboard_fixtures.py b/erpnext/manufacturing/dashboard_fixtures.py
index ef61f23..4a17fd0 100644
--- a/erpnext/manufacturing/dashboard_fixtures.py
+++ b/erpnext/manufacturing/dashboard_fixtures.py
@@ -3,7 +3,7 @@
 
 import frappe, erpnext, json
 from frappe import _
-from frappe.utils import nowdate, get_date_str
+from frappe.utils import nowdate, get_first_day, get_last_day, add_months
 from erpnext.accounts.utils import get_fiscal_year
 
 def get_data():
@@ -28,10 +28,10 @@
 			{ "chart": "Job Card Analysis", "width": "Full" }
 		],
 		"cards": [
-			{ "card": "Total Work Order" },
-			{ "card": "Completed Work Order" },
+			{ "card": "Monthly Total Work Order" },
+			{ "card": "Monthly Completed Work Order" },
 			{ "card": "Ongoing Job Card" },
-			{ "card": "Total Quality Inspection"}
+			{ "card": "Monthly Quality Inspection"}
 		]
 	}]
 
@@ -180,38 +180,37 @@
 	}]
 
 def get_number_cards():
-	fiscal_year = get_fiscal_year(date=nowdate())
-	year_start_date = get_date_str(fiscal_year[1])
-	year_end_date = get_date_str(fiscal_year[2])
+	start_date = add_months(nowdate(), -1)
+	end_date = nowdate()
 
 	return [{
 		"doctype": "Number Card",
 		"document_type": "Work Order",
-		"name": "Total Work Order",
+		"name": "Monthly Total Work Order",
 		"filters_json": json.dumps([
 			['Work Order', 'docstatus', '=', 1],
-			['Work Order', 'creation', 'between', [year_start_date, year_end_date]]
+			['Work Order', 'creation', 'between', [start_date, end_date]]
 		]),
 		"function": "Count",
 		"is_public": 1,
-		"label": _("Total Work Order"),
+		"label": _("Monthly Total Work Order"),
 		"show_percentage_stats": 1,
-		"stats_time_interval": "Monthly"
+		"stats_time_interval": "Weekly"
 	},
 	{
 		"doctype": "Number Card",
 		"document_type": "Work Order",
-		"name": "Completed Work Order",
+		"name": "Monthly Completed Work Order",
 		"filters_json": json.dumps([
 			['Work Order', 'status', '=', 'Completed'],
 			['Work Order', 'docstatus', '=', 1],
-			['Work Order', 'creation', 'between', [year_start_date, year_end_date]]
+			['Work Order', 'creation', 'between', [start_date, end_date]]
 		]),
 		"function": "Count",
 		"is_public": 1,
-		"label": _("Completed Work Order"),
+		"label": _("Monthly Completed Work Order"),
 		"show_percentage_stats": 1,
-		"stats_time_interval": "Monthly"
+		"stats_time_interval": "Weekly"
 	},
 	{
 		"doctype": "Number Card",
@@ -225,16 +224,19 @@
 		"is_public": 1,
 		"label": _("Ongoing Job Card"),
 		"show_percentage_stats": 1,
-		"stats_time_interval": "Monthly"
+		"stats_time_interval": "Weekly"
 	},
 	{
 		"doctype": "Number Card",
 		"document_type": "Quality Inspection",
-		"name": "Total Quality Inspection",
-		"filters_json": json.dumps([['Quality Inspection', 'docstatus', '=', 1]]),
+		"name": "Monthly Quality Inspection",
+		"filters_json": json.dumps([
+			['Quality Inspection', 'docstatus', '=', 1],
+			['Quality Inspection', 'creation', 'between', [start_date, end_date]]
+		]),
 		"function": "Count",
 		"is_public": 1,
-		"label": _("Total Quality Inspection"),
+		"label": _("Monthly Quality Inspection"),
 		"show_percentage_stats": 1,
-		"stats_time_interval": "Monthly"
+		"stats_time_interval": "Weekly"
 	}]
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.json b/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.json
index 9acb4f0..b301a9e 100644
--- a/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.json
+++ b/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.json
@@ -1,11 +1,13 @@
 {
  "actions": [],
  "allow_import": 1,
+ "autoname": "naming_series:",
  "creation": "2020-04-18 04:50:46.187638",
  "doctype": "DocType",
  "editable_grid": 1,
  "engine": "InnoDB",
  "field_order": [
+  "naming_series",
   "workstation",
   "operator",
   "column_break_4",
@@ -78,10 +80,17 @@
    "fieldname": "remarks",
    "fieldtype": "Text",
    "label": "Remarks"
+  },
+  {
+   "fieldname": "naming_series",
+   "fieldtype": "Select",
+   "label": "Naming Series",
+   "options": "DT-",
+   "reqd": 1
   }
  ],
  "links": [],
- "modified": "2020-05-19 12:59:37.358483",
+ "modified": "2020-05-26 22:14:54.479831",
  "modified_by": "Administrator",
  "module": "Manufacturing",
  "name": "Downtime Entry",
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py
index e43b98a..c29d4ba 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card.py
@@ -102,8 +102,11 @@
 		workstation_doc = frappe.get_cached_doc("Workstation", self.workstation)
 		if (not workstation_doc.working_hours or
 			cint(frappe.db.get_single_value("Manufacturing Settings", "allow_overtime"))):
-			row.remaining_time_in_mins -= time_diff_in_minutes(row.planned_end_time,
-				row.planned_start_time)
+			if get_datetime(row.planned_end_time) < get_datetime(row.planned_start_time):
+				row.planned_end_time = add_to_date(row.planned_start_time, minutes=row.time_in_mins)
+				row.remaining_time_in_mins = 0.0
+			else:
+				row.remaining_time_in_mins -= time_diff_in_minutes(row.planned_end_time, row.planned_start_time)
 
 			self.update_time_logs(row)
 			return
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
index ac144e2..668e981 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.js
@@ -3,3 +3,31 @@
 
 frappe.ui.form.on('Manufacturing Settings', {
 });
+
+frappe.tour["Manufacturing Settings"] = [
+	{
+		fieldname: "material_consumption",
+		title: __("Allow Multiple Material Consumption"),
+		description: __("If ticked, multiple materials can be used for a single Work Order. This is useful if one or more time consuming products are being manufactured.")
+	},
+	{
+		fieldname: "backflush_raw_materials_based_on",
+		title: __("Backflush Raw Materials"),
+		description: __("The Stock Entry of type 'Manufacture' is known as backflush. Raw materials being consumed to manufacture finished goods is known as backflushing. <br><br> When creating Manufacture Entry, raw-material items are backflushed based on BOM of production item. If you want raw-material items to be backflushed based on Material Transfer entry made against that Work Order instead, then you can set it under this field.")
+	},
+	{
+		fieldname: "default_wip_warehouse",
+		title: __("Work In Progress Warehouse"),
+		description: __("This Warehouse will be auto-updated in the Work In Progress Warehouse field of Work Orders.")
+	},
+	{
+		fieldname: "default_fg_warehouse",
+		title: __("Finished Goods Warehouse"),
+		description: __("This Warehouse will be auto-updated in the Target Warehouse field of Work Order.")
+	},
+	{
+		fieldname: "update_bom_costs_automatically",
+		title: __("Update BOM Cost Automatically"),
+		description: __("If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.")
+	}
+];
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js
index 64c952b..1a64bc5 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.js
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js
@@ -201,9 +201,9 @@
 				title: title,
 				fields: [
 					{
-						"fieldtype": "Table MultiSelect", "label": __("Source Warehouses"),
+						"fieldtype": "Table MultiSelect", "label": __("Source Warehouses (Optional)"),
 						"fieldname": "warehouses", "options": "Production Plan Material Request Warehouse",
-						"description": "System will pickup the materials from the selected warehouses",
+						"description": __("System will pickup the materials from the selected warehouses. If not specified, system will create material request for purchase."),
 						get_query: function () {
 							return {
 								filters: {
diff --git a/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json b/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
index 582aba4..7ef202e 100644
--- a/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
+++ b/erpnext/manufacturing/onboarding_step/explore_manufacturing_settings/explore_manufacturing_settings.json
@@ -1,5 +1,5 @@
 {
- "action": "Update Settings",
+ "action": "Show Form Tour",
  "creation": "2020-05-19 11:55:11.378374",
  "docstatus": 0,
  "doctype": "Onboarding Step",
@@ -8,7 +8,7 @@
  "is_mandatory": 0,
  "is_single": 1,
  "is_skipped": 0,
- "modified": "2020-05-19 12:12:28.145366",
+ "modified": "2020-05-26 20:28:03.558199",
  "modified_by": "Administrator",
  "name": "Explore Manufacturing Settings",
  "owner": "Administrator",
diff --git a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
index 1279011..e7d9265 100644
--- a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
+++ b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
@@ -103,7 +103,7 @@
 		"fieldtype": "Int",
 		"width": 140
 	}, {
-		"label": _("Subassembly BOM Count"),
+		"label": _("Sub-assembly BOM Count"),
 		"fieldname": "used_as_subassembly_items",
 		"fieldtype": "Int",
 		"width": 180
diff --git a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
index 2b2be4f..093309a 100644
--- a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
+++ b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
@@ -24,7 +24,12 @@
 	if filters.get("workstation"):
 		query_filters["workstation"] = filters.get("workstation")
 
-	return frappe.get_all("Downtime Entry", fields= fields, filters=query_filters)
+	data = frappe.get_all("Downtime Entry", fields= fields, filters=query_filters) or []
+	for d in data:
+		if d.downtime:
+			d.downtime = d.downtime / 60
+
+	return data
 
 def get_chart_data(data, columns):
 	labels = sorted(list(set([d.workstation for d in data])))
@@ -44,7 +49,7 @@
 		"data": {
 			"labels": labels,
 			"datasets": [
-				{"name": "Dataset 1", "values": datasets}
+				{"name": "Machine Downtime", "values": datasets}
 			]
 		},
 		"type": "bar"
@@ -88,7 +93,7 @@
 			"width": 160
 		},
 		{
-			"label": _("Downtime (In Mins)"),
+			"label": _("Downtime (In Hours)"),
 			"fieldname": "downtime",
 			"fieldtype": "Float",
 			"width": 150
diff --git a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
index 1b49df6..cac8067 100644
--- a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
+++ b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
@@ -21,8 +21,6 @@
 				if value.get(period.key) and not forecast_data:
 					value[forecast_key] = flt(value.get("avg", 0)) or flt(value.get(period.key))
 
-					# will be use to forecaset next period
-					forecast_data.append([value.get(period.key), value.get(forecast_key)])
 				elif forecast_data:
 					previous_period_data = forecast_data[-1]
 					value[forecast_key] = (previous_period_data[1] +
@@ -31,6 +29,10 @@
 						)
 					)
 
+				if value.get(forecast_key):
+					# will be use to forecaset next period
+					forecast_data.append([value.get(period.key), value.get(forecast_key)])
+
 class ForecastingReport(ExponentialSmoothingForecast):
 	def __init__(self, filters=None):
 		self.filters = frappe._dict(filters or {})
@@ -78,7 +80,9 @@
 			list_of_period_value = [value.get(p.key, 0) for p in self.period_list]
 
 			if list_of_period_value:
-				value["avg"] = sum(list_of_period_value) / len(list_of_period_value)
+				total_qty = [1 for d in list_of_period_value if d]
+				if total_qty:
+					value["avg"] = flt(sum(list_of_period_value)) / flt(sum(total_qty))
 
 	def get_data_for_forecast(self):
 		cond = ""
@@ -152,15 +156,19 @@
 			"width": 130
 		}]
 
-		width = 150 if self.filters.periodicity in ['Yearly', "Half-Yearly", "Quarterly"] else 100
+		width = 180 if self.filters.periodicity in ['Yearly', "Half-Yearly", "Quarterly"] else 100
 		for period in self.period_list:
 			if (self.filters.periodicity in ['Yearly', "Half-Yearly", "Quarterly"]
 				or period.from_date >= getdate(self.filters.from_date)):
 
-				forecast_key = 'forecast_' + period.key
+				forecast_key = period.key
+				label = _(period.label)
+				if period.from_date >= getdate(self.filters.from_date):
+					forecast_key = 'forecast_' + period.key
+					label = _(period.label) + " " + _("(Forecast)")
 
 				columns.append({
-					"label": _(period.label),
+					"label": label,
 					"fieldname": forecast_key,
 					"fieldtype": self.fieldtype,
 					"width": width,
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
index b7e3071..bd68db1 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.js
@@ -13,17 +13,38 @@
 			reqd: 1
 		},
 		{
-			label: __("From Date"),
+			fieldname: "fiscal_year",
+			label: __("Fiscal Year"),
+			fieldtype: "Link",
+			options: "Fiscal Year",
+			default: frappe.defaults.get_user_default("fiscal_year"),
+			reqd: 1,
+			on_change: function(query_report) {
+				var fiscal_year = query_report.get_values().fiscal_year;
+				if (!fiscal_year) {
+					return;
+				}
+				frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+					var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+					frappe.query_report.set_filter_value({
+						from_date: fy.year_start_date,
+						to_date: fy.year_end_date
+					});
+				});
+			}
+		},
+		{
+			label: __("From Posting Date"),
 			fieldname:"from_date",
 			fieldtype: "Date",
-			default: frappe.datetime.add_months(frappe.datetime.get_today(), -12),
+			default: frappe.defaults.get_user_default("year_start_date"),
 			reqd: 1
 		},
 		{
-			label: __("To Date"),
+			label: __("To Posting Date"),
 			fieldname:"to_date",
 			fieldtype: "Date",
-			default: frappe.datetime.get_today(),
+			default: frappe.defaults.get_user_default("year_end_date"),
 			reqd: 1,
 		},
 		{
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
index ae1e4f3..b1bff35 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
@@ -15,9 +15,12 @@
 	return columns, data, None, chart_data
 
 def get_data(filters):
-	query_filters = {"docstatus": ("<", 2)}
+	query_filters = {
+		"docstatus": ("<", 2),
+		"posting_date": ("between", [filters.from_date, filters.to_date])
+	}
 
-	fields = ["name", "status", "work_order", "production_item", "item_name",
+	fields = ["name", "status", "work_order", "production_item", "item_name", "posting_date",
 		"total_completed_qty", "workstation", "operation", "employee_name", "total_time_in_mins"]
 
 	for field in ["work_order", "workstation", "operation", "company"]:
@@ -30,33 +33,42 @@
 	if not data: return []
 
 	job_cards = [d.name for d in data]
+
+	job_card_time_filter = {
+		"docstatus": ("<", 2),
+		"parent": ("in", job_cards),
+	}
+
 	job_card_time_details = {}
 	for job_card_data in frappe.get_all("Job Card Time Log",
 		fields=["min(from_time) as from_time", "max(to_time) as to_time", "parent"],
-		filters={"docstatus": ("<", 2), "parent": ("in", job_cards)}, group_by="parent"):
+		filters=job_card_time_filter, group_by="parent", debug=1):
 		job_card_time_details[job_card_data.parent] = job_card_data
 
+	res = []
 	for d in data:
-		if d.status == "Material Transferred":
+		if d.status != "Completed":
 			d.status = "Open"
 
 		if job_card_time_details.get(d.name):
 			d.from_time = job_card_time_details.get(d.name).from_time
 			d.to_time = job_card_time_details.get(d.name).to_time
 
-	return data
+		res.append(d)
+
+	return res
 
 def get_chart_data(job_card_details, filters):
 	labels, periodic_data = prepare_chart_data(job_card_details, filters)
 
-	pending, completed = [], []
+	open_job_cards, completed = [], []
 	datasets = []
 
 	for d in labels:
-		pending.append(periodic_data.get("Pending").get(d))
+		open_job_cards.append(periodic_data.get("Open").get(d))
 		completed.append(periodic_data.get("Completed").get(d))
 
-	datasets.append({"name": "Pending", "values": pending})
+	datasets.append({"name": "Open", "values": open_job_cards})
 	datasets.append({"name": "Completed", "values": completed})
 
 	chart = {
@@ -73,7 +85,7 @@
 	labels = []
 
 	periodic_data = {
-		"Pending": {},
+		"Open": {},
 		"Completed": {}
 	}
 
@@ -86,10 +98,10 @@
 			labels.append(period)
 
 		for d in job_card_details:
-			if getdate(d.from_time) >= from_date and getdate(d.to_time) <= end_date:
-				status = "Completed" if d.status == "Completed" else "Pending"
+			if getdate(d.posting_date) > from_date and getdate(d.posting_date) <= end_date:
+				status = "Completed" if d.status == "Completed" else "Open"
 
-				if periodic_data.get(status) and periodic_data.get(status).get(period):
+				if periodic_data.get(status).get(period):
 					periodic_data[status][period] += 1
 				else:
 					periodic_data[status][period] = 1
@@ -105,6 +117,12 @@
 			"options": "Job Card",
 			"width": 100
 		},
+		{
+			"label": _("Posting Date"),
+			"fieldname": "posting_date",
+			"fieldtype": "Date",
+			"width": 100
+		},
 	]
 
 	if not filters.get("status"):
diff --git a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
index b5e6c6f..5ac3923 100644
--- a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
+++ b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
@@ -220,6 +220,9 @@
 				if item_details:
 					warehouses = [item_details["default_warehouse"]]
 
+			if self.filters.raw_material_warehouse:
+				warehouses = get_child_warehouses(self.filters.raw_material_warehouse)
+
 			d.remaining_qty = d.required_qty
 			self.pick_materials_from_warehouses(d, data, warehouses)
 
diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.js b/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
index ec9fe35..eb23f17 100644
--- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
+++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.js
@@ -13,17 +13,38 @@
 			reqd: 1
 		},
 		{
-			label: __("From Date"),
+			fieldname: "fiscal_year",
+			label: __("Fiscal Year"),
+			fieldtype: "Link",
+			options: "Fiscal Year",
+			default: frappe.defaults.get_user_default("fiscal_year"),
+			reqd: 1,
+			on_change: function(query_report) {
+				var fiscal_year = query_report.get_values().fiscal_year;
+				if (!fiscal_year) {
+					return;
+				}
+				frappe.model.with_doc("Fiscal Year", fiscal_year, function(r) {
+					var fy = frappe.model.get_doc("Fiscal Year", fiscal_year);
+					frappe.query_report.set_filter_value({
+						from_date: fy.year_start_date,
+						to_date: fy.year_end_date
+					});
+				});
+			}
+		},
+		{
+			label: __("From Posting Date"),
 			fieldname:"from_date",
 			fieldtype: "Date",
-			default: frappe.datetime.add_months(frappe.datetime.get_today(), -12),
+			default: frappe.defaults.get_user_default("year_start_date"),
 			reqd: 1
 		},
 		{
-			label: __("To Date"),
+			label: __("To Posting Date"),
 			fieldname:"to_date",
 			fieldtype: "Date",
-			default: frappe.datetime.get_today(),
+			default: frappe.defaults.get_user_default("year_end_date"),
 			reqd: 1,
 		},
 		{
diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
index bc09ed4..fb047b2 100644
--- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
+++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
@@ -56,7 +56,7 @@
 		return get_chart_based_on_qty(data, filters)
 
 def get_chart_based_on_status(data):
-	labels = ["Not Started", "In Process", "Stopped", "Completed"]
+	labels = ["Completed", "In Process", "Stopped", "Not Started"]
 
 	status_wise_data = {
 		"Not Started": 0,
@@ -66,13 +66,10 @@
 	}
 
 	for d in data:
-		if d.status == "In Process" and d.produced_qty:
-			status_wise_data["Completed"] += d.produced_qty
+		status_wise_data[d.status] += 1
 
-		status_wise_data[d.status] += d.qty
-
-	values = [status_wise_data["Not Started"], status_wise_data["In Process"],
-		status_wise_data["Stopped"], status_wise_data["Completed"]]
+	values = [status_wise_data["Completed"], status_wise_data["In Process"],
+		status_wise_data["Stopped"], status_wise_data["Not Started"]]
 
 	chart = {
 		"data": {
diff --git a/erpnext/non_profit/doctype/membership/membership.py b/erpnext/non_profit/doctype/membership/membership.py
index 5a69cdb..df19995 100644
--- a/erpnext/non_profit/doctype/membership/membership.py
+++ b/erpnext/non_profit/doctype/membership/membership.py
@@ -65,7 +65,9 @@
 	return frappe.get_doc("Member", members[0]['name'])
 
 @frappe.whitelist(allow_guest=True)
-def trigger_razorpay_subscription(data):
+def trigger_razorpay_subscription(*args, **kwargs):
+	data = frappe.request.get_data()
+
 	if isinstance(data, six.string_types):
 		data = json.loads(data)
 	data = frappe._dict(data)
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index af7cb8e..b0421f4 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -678,16 +678,20 @@
 erpnext.patches.v12_0.fix_quotation_expired_status
 erpnext.patches.v12_0.update_appointment_reminder_scheduler_entry
 erpnext.patches.v12_0.retain_permission_rules_for_video_doctype
-erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries
+erpnext.patches.v12_0.remove_duplicate_leave_ledger_entries #2020-05-22
 erpnext.patches.v13_0.patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive
 execute:frappe.delete_doc_if_exists("Page", "appointment-analytic")
 execute:frappe.rename_doc("Desk Page", "Getting Started", "Home", force=True)
 erpnext.patches.v12_0.unset_customer_supplier_based_on_type_of_item_price
 erpnext.patches.v12_0.set_valid_till_date_in_supplier_quotation
-erpnext.patches.v12_0.set_serial_no_status
+erpnext.patches.v12_0.set_serial_no_status #2020-05-21
 erpnext.patches.v12_0.update_price_list_currency_in_bom
 execute:frappe.delete_doc_if_exists('Dashboard', 'Accounts')
 erpnext.patches.v13_0.update_actual_start_and_end_date_in_wo
-erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes
+erpnext.patches.v13_0.set_company_field_in_healthcare_doctypes #2020-05-25
 erpnext.patches.v12_0.update_bom_in_so_mr
 execute:frappe.delete_doc("Report", "Department Analytics")
+execute:frappe.rename_doc("Desk Page", "Loan Management", "Loan", force=True)
+erpnext.patches.v12_0.update_uom_conversion_factor
+erpnext.patches.v13_0.delete_old_purchase_reports
+erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
index 6353304..24286dc 100644
--- a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
+++ b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
@@ -6,6 +6,7 @@
 
 def execute():
 	"""Delete duplicate leave ledger entries of type allocation created."""
+	frappe.reload_doc('hr', 'doctype', 'leave_ledger_entry')
 	if not frappe.db.a_row_exists("Leave Ledger Entry"):
 		return
 
@@ -14,31 +15,32 @@
 
 def get_duplicate_records():
 	"""Fetch all but one duplicate records from the list of expired leave allocation."""
-	return frappe.db.sql_list("""
-		WITH duplicate_records AS
-		(SELECT
-			name, transaction_name, is_carry_forward,
-			ROW_NUMBER() over(partition by transaction_name order by creation)as row
-		FROM `tabLeave Ledger Entry` l
-		WHERE (EXISTS
-			(SELECT name
-				FROM `tabLeave Ledger Entry`
-				WHERE
-					transaction_name = l.transaction_name
-					AND transaction_type = 'Leave Allocation'
-					AND name <> l.name
-					AND employee = l.employee
-					AND docstatus = 1
-					AND leave_type = l.leave_type
-					AND is_carry_forward=l.is_carry_forward
-					AND to_date = l.to_date
-					AND from_date = l.from_date
-					AND is_expired = 1
-		)))
-		SELECT name FROM duplicate_records WHERE row > 1
+	return frappe.db.sql("""
+		SELECT name, employee, transaction_name, leave_type, is_carry_forward, from_date, to_date
+		FROM `tabLeave Ledger Entry`
+		WHERE
+			transaction_type = 'Leave Allocation'
+			AND docstatus = 1
+			AND is_expired = 1
+		GROUP BY
+			employee, transaction_name, leave_type, is_carry_forward, from_date, to_date
+		HAVING
+			count(name) > 1
+		ORDER BY
+			creation
 	""")
 
 def delete_duplicate_ledger_entries(duplicate_records_list):
 	"""Delete duplicate leave ledger entries."""
 	if not duplicate_records_list: return
-	frappe.db.sql('''DELETE FROM `tabLeave Ledger Entry` WHERE name in %s''', ((tuple(duplicate_records_list)), ))
\ No newline at end of file
+	for d in duplicate_records_list:
+		frappe.db.sql('''
+			DELETE FROM `tabLeave Ledger Entry`
+			WHERE name != %s
+				AND employee = %s
+				AND transaction_name = %s
+				AND leave_type = %s
+				AND is_carry_forward = %s
+				AND from_date = %s
+				AND to_date = %s
+		''', tuple(d))
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
new file mode 100644
index 0000000..a6011c4
--- /dev/null
+++ b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.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
+from erpnext.regional.italy.setup import add_permissions
+
+def execute():
+	countries = frappe.get_all("Company", fields="country")
+	countries = [country["country"] for country in countries]
+	if "Italy" in countries:
+		add_permissions()
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/set_serial_no_status.py b/erpnext/patches/v12_0/set_serial_no_status.py
index abba37d..3b5f5ef 100644
--- a/erpnext/patches/v12_0/set_serial_no_status.py
+++ b/erpnext/patches/v12_0/set_serial_no_status.py
@@ -5,7 +5,7 @@
 def execute():
 	frappe.reload_doc('stock', 'doctype', 'serial_no')
 
-	serial_no_list = frappe.db.sql("""select name, delivery_document_type, warranty_expiry_date from `tabSerial No`
+	serial_no_list = frappe.db.sql("""select name, delivery_document_type, warranty_expiry_date, warehouse from `tabSerial No`
 		where (status is NULL OR status='')""", as_dict = 1)
 	if len(serial_no_list) > 20000:
 		frappe.db.auto_commit_on_many_writes = True
@@ -15,6 +15,8 @@
 			status = "Delivered"
 		elif serial_no.get("warranty_expiry_date") and getdate(serial_no.get("warranty_expiry_date")) <= getdate(nowdate()):
 			status = "Expired"
+		elif not serial_no.get("warehouse"):
+			status = "Inactive"
 		else:
 			status = "Active"
 
diff --git a/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py b/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
index 60aec05..b8efb21 100644
--- a/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
+++ b/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
@@ -1,15 +1,29 @@
 from __future__ import unicode_literals
 import frappe
 
+
 def execute():
-    invalid_selling_item_price = frappe.db.sql(
-        """SELECT name FROM `tabItem Price` WHERE selling = 1 and buying = 0 and (supplier IS NOT NULL or supplier = '')"""
-    )
-    invalid_buying_item_price = frappe.db.sql(
-        """SELECT name FROM `tabItem Price` WHERE selling = 0 and buying = 1 and (customer IS NOT NULL or customer = '')"""
-    )
-    docs_to_modify = invalid_buying_item_price + invalid_selling_item_price
-    for d in docs_to_modify:
-        # saving the doc will auto reset invalid customer/supplier field
-        doc = frappe.get_doc("Item Price", d[0])
-        doc.save()
\ No newline at end of file
+    """
+    set proper customer and supplier details for item price
+    based on selling and buying values
+    """
+
+    # update for selling
+    frappe.db.sql(
+        """UPDATE `tabItem Price` ip, `tabPrice List` pl
+        SET ip.`reference` = ip.`customer`, ip.`supplier` = NULL
+        WHERE ip.`selling` = 1
+        AND ip.`buying` = 0
+        AND (ip.`supplier` IS NOT NULL OR ip.`supplier` = '')
+        AND ip.`price_list` = pl.`name`
+        AND pl.`enabled` = 1""")
+
+    # update for buying
+    frappe.db.sql(
+        """UPDATE `tabItem Price` ip, `tabPrice List` pl
+        SET ip.`reference` = ip.`supplier`, ip.`customer` = NULL
+        WHERE ip.`selling` = 0
+        AND ip.`buying` = 1
+        AND (ip.`customer` IS NOT NULL OR ip.`customer` = '')
+        AND ip.`price_list` = pl.`name`
+        AND pl.`enabled` = 1""")
diff --git a/erpnext/patches/v12_0/update_uom_conversion_factor.py b/erpnext/patches/v12_0/update_uom_conversion_factor.py
new file mode 100644
index 0000000..b5a20aa
--- /dev/null
+++ b/erpnext/patches/v12_0/update_uom_conversion_factor.py
@@ -0,0 +1,11 @@
+from __future__ import unicode_literals
+import frappe, json
+
+def execute():
+	from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data
+
+	frappe.reload_doc("setup", "doctype", "UOM Conversion Factor")
+	frappe.reload_doc("setup", "doctype", "UOM")
+	frappe.reload_doc("stock", "doctype", "UOM Category")
+
+	add_uom_data()
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/delete_old_purchase_reports.py b/erpnext/patches/v13_0/delete_old_purchase_reports.py
new file mode 100644
index 0000000..8271d2e
--- /dev/null
+++ b/erpnext/patches/v13_0/delete_old_purchase_reports.py
@@ -0,0 +1,15 @@
+# Copyright (c) 2019, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+import frappe
+
+def execute():
+	reports_to_delete = ["Requested Items To Be Ordered",
+		"Purchase Order Items To Be Received or Billed","Purchase Order Items To Be Received",
+		"Purchase Order Items To Be Billed"]
+
+	for report in reports_to_delete:
+		if frappe.db.exists("Report", report):
+			frappe.delete_doc("Report", report)
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
index 9d0dae4..a7d4c66 100644
--- a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
+++ b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
@@ -3,8 +3,8 @@
 
 def execute():
 	company = frappe.db.get_single_value('Global Defaults', 'default_company')
-	doctypes = ['Clinical Procedure', 'Inpatient Record', 'Lab Test', 'Patient Appointment', 'Patient Encounter', 'Vital Signs']
+	doctypes = ['Clinical Procedure', 'Inpatient Record', 'Lab Test', 'Sample Collection' 'Patient Appointment', 'Patient Encounter', 'Vital Signs', 'Therapy Session', 'Therapy Plan', 'Patient Assessment']
 	for entry in doctypes:
 		if frappe.db.exists('DocType', entry):
-			frappe.reload_doc("Healthcare", "doctype", entry)
+			frappe.reload_doc('Healthcare', 'doctype', entry)
 			frappe.db.sql("update `tab{dt}` set company = '{company}' where ifnull(company, '') = ''".format(dt=entry, company=company))
diff --git a/erpnext/patches/v7_0/update_mins_to_first_response.py b/erpnext/patches/v7_0/update_mins_to_first_response.py
index 1df4b42..1668135 100644
--- a/erpnext/patches/v7_0/update_mins_to_first_response.py
+++ b/erpnext/patches/v7_0/update_mins_to_first_response.py
@@ -1,7 +1,7 @@
 from __future__ import unicode_literals
 import frappe
 
-from frappe.core.doctype.communication.email import update_mins_to_first_communication
+from frappe.core.doctype.communication.communication import update_mins_to_first_communication
 
 def execute():
 	frappe.reload_doctype('Issue')
diff --git a/erpnext/projects/report/project_summary/project_summary.js b/erpnext/projects/report/project_summary/project_summary.js
index 15367ac..414b7b2 100644
--- a/erpnext/projects/report/project_summary/project_summary.js
+++ b/erpnext/projects/report/project_summary/project_summary.js
@@ -13,11 +13,30 @@
 			"reqd": 1
 		},
 		{
+			"fieldname": "is_active",
+			"label": __("Is Active"),
+			"fieldtype": "Select",
+			"options": "\nYes\nNo",
+			"default": "Yes",
+		},
+		{
 			"fieldname": "status",
 			"label": __("Status"),
 			"fieldtype": "Select",
-			"options": "Open\nComplete\nCancelled",
+			"options": "\nOpen\nCompleted\nCancelled",
 			"default": "Open"
+		},
+		{
+			"fieldname": "project_type",
+			"label": __("Project Type"),
+			"fieldtype": "Link",
+			"options": "Project Type"
+		},
+		{
+			"fieldname": "priority",
+			"label": __("Priority"),
+			"fieldtype": "Select",
+			"options": "\nLow\nMedium\nHigh"
 		}
 	]
 };
diff --git a/erpnext/projects/report/project_summary/project_summary.py b/erpnext/projects/report/project_summary/project_summary.py
index a20d7f2..ea7f1ab 100644
--- a/erpnext/projects/report/project_summary/project_summary.py
+++ b/erpnext/projects/report/project_summary/project_summary.py
@@ -9,7 +9,7 @@
 	columns = get_columns()
 	data = []
 
-	data = frappe.db.get_all("Project", filters=filters, fields=["name", 'status', "percent_complete", "expected_start_date", "expected_end_date"], order_by="expected_end_date")
+	data = frappe.db.get_all("Project", filters=filters, fields=["name", 'status', "percent_complete", "expected_start_date", "expected_end_date", "project_type"], order_by="expected_end_date")
 
 	for project in data:
 		project["total_tasks"] = frappe.db.count("Task", filters={"project": project.name})
@@ -31,6 +31,13 @@
 			"width": 200
 		},
 		{
+			"fieldname": "project_type",
+			"label": _("Type"),
+			"fieldtype": "Link",
+			"options": "Project Type",
+			"width": 120
+		},
+		{
 			"fieldname": "status",
 			"label": _("Status"),
 			"fieldtype": "Data",
@@ -88,19 +95,19 @@
 
 	return {
 		"data": {
-			'labels': labels,
+			'labels': labels[:30],
 			'datasets': [
 				{
 					"name": "Overdue",
-					"values": overdue
+					"values": overdue[:30]
 				},
 				{
 					"name": "Completed",
-					"values": completed
+					"values": completed[:30]
 				},
 				{
 					"name": "Total Tasks",
-					"values": total
+					"values": total[:30]
 				},
 			]
 		},
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index e94d1ff..2695502 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -23,8 +23,6 @@
 		"public/js/queries.js",
 		"public/js/sms_manager.js",
 		"public/js/utils/party.js",
-		"public/js/templates/address_list.html",
-		"public/js/templates/contact_list.html",
 		"public/js/controllers/stock_controller.js",
 		"public/js/payment/payments.js",
 		"public/js/controllers/taxes_and_totals.js",
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 28c2102..524a958 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1652,8 +1652,10 @@
 					if(!r.exc) {
 						$.each(me.frm.doc.items || [], function(i, item) {
 							if(item.item_code && r.message.hasOwnProperty(item.item_code)) {
-								item.item_tax_template = r.message[item.item_code].item_tax_template;
-								item.item_tax_rate = r.message[item.item_code].item_tax_rate;
+								if (!item.item_tax_template) {
+									item.item_tax_template = r.message[item.item_code].item_tax_template;
+									item.item_tax_rate = r.message[item.item_code].item_tax_rate;
+								}
 								me.add_taxes_from_item_tax_template(item.item_tax_rate);
 							} else {
 								item.item_tax_template = "";
@@ -1709,7 +1711,7 @@
 	},
 
 	set_gross_profit: function(item) {
-		if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) {
+		if (["Sales Order", "Quotation"].includes(this.frm.doc.doctype) && item.valuation_rate) {
 			var rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1);
 			item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item));
 		}
diff --git a/erpnext/public/js/financial_statements.js b/erpnext/public/js/financial_statements.js
index 296c628..cf98b75 100644
--- a/erpnext/public/js/financial_statements.js
+++ b/erpnext/public/js/financial_statements.js
@@ -62,7 +62,7 @@
 	}
 };
 
-function get_filters(){
+function get_filters() {
 	let filters = [
 		{
 			"fieldname":"company",
@@ -162,15 +162,6 @@
 		}
 	]
 
-	erpnext.dimension_filters.forEach((dimension) => {
-		filters.push({
-			"fieldname": dimension["fieldname"],
-			"label": __(dimension["label"]),
-			"fieldtype": "Link",
-			"options": dimension["document_type"]
-		});
-	});
-
 	return filters;
 }
 
diff --git a/erpnext/public/js/templates/address_list.html b/erpnext/public/js/templates/address_list.html
deleted file mode 100644
index 0f967b6..0000000
--- a/erpnext/public/js/templates/address_list.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<div class="clearfix"></div>
-{% for(var i=0, l=addr_list.length; i<l; i++) { %}
-<div class="address-box">
-	<p class="h6">
-		{%= i+1 %}. {%= addr_list[i].address_title %}{% if(addr_list[i].address_type!="Other") { %}
-		<span class="text-muted">({%= __(addr_list[i].address_type) %})</span>{% } %}
-		{% if(addr_list[i].is_primary_address) { %}
-		<span class="text-muted">({%= __("Primary") %})</span>{% } %}
-		{% if(addr_list[i].is_shipping_address) { %}
-		<span class="text-muted">({%= __("Shipping") %})</span>{% } %}
-
-		<a href="#Form/Address/{%= encodeURIComponent(addr_list[i].name) %}" class="btn btn-default btn-xs pull-right"
-			style="margin-top:-3px; margin-right: -5px;">
-			{%= __("Edit") %}</a>
-	</p>
-	<p>{%= addr_list[i].display %}</p>
-</div>
-{% } %}
-{% if(!addr_list.length) { %}
-<p class="text-muted small">{%= __("No address added yet.") %}</p>
-{% } %}
-<p><button class="btn btn-xs btn-default btn-address">{{ __("New Address") }}</button></p>
\ No newline at end of file
diff --git a/erpnext/public/js/templates/contact_list.html b/erpnext/public/js/templates/contact_list.html
deleted file mode 100644
index 7e69691..0000000
--- a/erpnext/public/js/templates/contact_list.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<div class="clearfix"></div>
-{% for(var i=0, l=contact_list.length; i<l; i++) { %}
-	<div class="address-box">
-		<p class="h6">
-			{%= contact_list[i].first_name %} {%= contact_list[i].last_name %}
-			{% if(contact_list[i].is_primary_contact) { %}
-				<span class="text-muted">({%= __("Primary") %})</span>
-			{% } %}
-			{% if(contact_list[i].designation){ %}
-			 <span class="text-muted">&ndash; {%= contact_list[i].designation %}</span>
-			{% } %}
-			<a href="#Form/Contact/{%= encodeURIComponent(contact_list[i].name) %}"
-				class="btn btn-xs btn-default pull-right"
-				style="margin-top:-3px; margin-right: -5px;">
-				{%= __("Edit") %}</a>
-		</p>
-		{% if (contact_list[i].phones || contact_list[i].email_ids) { %}
-		<p>
-			{% if(contact_list[i].phone) { %}
-				{%= __("Phone") %}: {%= contact_list[i].phone %}<span class="text-muted"> ({%= __("Primary") %})</span><br>
-			{% endif %}
-			{% if(contact_list[i].mobile_no) { %}
-				{%= __("Mobile No") %}: {%= contact_list[i].mobile_no %}<span class="text-muted"> ({%= __("Primary") %})</span><br>
-			{% endif %}
-			{% if(contact_list[i].phone_nos) { %}
-				{% for(var j=0, k=contact_list[i].phone_nos.length; j<k; j++) { %}
-					{%= __("Phone") %}: {%= contact_list[i].phone_nos[j].phone %}<br>
-				{% } %}
-			{% endif %}
-		</p>
-		<p>
-			{% if(contact_list[i].email_id) { %}
-				{%= __("Email") %}: {%= contact_list[i].email_id %}<span class="text-muted"> ({%= __("Primary") %})</span><br>
-			{% endif %}
-			{% if(contact_list[i].email_ids) { %}
-				{% for(var j=0, k=contact_list[i].email_ids.length; j<k; j++) { %}
-					{%= __("Email") %}: {%= contact_list[i].email_ids[j].email_id %}<br>
-				{% } %}
-			{% endif %}
-		</p>
-		{% endif %}
-		<p>
-		{% if (contact_list[i].address) { %}
-			{%= __("Address") %}: {%= contact_list[i].address %}<br>
-		{% endif %}
-		</p>
-	</div>
-{% } %}
-{% if(!contact_list.length) { %}
-<p class="text-muted small">{%= __("No contacts added yet.") %}</p>
-{% } %}
-<p><button class="btn btn-xs btn-default btn-contact">
-	{{ __("New Contact") }}</button>
-</p>
\ No newline at end of file
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 58969f2..2cd79b5 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -191,6 +191,23 @@
 		})
 	},
 
+	add_dimensions: function(report_name, index) {
+		let filters = frappe.query_reports[report_name].filters;
+
+		erpnext.dimension_filters.forEach((dimension) => {
+			let found = filters.some(el => el.fieldname === dimension['fieldname']);
+
+			if (!found) {
+				filters.splice(index, 0 ,{
+					"fieldname": dimension["fieldname"],
+					"label": __(dimension["label"]),
+					"fieldtype": "Link",
+					"options": dimension["document_type"]
+				});
+			}
+		});
+	},
+
 	make_subscription: function(doctype, docname) {
 		frappe.call({
 			method: "frappe.automation.doctype.auto_repeat.auto_repeat.make_auto_repeat",
diff --git a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.json b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.json
index 59e955c..c1680c4 100644
--- a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.json
+++ b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.json
@@ -1,5 +1,4 @@
 {
- "actions": [],
  "creation": "2019-10-15 12:33:21.845329",
  "doctype": "DocType",
  "editable_grid": 1,
@@ -92,8 +91,7 @@
    "label": "Upload XML Invoices"
   }
  ],
- "links": [],
- "modified": "2019-12-10 16:37:26.793398",
+ "modified": "2020-05-25 21:32:49.064579",
  "modified_by": "Administrator",
  "module": "Regional",
  "name": "Import Supplier Invoice",
diff --git a/erpnext/regional/italy/setup.py b/erpnext/regional/italy/setup.py
index 2d0ad66..6ab7341 100644
--- a/erpnext/regional/italy/setup.py
+++ b/erpnext/regional/italy/setup.py
@@ -7,11 +7,13 @@
 import frappe
 from frappe import _
 from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+from frappe.permissions import add_permission, update_permission_property
 from erpnext.regional.italy import fiscal_regimes, tax_exemption_reasons, mode_of_payment_codes, vat_collectability_options
 
 def setup(company=None, patch=True):
 	make_custom_fields()
 	setup_report()
+	add_permissions()
 
 def make_custom_fields(update=True):
 	invoice_item_fields = [
@@ -200,3 +202,21 @@
 				dict(role='Accounts Manager')
 			]
 		)).insert()
+
+def add_permissions():
+	doctype = 'Import Supplier Invoice'
+	add_permission(doctype, 'All', 0)
+
+	for role in ('Accounts Manager', 'Accounts User','Purchase User', 'Auditor'):
+		add_permission(doctype, role, 0)
+		update_permission_property(doctype, role, 0, 'print', 1)
+		update_permission_property(doctype, role, 0, 'report', 1)
+
+		if role in ('Accounts Manager', 'Accounts User'):
+			update_permission_property(doctype, role, 0, 'write', 1)
+			update_permission_property(doctype, role, 0, 'create', 1)
+
+	update_permission_property(doctype, 'Accounts Manager', 0, 'delete', 1)
+	add_permission(doctype, 'Accounts Manager', 1)
+	update_permission_property(doctype, 'Accounts Manager', 1, 'write', 1)
+	update_permission_property(doctype, 'Accounts Manager', 1, 'create', 1)
\ No newline at end of file
diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py
index a01c6ce..772bbf5 100644
--- a/erpnext/regional/united_arab_emirates/utils.py
+++ b/erpnext/regional/united_arab_emirates/utils.py
@@ -1,6 +1,8 @@
 from __future__ import unicode_literals
+import frappe
 from frappe.utils import flt
 from erpnext.controllers.taxes_and_totals import get_itemised_tax
+from six import iteritems
 
 def update_itemised_tax_data(doc):
 	if not doc.taxes: return
@@ -9,7 +11,14 @@
 
 	for row in doc.items:
 		tax_rate = 0.0
-		if itemised_tax.get(row.item_code):
+		item_tax_rate = frappe.parse_json(row.item_tax_rate)
+
+		# First check if tax rate is present
+		# If not then look up in item_wise_tax_detail
+		if item_tax_rate:
+			for account, rate in iteritems(item_tax_rate):
+				tax_rate += rate
+		elif itemised_tax.get(row.item_code):
 			tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
 
 		row.tax_rate = flt(tax_rate, row.precision("tax_rate"))
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 7cfec5a..0e771c3 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -197,9 +197,9 @@
 	cond = "qo.docstatus = 1 and qo.status != 'Expired' and qo.valid_till < %s"
 	# check if those QUO have SO against it
 	so_against_quo = """
-		SELECT 
+		SELECT
 			so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
-		WHERE 
+		WHERE
 			so_item.docstatus = 1 and so.docstatus = 1
 			and so_item.parent = so.name
 			and so_item.prevdoc_docname = qo.name"""
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index d50397c..59ae7b2 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -48,6 +48,10 @@
   "base_net_amount",
   "pricing_rules",
   "is_free_item",
+  "section_break_43",
+  "valuation_rate",
+  "column_break_45",
+  "gross_profit",
   "item_weight_details",
   "weight_per_unit",
   "total_weight",
@@ -602,12 +606,40 @@
    "label": "Against Blanket Order",
    "no_copy": 1,
    "print_hide": 1
+  },
+  {
+   "fieldname": "section_break_43",
+   "fieldtype": "Section Break"
+  },
+  {
+   "fieldname": "valuation_rate",
+   "fieldtype": "Currency",
+   "label": "Valuation Rate",
+   "no_copy": 1,
+   "options": "Company:company:default_currency",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 1
+  },
+  {
+   "fieldname": "column_break_45",
+   "fieldtype": "Column Break"
+  },
+  {
+   "fieldname": "gross_profit",
+   "fieldtype": "Currency",
+   "label": "Gross Profit",
+   "no_copy": 1,
+   "options": "Company:company:default_currency",
+   "print_hide": 1,
+   "read_only": 1,
+   "report_hide": 1
   }
  ],
  "idx": 1,
  "istable": 1,
  "links": [],
- "modified": "2020-03-30 18:40:28.782720",
+ "modified": "2020-05-19 20:48:43.222229",
  "modified_by": "Administrator",
  "module": "Selling",
  "name": "Quotation Item",
diff --git a/erpnext/setup/setup_wizard/data/uom_conversion_data.json b/erpnext/setup/setup_wizard/data/uom_conversion_data.json
index 174ecd5..27a917d 100644
--- a/erpnext/setup/setup_wizard/data/uom_conversion_data.json
+++ b/erpnext/setup/setup_wizard/data/uom_conversion_data.json
@@ -1571,5 +1571,19 @@
 		"to_uom": "Parts Per Million",
 		"abbr": "ppm",
 		"value": "10000"
+	},
+	{
+		"category": "Mass",
+		"from_uom": "Pound",
+		"to_uom": "Ounce",
+		"abbr": "oz",
+		"value": "16"
+	},
+	{
+		"category": "Mass",
+		"from_uom": "Gram",
+		"to_uom": "Ounce",
+		"abbr": "oz",
+		"value": "0.035274"
 	}
 ]
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index 8bb0a05..0d70d91 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -336,13 +336,14 @@
 				"category_name": _(d.get("category"))
 			}).insert(ignore_permissions=True)
 
-		uom_conversion = frappe.get_doc({
-			"doctype": "UOM Conversion Factor",
-			"category": _(d.get("category")),
-			"from_uom": _(d.get("from_uom")),
-			"to_uom": _(d.get("to_uom")),
-			"value": d.get("value")
-		}).insert(ignore_permissions=True)
+		if not frappe.db.exists("UOM Conversion Factor", {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))}):
+			uom_conversion = frappe.get_doc({
+				"doctype": "UOM Conversion Factor",
+				"category": _(d.get("category")),
+				"from_uom": _(d.get("from_uom")),
+				"to_uom": _(d.get("to_uom")),
+				"value": d.get("value")
+			}).insert(ignore_permissions=True)
 
 def add_market_segments():
 	records = [
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 4ac546e..d04c8c2 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -319,7 +319,7 @@
 def set_price_list_and_rate(quotation, cart_settings):
 	"""set price list based on billing territory"""
 
-	_set_price_list(quotation, cart_settings)
+	_set_price_list(cart_settings, quotation)
 
 	# reset values
 	quotation.price_list_currency = quotation.currency = \
@@ -334,23 +334,28 @@
 		# set it in cookies for using in product page
 		frappe.local.cookie_manager.set_cookie("selling_price_list", quotation.selling_price_list)
 
-def _set_price_list(quotation, cart_settings):
+def _set_price_list(cart_settings, quotation=None):
 	"""Set price list based on customer or shopping cart default"""
 	from erpnext.accounts.party import get_default_price_list
 
 	# check if customer price list exists
 	selling_price_list = None
-	if quotation.party_name:
-		selling_price_list = frappe.db.get_value('Customer', quotation.party_name, 'default_price_list')
+	if quotation and quotation.get("party_name"):
+		selling_price_list = frappe.db.get_value('Customer', quotation.get("party_name"), 'default_price_list')
 
 	# else check for territory based price list
 	if not selling_price_list:
 		selling_price_list = cart_settings.price_list
 
-	if not selling_price_list and quotation.party_name:
-		selling_price_list = get_default_price_list(frappe.get_doc("Customer", quotation.party_name))
+	party_name = quotation.get("party_name") if quotation else get_party().get("name")
 
-	quotation.selling_price_list = selling_price_list
+	if not selling_price_list and party_name:
+		selling_price_list = get_default_price_list(frappe.get_doc("Customer", party_name))
+
+	if quotation:
+		quotation.selling_price_list = selling_price_list
+
+	return selling_price_list
 
 def set_taxes(quotation, cart_settings):
 	"""set taxes based on billing territory"""
diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py
index 21ee335..7c08f5b 100644
--- a/erpnext/shopping_cart/product_info.py
+++ b/erpnext/shopping_cart/product_info.py
@@ -4,7 +4,7 @@
 from __future__ import unicode_literals
 
 import frappe
-from erpnext.shopping_cart.cart import _get_cart_quotation
+from erpnext.shopping_cart.cart import _get_cart_quotation, _set_price_list
 from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \
 	import get_shopping_cart_settings, show_quantity_in_website
 from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
@@ -21,9 +21,11 @@
 	if not skip_quotation_creation:
 		cart_quotation = _get_cart_quotation()
 
+	selling_price_list = cart_quotation.get("selling_price_list") if cart_quotation else _set_price_list(cart_settings, None)
+
 	price = get_price(
 		item_code,
-		cart_quotation.selling_price_list,
+		selling_price_list,
 		cart_settings.default_customer_group,
 		cart_settings.company
 	)
@@ -42,7 +44,7 @@
 
 	if product_info["price"]:
 		if frappe.session.user != "Guest":
-			item = cart_quotation.get({"item_code": item_code})
+			item = cart_quotation.get({"item_code": item_code}) if cart_quotation else None
 			if item:
 				product_info["qty"] = item[0].qty
 
diff --git a/erpnext/stock/desk_page/stock/stock.json b/erpnext/stock/desk_page/stock/stock.json
index 4506664..9404292 100644
--- a/erpnext/stock/desk_page/stock/stock.json
+++ b/erpnext/stock/desk_page/stock/stock.json
@@ -33,7 +33,7 @@
   {
    "hidden": 0,
    "label": "Key Reports",
-   "links": "[\n    {\n        \"dependencies\": [\n            \"Item Price\"\n        ],\n        \"doctype\": \"Item Price\",\n        \"is_query_report\": false,\n        \"label\": \"Item-wise Price List Rate\",\n        \"name\": \"Item-wise Price List Rate\",\n        \"onboard\": 1,\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Stock Entry\"\n        ],\n        \"doctype\": \"Stock Entry\",\n        \"is_query_report\": true,\n        \"label\": \"Stock Analytics\",\n        \"name\": \"Stock Analytics\",\n        \"onboard\": 1,\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Delivery Note\"\n        ],\n        \"doctype\": \"Delivery Note\",\n        \"is_query_report\": true,\n        \"label\": \"Delivery Note Trends\",\n        \"name\": \"Delivery Note Trends\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Receipt\"\n        ],\n        \"doctype\": \"Purchase Receipt\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Receipt Trends\",\n        \"name\": \"Purchase Receipt Trends\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Delivery Note\"\n        ],\n        \"doctype\": \"Delivery Note\",\n        \"is_query_report\": true,\n        \"label\": \"Ordered Items To Be Delivered\",\n        \"name\": \"Ordered Items To Be Delivered\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Receipt\"\n        ],\n        \"doctype\": \"Purchase Receipt\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Order Items To Be Received\",\n        \"name\": \"Purchase Order Items To Be Received\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Bin\"\n        ],\n        \"doctype\": \"Bin\",\n        \"is_query_report\": true,\n        \"label\": \"Item Shortage Report\",\n        \"name\": \"Item Shortage Report\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Batch\"\n        ],\n        \"doctype\": \"Batch\",\n        \"is_query_report\": true,\n        \"label\": \"Batch-Wise Balance History\",\n        \"name\": \"Batch-Wise Balance History\",\n        \"type\": \"report\"\n    }\n]"
+   "links": "[\n    {\n        \"dependencies\": [\n            \"Item Price\"\n        ],\n        \"doctype\": \"Item Price\",\n        \"is_query_report\": false,\n        \"label\": \"Item-wise Price List Rate\",\n        \"name\": \"Item-wise Price List Rate\",\n        \"onboard\": 1,\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Stock Entry\"\n        ],\n        \"doctype\": \"Stock Entry\",\n        \"is_query_report\": true,\n        \"label\": \"Stock Analytics\",\n        \"name\": \"Stock Analytics\",\n        \"onboard\": 1,\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Delivery Note\"\n        ],\n        \"doctype\": \"Delivery Note\",\n        \"is_query_report\": true,\n        \"label\": \"Delivery Note Trends\",\n        \"name\": \"Delivery Note Trends\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Purchase Receipt\"\n        ],\n        \"doctype\": \"Purchase Receipt\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Receipt Trends\",\n        \"name\": \"Purchase Receipt Trends\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Delivery Note\"\n        ],\n        \"doctype\": \"Delivery Note\",\n        \"is_query_report\": true,\n        \"label\": \"Ordered Items To Be Delivered\",\n        \"name\": \"Ordered Items To Be Delivered\",\n        \"type\": \"report\"\n    },\n   {\n         \"dependencies\": [\n            \"Purchase Order\"\n        ],\n        \"doctype\": \"Purchase Order\",\n        \"is_query_report\": true,\n        \"label\": \"Purchase Order Analysis\",\n        \"name\": \"Purchase Order Analysis\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Bin\"\n        ],\n        \"doctype\": \"Bin\",\n        \"is_query_report\": true,\n        \"label\": \"Item Shortage Report\",\n        \"name\": \"Item Shortage Report\",\n        \"type\": \"report\"\n    },\n    {\n        \"dependencies\": [\n            \"Batch\"\n        ],\n        \"doctype\": \"Batch\",\n        \"is_query_report\": true,\n        \"label\": \"Batch-Wise Balance History\",\n        \"name\": \"Batch-Wise Balance History\",\n        \"type\": \"report\"\n    }\n]"
   },
   {
    "hidden": 0,
@@ -58,7 +58,7 @@
  "idx": 0,
  "is_standard": 1,
  "label": "Stock",
- "modified": "2020-05-19 17:36:08.185652",
+ "modified": "2020-05-27 20:38:25.255323",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Stock",
@@ -69,7 +69,7 @@
  "shortcuts": [
   {
    "color": "#cef6d1",
-   "format": "{}  available",
+   "format": "{}  Available",
    "label": "Item",
    "link_to": "Item",
    "stats_filter": "{\n    \"disabled\" : 0\n}",
@@ -90,7 +90,7 @@
   },
   {
    "color": "#ffe8cd",
-   "format": "{} to Bill",
+   "format": "{} To Bill",
    "label": "Purchase Receipt",
    "link_to": "Purchase Receipt",
    "stats_filter": "{\n    \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n    \"status\": \"To Bill\"\n}",
@@ -98,7 +98,7 @@
   },
   {
    "color": "#ffe8cd",
-   "format": "{} to Bill",
+   "format": "{} To Bill",
    "label": "Delivery Note",
    "link_to": "Delivery Note",
    "stats_filter": "{\n    \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n    \"status\": \"To Bill\"\n}",
@@ -115,7 +115,7 @@
    "type": "Report"
   },
   {
-   "label": "Stock Dashboard",
+   "label": "Dashboard",
    "link_to": "Stock",
    "type": "Dashboard"
   }
diff --git a/erpnext/stock/doctype/pick_list/pick_list.js b/erpnext/stock/doctype/pick_list/pick_list.js
index d46b98b..3a5ef76 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.js
+++ b/erpnext/stock/doctype/pick_list/pick_list.js
@@ -31,10 +31,16 @@
 			};
 		});
 		frm.set_query('item_code', 'locations', () => {
+			return erpnext.queries.item({ "is_stock_item": 1 });
+		});
+		frm.set_query('batch_no', 'locations', (frm, cdt, cdn) => {
+			const row = locals[cdt][cdn];
 			return {
+				query: 'erpnext.controllers.queries.get_batch_no',
 				filters: {
-					is_stock_item: 1
-				}
+					item_code: row.item_code,
+					warehouse: row.warehouse
+				},
 			};
 		});
 	},
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 1f8d009..93b29c8 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -24,6 +24,9 @@
 		for item in self.locations:
 			if not frappe.get_cached_value('Item', item.item_code, 'has_serial_no'):
 				continue
+			if not item.serial_no:
+				frappe.throw(_("Row #{0}: {1} does not have any available serial numbers in {2}".format(
+					frappe.bold(item.idx), frappe.bold(item.item_code), frappe.bold(item.warehouse))))
 			if len(item.serial_no.split('\n')) == item.picked_qty:
 				continue
 			frappe.throw(_('For item {0} at row {1}, count of serial numbers does not match with the picked quantity')
diff --git a/erpnext/stock/doctype/serial_no/serial_no.json b/erpnext/stock/doctype/serial_no/serial_no.json
index 731a730..d9f8b62 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.json
+++ b/erpnext/stock/doctype/serial_no/serial_no.json
@@ -420,14 +420,14 @@
    "fieldtype": "Select",
    "in_standard_filter": 1,
    "label": "Status",
-   "options": "\nActive\nDelivered\nExpired",
+   "options": "\nActive\nInactive\nDelivered\nExpired",
    "read_only": 1
   }
  ],
  "icon": "fa fa-barcode",
  "idx": 1,
  "links": [],
- "modified": "2020-04-08 13:29:58.517772",
+ "modified": "2020-05-21 19:29:58.517772",
  "modified_by": "Administrator",
  "module": "Stock",
  "name": "Serial No",
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 914eea3..f3514c7 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -42,6 +42,8 @@
 			self.status = "Delivered"
 		elif self.warranty_expiry_date and getdate(self.warranty_expiry_date) <= getdate(nowdate()):
 			self.status = "Expired"
+		elif not self.warehouse:
+			self.status = "Inactive"
 		else:
 			self.status = "Active"
 
diff --git a/erpnext/stock/doctype/serial_no/serial_no_list.js b/erpnext/stock/doctype/serial_no/serial_no_list.js
index 651f790..7526d1d 100644
--- a/erpnext/stock/doctype/serial_no/serial_no_list.js
+++ b/erpnext/stock/doctype/serial_no/serial_no_list.js
@@ -5,6 +5,8 @@
 			return [__("Delivered"), "green", "delivery_document_type,is,set"];
 		} else if (doc.warranty_expiry_date && frappe.datetime.get_diff(doc.warranty_expiry_date, frappe.datetime.nowdate()) <= 0) {
 			return [__("Expired"), "red", "warranty_expiry_date,not in,|warranty_expiry_date,<=,Today|delivery_document_type,is,not set"];
+		} else if (!doc.warehouse) {
+			return [__("Inactive"), "grey", "warehouse,is,not set"];
 		} else {
 			return [__("Active"), "green", "delivery_document_type,is,not set"];
 		}
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.js b/erpnext/stock/doctype/stock_settings/stock_settings.js
index 6f97572..877d0c3 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.js
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.js
@@ -36,7 +36,7 @@
 	{
 		fieldname: "valuation_method",
 		title: __("Valuation Method"),
-		description: __("Choose between FIFO and Moving Average Valuation Methods. Click ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/stock/articles/item-valuation-fifo-and-moving-average'>here</a>" + __(" to know more about them.")
+		description: __("Choose between FIFO and Moving Average Valuation Methods. Click ") + "<a href='https://docs.erpnext.com/docs/user/manual/en/stock/articles/item-valuation-fifo-and-moving-average' target='_blank'>here</a>" + __(" to know more about them.")
 	},
 	{
 		fieldname: "show_barcode_field",
diff --git a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
index 447611f..009a44f 100644
--- a/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
+++ b/erpnext/stock/onboarding_step/introduction_to_stock_entry/introduction_to_stock_entry.json
@@ -8,12 +8,12 @@
  "is_mandatory": 0,
  "is_single": 0,
  "is_skipped": 0,
- "modified": "2020-05-19 18:55:41.457289",
+ "modified": "2020-05-26 15:55:41.457289",
  "modified_by": "Administrator",
  "name": "Introduction to Stock Entry",
  "owner": "Administrator",
  "show_full_form": 0,
- "title": "Introduction to the multi-purpose stock transaction",
+ "title": "Introduction to Stock Entry",
  "validate_action": 1,
  "video_url": "https://www.youtube.com/watch?v=Njt107hlY3I"
 }
\ No newline at end of file
diff --git a/erpnext/stock/report/purchase_order_items_to_be_received/__init__.py b/erpnext/stock/report/purchase_order_items_to_be_received/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/stock/report/purchase_order_items_to_be_received/__init__.py
+++ /dev/null
diff --git a/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json b/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json
deleted file mode 100644
index dfaa9ed..0000000
--- a/erpnext/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "add_total_row": 1,
- "creation": "2013-02-22 18:01:55",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "idx": 3,
- "is_standard": "Yes",
- "modified": "2019-04-01 22:12:05.573343",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Purchase Order Items To Be Received",
- "owner": "Administrator",
- "prepared_report": 0,
- "query": "select \n    `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n    `tabPurchase Order`.`status` as \"Status:Data:120\",\n\t`tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order Item`.`schedule_date` as \"Reqd by Date:Date:110\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order`.`supplier_name` as \"Supplier Name::150\",\n\t`tabPurchase Order Item`.`project` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n\t(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n    `tabPurchase Order Item`.warehouse as \"Warehouse:Link/Warehouse:150\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n    `tabPurchase Order Item`.brand as \"Brand::100\",\n\t`tabPurchase Order`.`company` as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status not in (\"Stopped\", \"Closed\")\n\tand ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc",
- "ref_doctype": "Purchase Receipt",
- "report_name": "Purchase Order Items To Be Received",
- "report_type": "Query Report",
- "roles": [
-  {
-   "role": "Stock Manager"
-  },
-  {
-   "role": "Stock User"
-  },
-  {
-   "role": "Purchase User"
-  },
-  {
-   "role": "Accounts User"
-  }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/__init__.py b/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/__init__.py
+++ /dev/null
diff --git a/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/purchase_order_items_to_be_received_or_billed.json b/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/purchase_order_items_to_be_received_or_billed.json
deleted file mode 100644
index 48c0f42..0000000
--- a/erpnext/stock/report/purchase_order_items_to_be_received_or_billed/purchase_order_items_to_be_received_or_billed.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "add_total_row": 0,
- "creation": "2019-09-16 14:10:33.102865",
- "disable_prepared_report": 0,
- "disabled": 0,
- "docstatus": 0,
- "doctype": "Report",
- "idx": 0,
- "is_standard": "Yes",
- "modified": "2019-09-21 15:19:55.710578",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Purchase Order Items To Be Received or Billed",
- "owner": "Administrator",
- "prepared_report": 0,
- "query": "SELECT\n\t`poi_pri`.`purchase_order` as \"Purchase Order:Link/Purchase Order:120\",\n\t`poi_pri`.`status` as \"Status:Data:120\",\n\t`poi_pri`.`transaction_date` as \"Date:Date:100\",\n\t`poi_pri`.`schedule_date` as \"Reqd by Date:Date:110\",\n\t`poi_pri`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`poi_pri`.`supplier_name` as \"Supplier Name::150\",\n\t`poi_pri`.`item_code` as \"Item Code:Link/Item:120\",\n\t`poi_pri`.`qty` as \"Qty:Float:100\",\n\t`poi_pri`.`base_amount` as  \"Base Amount:Currency:100\",\n\t`poi_pri`.`received_qty` as \"Received Qty:Float:100\",\n\t`poi_pri`.`received_amount` as \"Received Qty Amount:Currency:100\",\n\t`poi_pri`.`qty_to_receive` as \"Qty to Receive:Float:100\",\n\t`poi_pri`.`amount_to_be_received` as \"Amount to Receive:Currency:100\",\n\t`poi_pri`.`billed_amount` as  \"Billed Amount:Currency:100\",\n\t`poi_pri`.`amount_to_be_billed` as  \"Amount To Be Billed:Currency:100\",\n\tSUM(`pii`.`qty`) AS \"Billed Qty:Float:100\",\n\t`poi_pri`.qty - SUM(`pii`.`qty`) AS \"Qty To Be Billed:Float:100\",\n\t`poi_pri`.`warehouse` as \"Warehouse:Link/Warehouse:150\",\n\t`poi_pri`.`item_name` as \"Item Name::150\",\n\t`poi_pri`.`description` as \"Description::200\",\n\t`poi_pri`.`brand` as \"Brand::100\",\n\t`poi_pri`.`project` as \"Project\",\n\t`poi_pri`.`company` as \"Company:Link/Company:\"\nFROM\n\t(SELECT\n\t\t`po`.`name` AS 'purchase_order',\n\t\t`po`.`status`,\n\t\t`po`.`company`,\n\t\t`poi`.`warehouse`,\n\t\t`poi`.`brand`,\n\t\t`poi`.`description`,\n\t\t`po`.`transaction_date`,\n\t\t`poi`.`schedule_date`,\n\t\t`po`.`supplier`,\n\t\t`po`.`supplier_name`,\n\t\t`poi`.`project`,\n\t\t`poi`.`item_code`,\n\t\t`poi`.`item_name`,\n\t\t`poi`.`qty`,\n\t\t`poi`.`base_amount`,\n\t\t`poi`.`received_qty`,\n\t\t(`poi`.billed_amt * ifnull(`po`.conversion_rate, 1)) as billed_amount,\n\t\t(`poi`.base_amount - (`poi`.billed_amt * ifnull(`po`.conversion_rate, 1))) as amount_to_be_billed,\n\t\t`poi`.`qty` - IFNULL(`poi`.`received_qty`, 0) AS 'qty_to_receive',\n\t\t(`poi`.`qty` - IFNULL(`poi`.`received_qty`, 0)) * `poi`.`rate` AS 'amount_to_be_received',\n\t\tSUM(`pri`.`amount`) AS 'received_amount',\n\t\t`poi`.`name` AS 'poi_name',\n\t\t`pri`.`name` AS 'pri_name'\n\tFROM\n\t\t`tabPurchase Order` po\n\t\tLEFT JOIN `tabPurchase Order Item` poi\n\t\tON `poi`.`parent` = `po`.`name`\n\t\tLEFT JOIN `tabPurchase Receipt Item` pri\n\t\tON `pri`.`purchase_order_item` = `poi`.`name`\n\t\t\tAND `pri`.`docstatus`=1\n\tWHERE\n\t\t`po`.`status` not in ('Stopped', 'Closed')\n\t\tAND `po`.`docstatus` = 1\n\t\tAND IFNULL(`poi`.`received_qty`, 0) < IFNULL(`poi`.`qty`, 0)\n\tGROUP BY `poi`.`name`\n\tORDER BY `po`.`transaction_date` ASC\n\t) poi_pri\n\tLEFT JOIN `tabPurchase Invoice Item` pii\n\tON `pii`.`po_detail` = `poi_pri`.`poi_name`\n\t\tAND `pii`.`docstatus`=1\nGROUP BY `poi_pri`.`poi_name`",
- "ref_doctype": "Purchase Order",
- "report_name": "Purchase Order Items To Be Received or Billed",
- "report_type": "Query Report",
- "roles": [
-  {
-   "role": "Purchase Manager"
-  },
-  {
-   "role": "Purchase User"
-  },
-  {
-   "role": "Stock User"
-  },
-  {
-   "role": "Stock Manager"
-  }
- ]
-}
\ No newline at end of file
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index ea96503..024aa6f 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -166,7 +166,7 @@
 		last_transaction_time = frappe.db.sql("""
 			select MAX(timestamp(posting_date, posting_time)) as posting_time
 			from `tabStock Ledger Entry`
-			where docstatus = 1 and fiscal_year = %s""", (fiscal_year))[0][0]
+			where docstatus = 1""")[0][0]
 
 		cur_doc_posting_datetime = "%s %s" % (self.posting_date, self.get("posting_time") or "00:00:00")
 
diff --git a/erpnext/www/all-products/index.html b/erpnext/www/all-products/index.html
index f090214..0126b59 100644
--- a/erpnext/www/all-products/index.html
+++ b/erpnext/www/all-products/index.html
@@ -11,7 +11,7 @@
 		<div class="input-group input-group-sm mb-3">
 			<input type="search" class="form-control" placeholder="{{_('Search')}}"
 				aria-label="{{_('Product Search')}}" aria-describedby="product-search"
-				value="{{ frappe.form_dict.search or '' }}"
+				value="{{ frappe.sanitize_html(frappe.form_dict.search) or '' }}"
 			>
 		</div>
 	</div>