brotherton-erpnext/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
Manas Solanki 966f141f62 Rename schools to Education (#11524)
* renaming for the docs, demo data and patch

* changes in the doctypes and reports

* rename the config file

* Few name changes in messages and license

* rename the school settings to education settings

* changes in the documentation

* added the setup file for the fixtures

* corrected the ui tests file path

* fix the codacy

* add the patch for renaming few doctypes and fields

* changes in the patch
2017-11-23 15:22:10 +05:30

32 lines
1.2 KiB
Python

from __future__ import unicode_literals
import frappe, os
from frappe.installer import remove_from_installed_apps
def execute():
reload_doctypes_for_schools_icons()
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`""")
if not frappe.db.exists('Module Def', 'Schools') and frappe.db.exists('Module Def', 'Academics'):
# 'Schools' module changed to the 'Education'
# frappe.rename_doc("Module Def", "Academics", "Schools")
frappe.rename_doc("Module Def", "Academics", "Education")
remove_from_installed_apps("schools")
def reload_doctypes_for_schools_icons():
# 'Schools' module changed to the 'Education'
# base_path = frappe.get_app_path('erpnext', 'schools', 'doctype')
base_path = frappe.get_app_path('erpnext', 'education', 'doctype')
for doctype in os.listdir(base_path):
if os.path.exists(os.path.join(base_path, doctype, doctype + '.json')) \
and doctype not in ("fee_component", "assessment", "assessment_result"):
frappe.reload_doc('education', 'doctype', doctype)