Merge pull request #5954 from nabinhait/guardian_patch_fix

Run guardian patch only if student doctype exists and there is father_name column
This commit is contained in:
Nabin Hait 2016-08-01 17:33:51 +05:30 committed by GitHub
commit e810ea3a2f
2 changed files with 11 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import frappe
def execute():
frappe.reload_doc("buying", "doctype", "request_for_quotation_supplier")
frappe.reload_doc("buying", "doctype", "request_for_quotation_item")
frappe.reload_doc("buying", "doctype", "request_for_quotation")
frappe.reload_doc("projects", "doctype", "timesheet")

View File

@ -2,7 +2,11 @@ from __future__ import unicode_literals
import frappe
def execute():
students = frappe.get_list("Student", fields=["name", "father_name", "father_email_id", "mother_name", "mother_email_id"])
if frappe.db.exists("DocType", "Student") and "father_name" in frappe.db.get_table_columns("Student"):
frappe.reload_doc("schools", "doctype", "student")
students = frappe.get_list("Student", fields=["name", "father_name", "father_email_id",
"mother_name", "mother_email_id"])
for stud in students:
if stud.father_name:
make_guardian(stud.father_name, stud.name, stud.father_email_id)