fix: GL entry validation fix
diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
index 61f699f..1f418de 100644
--- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
@@ -164,8 +164,9 @@
 		return accounting_dimensions
 
 def get_checks_for_pl_and_bs_accounts():
-	dimensions = frappe.db.sql("""SELECT parent, company, mandatory_for_pl, mandatory_for_bs
-		FROM `tabAccounting Dimension Detail`""", as_dict=1)
+	dimensions = frappe.db.sql("""SELECT p.label, p.disabled, p.fieldname, c.company, c.mandatory_for_pl, c.mandatory_for_bs
+		FROM `tabAccounting Dimension`p ,`tabAccounting Dimension Detail` c
+		WHERE p.name = c.parent""", as_dict=1)
 
 	return dimensions
 
diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
index c75ba82..104880f 100644
--- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
@@ -108,7 +108,6 @@
 	dimension1.save()
 
 	dimension2 = frappe.get_doc("Accounting Dimension", "Location")
-	dimension2.mandatory_for_pl = 0
 	dimension2.disabled = 1
 	dimension2.save()
 
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 80e5186..4944c8f 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -90,15 +90,15 @@
 
 			if account_type == "Profit and Loss" \
 				and self.company == dimension.company and dimension.mandatory_for_pl and not dimension.disabled:
-				if not self.get(frappe.scrub(dimension.parent)):
+				if not self.get(frappe.scrub(dimension.fieldname)):
 					frappe.throw(_("Accounting Dimension <b>{0}</b> is required for 'Profit and Loss' account {1}.")
-						.format(dimension.parent, self.account))
+						.format(dimension.label, self.account))
 
 			if account_type == "Balance Sheet" \
 				and self.company == dimension.company and dimension.mandatory_for_bs and not dimension.disabled:
-				if not self.get(frappe.scrub(dimension.parent)):
+				if not self.get(frappe.scrub(dimension.fieldname)):
 					frappe.throw(_("Accounting Dimension <b>{0}</b> is required for 'Balance Sheet' account {1}.")
-						.format(dimension.parent, self.account))
+						.format(dimension.label, self.account))
 
 
 	def check_pl_account(self):