Delete events linked with employee on deletion of Employee
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 16ae758..6c27b23 100644
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -10,6 +10,7 @@
import frappe.permissions
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+from erpnext.utilities.transaction_base import delete_events
class EmployeeUserDisabledError(frappe.ValidationError): pass
@@ -179,6 +180,9 @@
frappe.db.sql("""delete from `tabEvent` where repeat_on='Every Year' and
ref_type='Employee' and ref_name=%s""", self.name)
+ def on_trash(self):
+ delete_events(self.doctype, self.name)
+
@frappe.whitelist()
def get_retirement_date(date_of_birth=None):
import datetime