Patch for assessment module redesign
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index ef1e2c1..1221a4f 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -360,3 +360,5 @@
erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statment'})
erpnext.patches.v7_2.update_website_for_variant
+erpnext.patches.v7_2.update_assessment_modules
+
diff --git a/erpnext/patches/v7_2/update_assessment_modules.py b/erpnext/patches/v7_2/update_assessment_modules.py
new file mode 100644
index 0000000..da0c54c
--- /dev/null
+++ b/erpnext/patches/v7_2/update_assessment_modules.py
@@ -0,0 +1,29 @@
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+ #Rename Grading Structure to Grading Scale
+ frappe.rename_doc("DocType", "Grading Structure", "Grading Scale", force=True)
+ frappe.rename_doc("DocType", "Grade Interval", "Grading Scale Interval", force=True)
+
+ frappe.reload_doc("schools", "doctype", "grading_scale_interval")
+ rename_field("Grading Scale Interval", "to_score", "min_score")
+
+ #Rename Assessment Results
+ frappe.reload_doc("schools", "doctype", "assessment")
+ rename_field("Assessment", "grading_structure", "grading_scale")
+
+ frappe.reload_doc("schools", "doctype", "assessment_result")
+ for assessment in frappe.get_all("Assessment", fields=["name", "grading_scale"]):
+ for stud_result in frappe.db.sql("select * from `tabAssessment Result` where parent= %s", assessment.name, as_dict=True):
+ if stud_result.result:
+ assessment_result = frappe.new_doc("Assessment Result")
+ assessment_result.student = stud_result.student
+ assessment_result.student_name = stud_result.student_name
+ assessment_result.assessment = assessment.name
+ assessment_result.grading_scale = assessment.grading_scale
+ assessment_result.total_score = stud_result.result
+ assessment_result.flags.ignore_validate = True
+ assessment_result.save()
+
+ frappe.db.sql("""delete from `tabAssessment Result` where parent != '' or parent is not null""")
\ No newline at end of file
diff --git a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json
index bf7d306..87cdeec 100644
--- a/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json
+++ b/erpnext/schools/doctype/grading_scale_interval/grading_scale_interval.json
@@ -107,7 +107,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-12-14 14:32:52.892711",
+ "modified": "2016-12-29 17:10:26.153591",
"modified_by": "Administrator",
"module": "Schools",
"name": "Grading Scale Interval",