Merge branch 'develop' into sla_fix
diff --git a/README.md b/README.md
index cf3804f..64f8d67 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@
 ## Contributing
 
 1. [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
-1. [Report Security Vulnerabilities](https://erpnext.com/report)
+1. [Report Security Vulnerabilities](https://erpnext.com/security)
 1. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
 1. [Translations](https://translate.erpnext.com)
 1. [Chart of Accounts](https://charts.erpnext.com)
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 503f4f4..e166fa2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -485,7 +485,7 @@
 		"""Set against account for debit to account"""
 		against_acc = []
 		for d in self.get('items'):
-			if d.income_account not in against_acc:
+			if d.income_account and d.income_account not in against_acc:
 				against_acc.append(d.income_account)
 		self.against_income_account = ','.join(against_acc)
 
diff --git a/erpnext/config/accounting.py b/erpnext/config/accounting.py
index 0ab1f52..9a9ee7e 100644
--- a/erpnext/config/accounting.py
+++ b/erpnext/config/accounting.py
@@ -40,17 +40,6 @@
 					"description": _("Tree of financial accounts."),
 					"onboard": 1,
 				},
-				{
-					"type": "doctype",
-					"name": "Journal Entry",
-					"description": _("Accounting journal entries."),
-					"onboard": 1,
-				},
-				{
-					"type": "doctype",
-					"name": "Opening Invoice Creation Tool",
-					"description": _("Create Opening Sales and Purchase Invoices")
-				},
 			]
 		},
 		{
@@ -75,11 +64,6 @@
 				},
 				{
 					"type": "doctype",
-					"name": "Payment Entry",
-					"description": _("Bank/Cash transactions against party or for internal transfer")
-				},
-				{
-					"type": "doctype",
 					"name": "Payment Term",
 					"description": _("Payment Terms based on conditions")
 				},
@@ -179,6 +163,26 @@
 					"name": "Accounting Dimension",
 					"description": _("Setup custom dimensions for accounting")
 				},
+				{
+					"type": "doctype",
+					"name": "Opening Invoice Creation Tool",
+					"description": _("Create Opening Sales and Purchase Invoices")
+				},
+			]
+		},
+		{
+			"label": _("Accounting Entries"),
+			"items": [
+				{
+					"type": "doctype",
+					"name": "Payment Entry",
+					"description": _("Bank/Cash transactions against party or for internal transfer")
+				},
+				{
+					"type": "doctype",
+					"name": "Journal Entry",
+					"description": _("Accounting journal entries.")
+				},
 			]
 		},
 		{
diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
index 4700202..0b6ea8c 100644
--- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
+++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
@@ -22,7 +22,16 @@
 	frappe.set_user(woocommerce_settings.creation_user)
 
 @frappe.whitelist(allow_guest=True)
-def order():
+def order(*args, **kwargs):
+	try:
+		_order(*args, **kwargs)
+	except Exception:
+		error_message = frappe.get_traceback()+"\n\n Request Data: \n"+json.loads(frappe.request.data).__str__()
+		frappe.log_error(error_message, "WooCommerce Error")
+		raise
+
+
+def _order(*args, **kwargs):
 	woocommerce_settings = frappe.get_doc("Woocommerce Settings")
 	if frappe.flags.woocomm_test_order_data:
 		fd = frappe.flags.woocomm_test_order_data
diff --git a/erpnext/hr/doctype/attendance/attendance_calendar.js b/erpnext/hr/doctype/attendance/attendance_calendar.js
index b21afe5..104f09d 100644
--- a/erpnext/hr/doctype/attendance/attendance_calendar.js
+++ b/erpnext/hr/doctype/attendance/attendance_calendar.js
@@ -2,8 +2,8 @@
 // For license information, please see license.txt
 frappe.views.calendar["Attendance"] = {
 	field_map: {
-		"start": "date",
-		"end": "date",
+		"start": "attendance_date",
+		"end": "attendance_date",
 		"id": "name",
 		"docstatus": 1
 	},
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index f54991b..863a810 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -448,7 +448,12 @@
 
 	def get_pending_qty(item_row):
 		pending_qty = item_row.qty - invoiced_qty_map.get(item_row.name, 0)
-		returned_qty = flt(returned_qty_map.get(item_row.item_code, 0))
+
+		returned_qty = 0
+		if returned_qty_map.get(item_row.item_code) > 0:
+			returned_qty = flt(returned_qty_map.get(item_row.item_code, 0))
+			returned_qty_map[item_row.item_code] -= pending_qty
+
 		if returned_qty:
 			if returned_qty >= pending_qty:
 				pending_qty = 0
@@ -456,6 +461,7 @@
 			else:
 				pending_qty -= returned_qty
 				returned_qty = 0
+
 		return pending_qty, returned_qty
 
 	doc = get_mapped_doc("Delivery Note", source_name, {