brotherton-erpnext/erpnext/patches/v7_0/migrate_schools_to_erpnext.py

25 lines
1009 B
Python
Raw Normal View History

2016-07-19 14:17:33 +05:30
from __future__ import unicode_literals
2016-08-10 19:45:59 +05:30
import frappe, os
2016-08-16 18:31:09 +05:30
from frappe.installer import remove_from_installed_apps
2016-07-19 14:17:33 +05:30
def execute():
2016-07-22 12:19:18 +05:30
reload_doctypes_for_schools_icons()
2016-07-22 11:31:31 +05:30
frappe.reload_doc('website', 'doctype', 'portal_settings')
frappe.reload_doc('website', 'doctype', 'portal_menu_item')
frappe.reload_doc('buying', 'doctype', 'request_for_quotation')
if 'schools' in frappe.get_installed_apps():
frappe.db.sql("""delete from `tabDesktop Icon`""")
2016-08-16 18:31:09 +05:30
if not frappe.db.exists('Module Def', 'Schools') and frappe.db.exists('Module Def', 'Academics'):
frappe.rename_doc("Module Def", "Academics", "Schools")
remove_from_installed_apps("schools")
2016-07-22 12:19:18 +05:30
def reload_doctypes_for_schools_icons():
2016-08-10 19:45:59 +05:30
base_path = frappe.get_app_path('erpnext', 'schools', 'doctype')
for doctype in os.listdir(base_path):
2016-08-16 18:31:09 +05:30
if os.path.exists(os.path.join(base_path, doctype, doctype + '.json')) \
and doctype not in ("fee_component", "assessment", "assessment_result"):
frappe.reload_doc('schools', 'doctype', doctype)