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.
you can override this function because of it’s a whitelist function
@frappe.whitelist()
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:
return
@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.
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.