Override ERPNext scheduler events

I would like to prevent the hourly execution of erpnext.hr.doctype.shift_type.shift_type.process_auto_attendance_for_all_shifts located in scheduler_events of ERPNext hooks.py.

My objective is to prevent the auto marking of attendance hourly yet allow the User to trigger the auto_attendance whenever he wants using the Mark Auto Attendance button so setting enable_auto_attendance to false is not an option. How can I do this through custom app?
I tried monkey patching that function in hooks.py as suggested in Override Function Triggered by Scheduler Event without modifying core files - #2 by OmarJaber but no success.

@manasan, did you resolve this? I have same problem.

you can override this function because of it’s a whitelist function

	def process_auto_attendance(self):
		if not cint(self.enable_auto_attendance) or not self.process_attendance_after or not self.last_sync_of_checkin:

How to override whitelist function


override_whitelisted_methods = {

@manasan & @cristianabarcazeb You got any solution for this??

check my above post that’s the solution

@manasan @Robot @Antony_Praveenkumar
Have you got in Solution for this?
As this method is not whitelisted method or Class method above solution is not working.

@Rajvi can you please share your code and also file path

This method is daily scheduler_events which is calling from ERPNext hooks.py and placed in Email Campaign Doctype with name set_email_campaign_status. I want to override it in custom app.

You don’t need to do anything crazy like monkey patching here. Just disable the scheduler job from “Scheduled job type” doctype and trigger it whenever you want instead.

@ankush he doesn’t want to stop the scheduler job, he wants to override. so please if you have any idea to override the code give him suggesstion

First It’s a normal function so disable the scheduled job and check the stopped check box

Then create a new function in your custom app and add what you want.


This funtion code from ERPNext and put it in your custom app and add the extra changes you want.

Okay I’ll try this. Thank you