From 0a6529a643c66fb48659b8f3ec9c7d374581cf38 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 28 Sep 2016 12:55:02 +0530 Subject: [PATCH] Remove time log, time log batch from Doc Field. --- erpnext/patches.txt | 2 +- .../patches/v7_0/remove_doctypes_and_reports.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 07bf0f0027..be0013e3ff 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -282,7 +282,7 @@ execute:frappe.reload_doc('projects', 'doctype', 'project_user') erpnext.patches.v7_0.convert_timelogbatch_to_timesheet erpnext.patches.v7_0.convert_timelog_to_timesheet erpnext.patches.v7_0.move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet -erpnext.patches.v7_0.remove_doctypes_and_reports +erpnext.patches.v7_0.remove_doctypes_and_reports #2016-10-29 erpnext.patches.v7_0.update_maintenance_module_in_doctype erpnext.patches.v7_0.update_prevdoc_values_for_supplier_quotation_item erpnext.patches.v7_0.rename_advance_table_fields diff --git a/erpnext/patches/v7_0/remove_doctypes_and_reports.py b/erpnext/patches/v7_0/remove_doctypes_and_reports.py index 0a302b1441..3c45be4377 100644 --- a/erpnext/patches/v7_0/remove_doctypes_and_reports.py +++ b/erpnext/patches/v7_0/remove_doctypes_and_reports.py @@ -5,6 +5,21 @@ def execute(): frappe.db.sql("""delete from `tabDocType` where name in('Time Log Batch', 'Time Log Batch Detail', 'Time Log')""") + frappe.db.sql("""delete from `tabDocField` where parent in ('Time Log', 'Time Log Batch')""") + frappe.db.sql("""update `tabCustom Script` set dt = 'Timesheet' where dt = 'Time Log'""") + + for data in frappe.db.sql(""" select label, fieldname from `tabCustom Field` where dt = 'Time Log'""", as_dict=1): + custom_field = frappe.get_doc({ + 'doctype': 'Custom Field', + 'label': data.label, + 'dt': 'Timesheet Detail', + 'fieldname': data.fieldname + }).insert(ignore_permissions=True) + + frappe.db.sql("""delete from `tabCustom Field` where dt = 'Time Log'""") + frappe.reload_doc('projects', 'doctype', 'timesheet') + frappe.reload_doc('projects', 'doctype', 'timesheet_detail') + report = "Daily Time Log Summary" if frappe.db.exists("Report", report): frappe.delete_doc('Report', report) \ No newline at end of file