Merge branch 'master' into develop
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 9660cb9..48b942e 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
 from __future__ import unicode_literals
 import frappe
 
-__version__ = '7.1.16'
+__version__ = '7.1.17'
 
 def get_default_company(user=None):
 	'''Get default company for user'''
diff --git a/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
index 2883a8a..9f159be 100644
--- a/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
+++ b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
@@ -9,6 +9,8 @@
 	if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
 		return
 
+	frappe.reload_doctype("Purchase Invoice")
+
 	for pi in frappe.db.sql("""select name from `tabPurchase Invoice` 
 		where update_stock=1 and docstatus=1  order by posting_date asc""", as_dict=1):
 		
diff --git a/erpnext/schools/doctype/student_admission/student_admission.py b/erpnext/schools/doctype/student_admission/student_admission.py
index b0c7b55..a849d65 100644
--- a/erpnext/schools/doctype/student_admission/student_admission.py
+++ b/erpnext/schools/doctype/student_admission/student_admission.py
@@ -23,7 +23,7 @@
 		context.parents = [{'name': 'admissions', 'title': _('All Student Admissions') }]
 
 	def get_title(self):
-		return _("Admissions for {0}").format(self.academic_term)
+		return _("Admissions for {0}").format(self.academic_year)
 
 def get_list_context(context):
 	context.title = _("Student Admissions")
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 59fdf70..97eca54 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -66,7 +66,8 @@
 			});
 		}
 
-		if(this.frm.fields_dict["packed_items"].grid.get_field('batch_no')) {
+		if(this.frm.fields_dict["packed_items"] &&
+			this.frm.fields_dict["packed_items"].grid.get_field('batch_no')) {
 			this.frm.set_query("batch_no", "packed_items", function(doc, cdt, cdn) {
 				return me.set_query_for_batch(doc, cdt, cdn)
 			});