From 29a8a93aa183517ce31d1a3e864b173dd8fdd8d1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Aug 2016 17:31:17 +0530 Subject: [PATCH 1/2] Run guardian patch only if student doctype exists and there is father_name column --- .../v6_20x/remove_customer_supplier_roles.py | 1 + erpnext/patches/v7_0/make_guardian.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/erpnext/patches/v6_20x/remove_customer_supplier_roles.py b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py index f4167bfa4f7..eb69845c844 100644 --- a/erpnext/patches/v6_20x/remove_customer_supplier_roles.py +++ b/erpnext/patches/v6_20x/remove_customer_supplier_roles.py @@ -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") diff --git a/erpnext/patches/v7_0/make_guardian.py b/erpnext/patches/v7_0/make_guardian.py index 7daad0e0114..b6b0a808734 100644 --- a/erpnext/patches/v7_0/make_guardian.py +++ b/erpnext/patches/v7_0/make_guardian.py @@ -2,12 +2,16 @@ 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"]) - for stud in students: - if stud.father_name: - make_guardian(stud.father_name, stud.name, stud.father_email_id) - if stud.mother_name: - make_guardian(stud.mother_name, stud.name, stud.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) + if stud.mother_name: + make_guardian(stud.mother_name, stud.name, stud.mother_email_id) def make_guardian(name, student, email=None): frappe.get_doc({ From 798f3897a37e109f791c3204162250214104892d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Aug 2016 18:05:02 +0600 Subject: [PATCH 2/2] bumped to version 7.0.14 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 8f01c873fef..ba951778df4 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '7.0.13' +__version__ = '7.0.14' def get_default_company(user=None): '''Get default company for user'''