Leave Approver shouldn't approve his Leave application

Their is a leave approver of a team, he approves all the “Leave Application” who are working under him
but the problem is leave approver’s “Leave Application” is approved by manager, but the Leave Approver himself can save & submit his “Leave Application” because he has the permission of those who are working under him

Below is the permission given to Leave Approver Role

I can see in forum this issue is not resolved below are the links

Anyone who know how can i resolve this, i am using v13 (frappe + erpnext)

anyone who know the solution, i am stuck

Their is Two solution which i found

  1. if you setup the “Workflow” for Leave Application and unselect this checkbox, everything works great

  2. i changed the below code in leave_application.py file

def on_update(self):
		if self.status == "Open" and self.docstatus < 1:
			# notify leave approver about creation
			if frappe.db.get_single_value("HR Settings", "send_leave_notification"):
				self.notify_leave_approver()
		
		# --------------------------------------------------------------------------------------------
		if "HR User" in frappe.get_roles() or "HR Manager" in frappe.get_roles():
			pass
		elif "Leave Approver" in frappe.get_roles():
            # Get the email ID of the Leave Approver
				leave_approver_email = frappe.get_value("User", frappe.session.user, "email")

				# Check if the current user's email matches the Leave Approver's email
				if leave_approver_email == self.leave_approver:
					pass
				else:
					# Check if the status field has been modified
					if self.docstatus == 0 and self.status == "Approved":
						frappe.throw(_("You can't approve your Leave Application :("))
		# ---------------------------------------------------------------------------------------------

		share_doc_with_approver(self, self.leave_approver)

Also , if you want you can change the submit functionality also but only above code is also fine

def on_submit(self):
		# ---------------------------------------------------------------------------------------
		if "HR User" in frappe.get_roles() or "HR Manager" in frappe.get_roles():
			pass
		elif "Leave Approver" in frappe.get_roles():
        # Get the email ID of the Leave Approve
			leave_approver_email = frappe.get_value("User", frappe.session.user, "email")
        
			# Check if the current user's email matches the Leave Approver's email
			if leave_approver_email == self.leave_approver:
				pass  # Allow Leave Approver to submit their own leave application
			else:
				frappe.throw(_("You cannot submit or edit the status of Leave Applications -_-"))
		# --------------------------------------------------------------------------------------------
		if self.status in ["Open", "Cancelled"]:
			frappe.throw(
				_("Only Leave Applications with status 'Approved' and 'Rejected' can be submitted")
			)