brotherton-erpnext/erpnext/patches/v9_0/student_admission_childtable_migrate.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.4 KiB
Python

# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# 'Schools' module changed to the 'Education'
# frappe.reload_doc('schools', 'doctype', 'Student Admission Program')
# frappe.reload_doc('schools', 'doctype', 'student_admission')
frappe.reload_doc('education', 'doctype', 'Student Admission Program')
frappe.reload_doc('education', 'doctype', 'student_admission')
if "program" not in frappe.db.get_table_columns("Student Admission"):
return
student_admissions = frappe.get_all("Student Admission", fields=["name", "application_fee", \
"naming_series_for_student_applicant", "program", "introduction", "eligibility"])
for student_admission in student_admissions:
doc = frappe.get_doc("Student Admission", student_admission.name)
doc.append("program_details", {
"program": student_admission.get("program"),
"application_fee": student_admission.get("application_fee"),
"applicant_naming_series": student_admission.get("naming_series_for_student_applicant"),
})
if student_admission.eligibility and student_admission.introduction:
doc.introduction = student_admission.introduction + "<br><div>" + \
student_admission.eligibility + "</div>"
doc.flags.ignore_validate = True
doc.flags.ignore_mandatory = True
doc.save()