diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 6fff4cefcc..7d0ac97560 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -374,3 +374,4 @@ erpnext.patches.v7_2.update_party_type erpnext.patches.v7_2.setup_auto_close_settings erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component +erpnext.patches.v7_2.rename_att_date_attendance diff --git a/erpnext/patches/v7_2/rename_att_date_attendance.py b/erpnext/patches/v7_2/rename_att_date_attendance.py new file mode 100644 index 0000000000..78d3220b0e --- /dev/null +++ b/erpnext/patches/v7_2/rename_att_date_attendance.py @@ -0,0 +1,14 @@ +import frappe +from frappe.model.utils.rename_field import update_reports, update_users_report_view_settings, update_property_setters + +def execute(): + if "att_date" not in frappe.db.get_table_columns("Attendance"): + return + frappe.reload_doc("HR", "doctype", "attendance") + frappe.db.sql("""update `tabAttendance` + set attendance_date = att_date + where (att_date is not null or att_date != '') and (attendance_date is null or attendance_date = '')""") + + update_reports("Attendance", "att_date", "attendance_date") + update_users_report_view_settings("Attendance", "att_date", "attendance_date") + update_property_setters("Attendance", "att_date", "attendance_date") \ No newline at end of file