2019-01-22 18:22:20 +05:30
|
|
|
from __future__ import unicode_literals
|
2016-09-06 15:28:13 +05:30
|
|
|
import frappe
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
if frappe.db.exists("DocType", "Guardian"):
|
2017-11-23 15:22:10 +05:30
|
|
|
|
|
|
|
# '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 17:57:55 +05:30
|
|
|
if "student" not in frappe.db.get_table_columns("Guardian"):
|
|
|
|
return
|
2016-09-06 17:10:58 +05:30
|
|
|
guardian = frappe.get_all("Guardian", fields=["name", "student"])
|
2016-09-06 15:28:13 +05:30
|
|
|
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 17:57:55 +05:30
|
|
|
student.save()
|