From 30babee2ef08a04ffb8d08d085b19328b521491b Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Thu, 23 Nov 2017 12:19:57 +0530 Subject: [PATCH] add courses in the program enrollment (#11694) --- .../schools/doctype/program_enrollment/program_enrollment.js | 5 ++++- .../schools/doctype/program_enrollment/program_enrollment.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.js b/erpnext/schools/doctype/program_enrollment/program_enrollment.js index 8418e85526..89728607fc 100644 --- a/erpnext/schools/doctype/program_enrollment/program_enrollment.js +++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.js @@ -1,9 +1,12 @@ // Copyright (c) 2016, Frappe and contributors // For license information, please see license.txt -cur_frm.add_fetch('fee_structure', 'total_amount', 'amount'); frappe.ui.form.on("Program Enrollment", { + setup: function(frm) { + frm.add_fetch('fee_structure', 'total_amount', 'amount'); + }, + onload: function(frm, cdt, cdn){ frm.set_query("academic_term", "fees", function(){ return{ diff --git a/erpnext/schools/doctype/program_enrollment/program_enrollment.py b/erpnext/schools/doctype/program_enrollment/program_enrollment.py index 4e679082c6..a6f7bdfe78 100644 --- a/erpnext/schools/doctype/program_enrollment/program_enrollment.py +++ b/erpnext/schools/doctype/program_enrollment/program_enrollment.py @@ -14,6 +14,8 @@ class ProgramEnrollment(Document): self.validate_duplication() if not self.student_name: self.student_name = frappe.db.get_value("Student", self.student, "title") + if not self.courses: + self.extend("courses", self.get_courses()) def on_submit(self): self.update_student_joining_date()