Merge pull request #13214 from manassolanki/assessment-report-fix

minor fix for key error in assessment reports
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 6ec290c..99981bd 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
 from erpnext.hooks import regional_overrides
 from frappe.utils import getdate
 
-__version__ = '10.1.5'
+__version__ = '10.1.6'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 7561b35..305c08b 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -20,6 +20,11 @@
 
 
 class PaymentEntry(AccountsController):
+	def __init__(self, *args, **kwargs):
+		super(PaymentEntry, self).__init__(*args, **kwargs)
+		if not self.is_new():
+			self.setup_party_account_field()
+
 	def setup_party_account_field(self):
 		self.party_account_field = None
 		self.party_account = None
@@ -287,6 +292,7 @@
 
 	def set_unallocated_amount(self):
 		self.unallocated_amount = 0
+
 		if self.party:
 			total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
 
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index 6bc4104..6d4fe02 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -200,7 +200,7 @@
 			"color": "#fd784f",
 			"icon": "octicon octicon-calendar",
 			"label": _("Course Schedule"),
-			"link": "Calendar/Course Schedule",
+			"link": "List/Course Schedule/Calendar",
 			"_doctype": "Course Schedule",
 			"type": "list",
 			"hidden": 1
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 9eee6cc..bf8c88c 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -92,7 +92,10 @@
 			InvalidItemAttributeValueError, title=_('Invalid Attribute'))
 
 def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
-	if attribute_value not in attributes_list:
+	allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
+	if allow_rename_attribute_value:
+		pass
+	elif attribute_value not in attributes_list:
 		frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
 			attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))
 
diff --git a/erpnext/education/doctype/guardian/guardian.json b/erpnext/education/doctype/guardian/guardian.json
index d8722e2..191e92a 100644
--- a/erpnext/education/doctype/guardian/guardian.json
+++ b/erpnext/education/doctype/guardian/guardian.json
@@ -2,7 +2,7 @@
  "allow_copy": 0, 
  "allow_guest_to_view": 0, 
  "allow_import": 1, 
- "allow_rename": 0, 
+ "allow_rename": 1, 
  "autoname": "GARD.####", 
  "beta": 0, 
  "creation": "2016-07-21 15:32:51.163292", 
@@ -507,7 +507,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-12-06 18:17:38.090252", 
+ "modified": "2018-03-07 12:51:06.941609", 
  "modified_by": "Administrator", 
  "module": "Education", 
  "name": "Guardian", 
diff --git a/erpnext/patches/v10_0/update_status_for_multiple_source_in_po.py b/erpnext/patches/v10_0/update_status_for_multiple_source_in_po.py
index 1de9d97..fd3be08 100644
--- a/erpnext/patches/v10_0/update_status_for_multiple_source_in_po.py
+++ b/erpnext/patches/v10_0/update_status_for_multiple_source_in_po.py
@@ -9,15 +9,17 @@
 
 	# update the sales order item in the material request
 	frappe.reload_doc('stock', 'doctype', 'material_request_item')
-	frappe.db.sql('''update `tabMaterial Request Item` mri set sales_order_item = (select name from
-		`tabSales Order Item` soi where soi.parent=mri.sales_order and soi.item_code=mri.item_code) where docstatus = 1 and
-		ifnull(mri.sales_order, "")!="" 
+	frappe.db.sql('''update `tabMaterial Request Item` mri, `tabSales Order Item` soi
+		set mri.sales_order_item = soi.name
+		where ifnull(mri.sales_order, "")!="" and soi.parent=mri.sales_order
+		and soi.item_code=mri.item_code and mri.docstatus=1
 	''')
 
 	# update the sales order item in the purchase order
-	frappe.db.sql('''update `tabPurchase Order Item` poi set sales_order_item = (select name from
-		`tabSales Order Item` soi where soi.parent=poi.sales_order and soi.item_code=poi.item_code) where docstatus = 1 and
-		ifnull(poi.sales_order, "")!="" 
+	frappe.db.sql('''update `tabPurchase Order Item` poi, `tabSales Order Item` soi
+		set poi.sales_order_item = soi.name
+		where ifnull(poi.sales_order, "")!="" and soi.parent=poi.sales_order
+		and soi.item_code=poi.item_code and poi.docstatus = 1
 	''')
 
 	# Update the status in material request and sales order
diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
index 8ad73d1..14808c2 100644
--- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
+++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.json
@@ -78,6 +78,38 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "default": "", 
+   "description": "Rename Attribute Value in Item Attribute.", 
+   "fieldname": "allow_rename_attribute_value", 
+   "fieldtype": "Check", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "Allow Rename Attribute Value", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "copy_fields_to_variant", 
    "fieldtype": "Section Break", 
    "hidden": 0, 
@@ -144,7 +176,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-11-14 15:54:12.190518", 
+ "modified": "2018-02-19 11:39:54.401128", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Variant Settings",