only validate party account and ref doc party account in selected case (#10863)

* only validate party account and ref doc party account in selected case

* fix for fee structure test

* fix the assessment result test
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index c93e5f9..31869fb 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -221,9 +221,9 @@
 						elif self.party_type=="Employee":
 							ref_party_account = ref_doc.payable_account
 
-					if ref_party_account != self.party_account:
-							frappe.throw(_("{0} {1} is associated with {2}, but Party Account is {3}")
-								.format(d.reference_doctype, d.reference_name, ref_party_account, self.party_account))
+						if ref_party_account != self.party_account:
+								frappe.throw(_("{0} {1} is associated with {2}, but Party Account is {3}")
+									.format(d.reference_doctype, d.reference_name, ref_party_account, self.party_account))
 
 					if ref_doc.docstatus != 1:
 						frappe.throw(_("{0} {1} must be submitted")
diff --git a/erpnext/schools/doctype/assessment_result/test_assessment_result.js b/erpnext/schools/doctype/assessment_result/test_assessment_result.js
index 83aca6b..1ed249a 100644
--- a/erpnext/schools/doctype/assessment_result/test_assessment_result.js
+++ b/erpnext/schools/doctype/assessment_result/test_assessment_result.js
@@ -20,8 +20,9 @@
 		() => cur_frm.refresh(),
 		() => frappe.timeout(1),
 		() => {
-			for(i = 0; i < $('tbody tr').size() * 4; i = (i + 4))
-				student_list.push($(`tbody td:eq("${i}")`).text());
+			$("tbody tr").each( function(i, input){
+				student_list.push($(input).data().student);
+			});
 		},
 
 		// Looping through each student in the list and setting up their score
diff --git a/erpnext/schools/doctype/fee_structure/test_records.json b/erpnext/schools/doctype/fee_structure/test_records.json
index 8b7dc16..cdd00be 100644
--- a/erpnext/schools/doctype/fee_structure/test_records.json
+++ b/erpnext/schools/doctype/fee_structure/test_records.json
@@ -14,8 +14,8 @@
 			}
 		],
 		"total_amount": 50000,
-		"debit_to": "_Test Receivable - _TC",
-		"against_income_account": "Sales - _TC",
+		"receivable_account": "_Test Receivable - _TC",
+		"income_account": "Sales - _TC",
 		"cost_center": "_Test Cost Center - _TC",
 		"company": "_Test Company"
 	},
@@ -34,8 +34,8 @@
 			}
 		],
 		"total_amount": 50000,
-		"debit_to": "_Test Receivable - _TC",
-		"against_income_account": "Sales - _TC",
+		"receivable_account": "_Test Receivable - _TC",
+		"income_account": "Sales - _TC",
 		"cost_center": "_Test Cost Center - _TC",
 		"company": "_Test Company"
 	}
diff --git a/erpnext/schools/doctype/fees/fees.json b/erpnext/schools/doctype/fees/fees.json
index 7a2167b..ab9a792 100644
--- a/erpnext/schools/doctype/fees/fees.json
+++ b/erpnext/schools/doctype/fees/fees.json
@@ -93,7 +93,7 @@
    "label": "Student Name", 
    "length": 0, 
    "no_copy": 0, 
-   "options": "student.student_name", 
+   "options": "student.title", 
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
@@ -1276,7 +1276,7 @@
  "istable": 0, 
  "max_attachments": 0, 
  "menu_index": 0, 
- "modified": "2017-09-19 16:45:14.313744", 
+ "modified": "2017-09-20 23:17:09.819606", 
  "modified_by": "Administrator", 
  "module": "Schools", 
  "name": "Fees", 
diff --git a/erpnext/schools/doctype/fees/fees.py b/erpnext/schools/doctype/fees/fees.py
index d45d6e3..a2fcecc 100644
--- a/erpnext/schools/doctype/fees/fees.py
+++ b/erpnext/schools/doctype/fees/fees.py
@@ -52,8 +52,13 @@
 			where g.name = sg.guardian and sg.parent = %s and sg.parenttype = 'Student'
 		""", self.student)
 
-		student_emails.append(frappe.db.get_value("Student", self.student, "student_email_id"))
-		return ", ".join(list(set(student_emails)))
+		student_email_id = frappe.db.get_value("Student", self.student, "student_email_id")
+		if student_email_id:
+			student_emails.append(student_email_id)
+		if student_emails:
+			return ", ".join(list(set(student_emails)))
+		else:
+			return None
 
 
 	def calculate_total(self):
diff --git a/erpnext/schools/doctype/fees/test_fees.py b/erpnext/schools/doctype/fees/test_fees.py
index 283e17b..50e1539 100644
--- a/erpnext/schools/doctype/fees/test_fees.py
+++ b/erpnext/schools/doctype/fees/test_fees.py
@@ -19,8 +19,8 @@
 		fee.posting_date = nowdate()
 		fee.due_date = nowdate()
 		fee.student = student
-		fee.debit_to = "_Test Receivable - _TC"
-		fee.against_income_account = "Sales - _TC"
+		fee.receivable_account = "_Test Receivable - _TC"
+		fee.income_account = "Sales - _TC"
 		fee.cost_center = "_Test Cost Center - _TC"
 		fee.company = "_Test Company"