2019-01-22 12:52:20 +00:00
|
|
|
from __future__ import unicode_literals
|
2016-09-06 09:58:13 +00:00
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
if frappe.db.exists("DocType", "Guardian"):
|
2017-11-23 09:52:10 +00:00
|
|
|
|
|
|
|
# 'Schools' module changed to the 'Education'
|
|
|
|
# frappe.reload_doc("schools", "doctype", "student")
|
|
|
|
# frappe.reload_doc("schools", "doctype", "student_guardian")
|
|
|
|
# frappe.reload_doc("schools", "doctype", "student_sibling")
|
|
|
|
|
|
|
|
frappe.reload_doc("education", "doctype", "student")
|
|
|
|
frappe.reload_doc("education", "doctype", "student_guardian")
|
|
|
|
frappe.reload_doc("education", "doctype", "student_sibling")
|
2016-09-08 12:27:55 +00:00
|
|
|
if "student" not in frappe.db.get_table_columns("Guardian"):
|
|
|
|
return
|
2016-09-06 11:40:58 +00:00
|
|
|
guardian = frappe.get_all("Guardian", fields=["name", "student"])
|
2016-09-06 09:58:13 +00:00
|
|
|
for d in guardian:
|
|
|
|
if d.student:
|
|
|
|
student = frappe.get_doc("Student", d.student)
|
|
|
|
if student:
|
|
|
|
student.append("guardians", {"guardian": d.name})
|
2016-09-08 12:27:55 +00:00
|
|
|
student.save()
|