diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 8b34eaa0a8..5ef53715fb 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -732,3 +732,4 @@ erpnext.patches.v13_0.set_youtube_video_id erpnext.patches.v13_0.print_uom_after_quantity_patch erpnext.patches.v13_0.set_payment_channel_in_payment_gateway_account erpnext.patches.v13_0.create_healthcare_custom_fields_in_stock_entry_detail +erpnext.patches.v13_0.update_reason_for_resignation_in_employee diff --git a/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py new file mode 100644 index 0000000000..792118fbee --- /dev/null +++ b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py @@ -0,0 +1,15 @@ +# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors +# MIT License. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc("hr", "doctype", "employee") + + if frappe.db.has_column("Employee", "reason_for_resignation"): + frappe.db.sql(""" UPDATE `tabEmployee` + SET reason_for_leaving = reason_for_resignation + WHERE status = 'Left' and reason_for_leaving is null and reason_for_resignation is not null + """) +