diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.js b/erpnext/education/doctype/assessment_plan/assessment_plan.js index f6fceb1563..0f59f99657 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.js +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.js @@ -1,41 +1,46 @@ // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -cur_frm.add_fetch("student_group", "course", "course"); -cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); -cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); -cur_frm.add_fetch("course", "default_grading_scale", "grading_scale"); frappe.ui.form.on("Assessment Plan", { - onload: function(frm) { - frm.set_query("assessment_group", function(doc, cdt, cdn) { - return{ - filters: { - 'is_group': 0 - } - } - }); - }, - - refresh: function(frm) { - if (frm.doc.docstatus == 1) { - frm.add_custom_button(__("Assessment Result"), function() { - frappe.route_options = { - assessment_plan: frm.doc.name, - student_group: frm.doc.student_group - } - frappe.set_route("Form", "Assessment Result Tool"); - }); - } + setup: function(frm) { + frm.add_fetch("student_group", "course", "course"); + frm.add_fetch("student_group", "program", "program"); + frm.add_fetch("student_group", "academic_year", "academic_year"); + frm.add_fetch("student_group", "academic_term", "academic_term"); + frm.add_fetch("examiner", "instructor_name", "examiner_name"); + frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); + frm.add_fetch("course", "default_grading_scale", "grading_scale"); + }, + onload: function(frm) { + frm.set_query("assessment_group", function(doc, cdt, cdn) { + return{ + filters: { + 'is_group': 0 + } + }; + }); frm.set_query('grading_scale', function(){ return { filters: { docstatus: 1 } - } + }; }); - }, + }, + + refresh: function(frm) { + if (frm.doc.docstatus == 1) { + frm.add_custom_button(__("Assessment Result"), function() { + frappe.route_options = { + assessment_plan: frm.doc.name, + student_group: frm.doc.student_group + } + frappe.set_route("Form", "Assessment Result Tool"); + }); + } + }, course: function(frm) { if (frm.doc.course && frm.doc.maximum_assessment_score) { diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.json b/erpnext/education/doctype/assessment_plan/assessment_plan.json index e2ae247e7c..eccc966276 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.json +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.json @@ -13,36 +13,6 @@ "editable_grid": 0, "engine": "InnoDB", "fields": [ - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "assessment_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Assessment Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -80,19 +50,80 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "course", - "fieldtype": "Link", + "fieldname": "assessment_name", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 1, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Course", + "in_standard_filter": 0, + "label": "Assessment Name", "length": 0, "no_copy": 0, - "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assessment_group", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Assessment Group", + "length": 0, + "no_copy": 0, + "options": "Assessment Group", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "grading_scale", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Grading Scale", + "length": 0, + "no_copy": 0, + "options": "Grading Scale", "permlevel": 0, "precision": "", "print_hide": 0, @@ -140,19 +171,50 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "assessment_group", + "fieldname": "course", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 1, - "label": "Assessment Group", + "label": "Course", "length": 0, "no_copy": 0, - "options": "Assessment Group", + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", "permlevel": 0, "precision": "", "print_hide": 0, @@ -171,8 +233,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "maximum_assessment_score", - "fieldtype": "Float", + "fieldname": "academic_year", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -180,9 +242,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Maximum Assessment Score", + "label": "Academic Year", "length": 0, "no_copy": 0, + "options": "Academic Year", "permlevel": 0, "precision": "", "print_hide": 0, @@ -190,7 +253,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -201,7 +264,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "grading_scale", + "fieldname": "academic_term", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -209,11 +272,11 @@ "in_filter": 0, "in_global_search": 0, "in_list_view": 0, - "in_standard_filter": 1, - "label": "Grading Scale", + "in_standard_filter": 0, + "label": "Academic Term", "length": 0, "no_copy": 0, - "options": "Grading Scale", + "options": "Academic Term", "permlevel": 0, "precision": "", "print_hide": 0, @@ -221,7 +284,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -546,6 +609,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Evaluate", "length": 0, "no_copy": 0, "permlevel": 0, @@ -560,6 +624,36 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "maximum_assessment_score", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Maximum Assessment Score", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -633,7 +727,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-11-28 17:23:36.657725", + "modified": "2018-01-08 17:53:39.340356", "modified_by": "Administrator", "module": "Education", "name": "Assessment Plan", diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.py b/erpnext/education/doctype/assessment_plan/assessment_plan.py index 7ad76b8731..d88c87764d 100644 --- a/erpnext/education/doctype/assessment_plan/assessment_plan.py +++ b/erpnext/education/doctype/assessment_plan/assessment_plan.py @@ -9,10 +9,22 @@ from frappe import _ class AssessmentPlan(Document): def validate(self): + self.set_missing_field() self.validate_overlap() self.validate_max_score() self.validate_assessment_criteria() + def set_missing_field(self): + if self.student_group: + academic_term, academic_year, program, course = frappe.get_value("Student Group", self.student_group, + ["academic_term", "academic_year", "program", "course"]) + self.academic_term = academic_term + self.academic_year = academic_year + if program: + self.program = program + if course and not self.course: #pylint: disable=E0203 + self.course = course + def validate_overlap(self): """Validates overlap for Student Group, Instructor, Room""" diff --git a/erpnext/education/doctype/assessment_result/assessment_result.js b/erpnext/education/doctype/assessment_result/assessment_result.js index d1115a7da6..cf176aa520 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.js +++ b/erpnext/education/doctype/assessment_result/assessment_result.js @@ -1,11 +1,29 @@ // Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt -cur_frm.add_fetch("student", "title", "student_name"); -cur_frm.add_fetch("assessment_plan", "grading_scale", "grading_scale"); -cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"); - frappe.ui.form.on("Assessment Result", { + setup: function(frm) { + frm.add_fetch("student", "title", "student_name"); + frm.add_fetch("assessment_plan", "course", "course"); + frm.add_fetch("assessment_plan", "program", "program"); + frm.add_fetch("assessment_plan", "academic_year", "academic_year"); + frm.add_fetch("assessment_plan", "academic_term", "academic_term"); + frm.add_fetch("assessment_plan", "grading_scale", "grading_scale"); + frm.add_fetch("assessment_plan", "student_group", "student_group"); + frm.add_fetch("assessment_plan", "assessment_group", "assessment_group"); + frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score"); + }, + + onload: function(frm) { + frm.set_query('assessment_plan', function(){ + return { + filters: { + docstatus: 1 + } + }; + }); + }, + assessment_plan: function(frm) { if (frm.doc.assessment_plan) { frappe.call({ diff --git a/erpnext/education/doctype/assessment_result/assessment_result.json b/erpnext/education/doctype/assessment_result/assessment_result.json index 3912587f99..1e2f4d249d 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.json +++ b/erpnext/education/doctype/assessment_result/assessment_result.json @@ -13,6 +13,190 @@ "editable_grid": 1, "engine": "InnoDB", "fields": [ + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "assessment_plan", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Assessment Plan", + "length": 0, + "no_copy": 0, + "options": "Assessment Plan", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "program", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Program", + "length": 0, + "no_copy": 0, + "options": "Program", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "academic_year", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "academic_term", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_3", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -80,8 +264,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", + "fieldname": "student_group", + "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -89,8 +273,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Student Group", "length": 0, "no_copy": 0, + "options": "Student Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -109,19 +295,19 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "assessment_plan", + "fieldname": "assessment_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_global_search": 0, - "in_list_view": 1, + "in_list_view": 0, "in_standard_filter": 0, - "label": "Assessment Plan", + "label": "Assessment Group", "length": 0, "no_copy": 0, - "options": "Assessment Plan", + "options": "Assessment Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -129,7 +315,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -180,6 +366,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Result", "length": 0, "no_copy": 0, "permlevel": 0, @@ -285,6 +472,35 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_11", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -315,35 +531,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_11", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -389,6 +576,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Summary", "length": 0, "no_copy": 0, "permlevel": 0, @@ -474,7 +662,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-11-10 18:58:32.114529", + "modified": "2018-01-09 14:14:30.090317", "modified_by": "Administrator", "module": "Education", "name": "Assessment Result", diff --git a/erpnext/education/doctype/assessment_result/assessment_result.py b/erpnext/education/doctype/assessment_result/assessment_result.py index 7459d5afe7..891b9e265d 100644 --- a/erpnext/education/doctype/assessment_result/assessment_result.py +++ b/erpnext/education/doctype/assessment_result/assessment_result.py @@ -14,15 +14,25 @@ from frappe.utils.csvutils import getlink class AssessmentResult(Document): def validate(self): - if self.student and not self.student_name: - self.student_name = frappe.db.get_value("Student", self.student, "title") - self.grading_scale = frappe.db.get_value("Assessment Plan", self.assessment_plan, "grading_scale") + self.set_missing_values() self.validate_maximum_score() self.validate_grade() self.validate_duplicate() + def set_missing_values(self): + if self.student and not self.student_name: + self.student_name = frappe.db.get_value("Student", self.student, "title") + assessment_plan_details = frappe.get_value("Assessment Plan", self.assessment_plan, ["academic_term", + "academic_year", "program", "course", "grading_scale", "assessment_group", "student_group", + "maximum_assessment_score"], as_dict=1) + + for field in assessment_plan_details: + if field != "maximum_assessment_score": + setattr(self, field, assessment_plan_details[field]) + else: + self.maximum_score = assessment_plan_details[field] + def validate_maximum_score(self): - self.maximum_score = frappe.db.get_value("Assessment Plan", self.assessment_plan, "maximum_assessment_score") assessment_details = get_assessment_details(self.assessment_plan) max_scores = {} for d in assessment_details: diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py index 824a29582e..bc6021839a 100644 --- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py +++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py @@ -10,6 +10,7 @@ from erpnext.education.api import enroll_student class ProgramEnrollmentTool(Document): def get_students(self): + students = [] if not self.get_students_from: frappe.throw(_("Mandatory field - Get Students From")) elif not self.program: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 5976915ede..8fa382cf7f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -484,4 +484,6 @@ erpnext.patches.v10_0.copy_projects_renamed_fields erpnext.patches.v10_0.enabled_regional_print_format_based_on_country erpnext.patches.v10_0.update_asset_calculate_depreciation erpnext.patches.v10_0.add_guardian_role_for_parent_portal -erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank \ No newline at end of file +erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank +erpnext.patches.v10_0.update_assessment_plan +erpnext.patches.v10_0.update_assessment_result diff --git a/erpnext/patches/v10_0/update_assessment_plan.py b/erpnext/patches/v10_0/update_assessment_plan.py new file mode 100644 index 0000000000..174623c1a4 --- /dev/null +++ b/erpnext/patches/v10_0/update_assessment_plan.py @@ -0,0 +1,17 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc('education', 'doctype', 'assessment_plan') + + frappe.db.sql(""" + UPDATE `tabAssessment Plan` as ap + INNER JOIN `tabStudent Group` as sg ON sg.name = ap.student_group + SET ap.academic_term = sg.academic_term, + ap.academic_year = sg.academic_year, + ap.program = sg.program + WHERE ap.docstatus = 1 + """) \ No newline at end of file diff --git a/erpnext/patches/v10_0/update_assessment_result.py b/erpnext/patches/v10_0/update_assessment_result.py new file mode 100644 index 0000000000..96218db972 --- /dev/null +++ b/erpnext/patches/v10_0/update_assessment_result.py @@ -0,0 +1,20 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + frappe.reload_doc('education', 'doctype', 'assessment_result') + + frappe.db.sql(""" + UPDATE `tabAssessment Result` AS ar + INNER JOIN `tabAssessment Plan` AS ap ON ap.name = ar.assessment_plan + SET ar.academic_term = ap.academic_term, + ar.academic_year = ap.academic_year, + ar.program = ap.program, + ar.course = ap.course, + ar.assessment_group = ap.assessment_group, + ar.student_group = ap.student_group + WHERE ap.docstatus = 1 + """) \ No newline at end of file