brotherton-erpnext/erpnext/patches/v7_2/rename_att_date_attendance.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
674 B
Python
Raw Normal View History

from __future__ import unicode_literals
2017-02-21 08:14:01 +00:00
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
2017-02-21 10:31:21 +00:00
frappe.reload_doc("hr", "doctype", "attendance")
2017-02-21 08:14:01 +00:00
frappe.db.sql("""update `tabAttendance`
set attendance_date = att_date
where attendance_date is null or attendance_date = '0000-00-00'""")
2017-02-21 08:14:01 +00:00
update_reports("Attendance", "att_date", "attendance_date")
update_users_report_view_settings("Attendance", "att_date", "attendance_date")
2017-02-21 10:31:21 +00:00
update_property_setters("Attendance", "att_date", "attendance_date")