Leave Application Validation for processed salary
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index fee39aa..838d8f7 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -36,6 +36,7 @@
 		self.validate_max_days()
 		self.show_block_day_warning()
 		self.validate_block_days()
+		self.validate_salary_processed_days()
 		self.validate_leave_approver()
 
 	def on_update(self):
@@ -95,6 +96,15 @@
 			frappe.throw(_("Leave cannot be applied/cancelled before {0}, as leave balance has already been carry-forwarded in the future leave allocation record {1}")
 				.format(formatdate(future_allocation[0].from_date), future_allocation[0].name))
 
+	def validate_salary_processed_days(self):
+		last_processed_pay_slip = frappe.db.sql("""select start_date, end_date from `tabSalary Slip`
+						where docstatus != 2 and employee = %s and ((%s between start_date and end_date) or (%s between start_date and end_date)) order by modified desc limit 1""",(self.employee, self.to_date, self.from_date))
+
+		if last_processed_pay_slip:
+			frappe.throw(_("Salary already processed for period between {0} and {1}, Leave application period cannot be between this date range.").
+					format(formatdate(last_processed_pay_slip[0][0]), formatdate(last_processed_pay_slip[0][1])))
+
+
 	def show_block_day_warning(self):
 		block_dates = get_applicable_block_dates(self.from_date, self.to_date,
 			self.employee, self.company, all_lists=True)