Changes in the Fee structure (#11842)
* academic year non mandatory in the fee structure and minor changes
* update the docs
diff --git a/erpnext/docs/assets/img/education/fees/fee-structure.png b/erpnext/docs/assets/img/education/fees/fee-structure.png
index 81f3e20..cd1edaf 100644
--- a/erpnext/docs/assets/img/education/fees/fee-structure.png
+++ b/erpnext/docs/assets/img/education/fees/fee-structure.png
Binary files differ
diff --git a/erpnext/docs/user/manual/en/education/fees/fee-structure.md b/erpnext/docs/user/manual/en/education/fees/fee-structure.md
index b1cc36d..2131c4a 100644
--- a/erpnext/docs/user/manual/en/education/fees/fee-structure.md
+++ b/erpnext/docs/user/manual/en/education/fees/fee-structure.md
@@ -1,7 +1,23 @@
# Fee Structure
-A Fee Structure is a template that can be used while making fee records.
+A Fee Structure is a template that can be used while making Fees records or generating them via the Fee Schedule. In the Accounts section, you can set also the different accounts as for the Fees is an accounting transaction.
+
+You can create the Fee Structure directly from
+
+> Education > Fees > Fee Structure > New Fee Structure
+
+or you can create the Fee Structure from Program also.
<img class="screenshot" alt="Fees Structure" src="/docs/assets/img/education/fees/fee-structure.png">
+#### Academic Year Impact
+
+If the Fee amount doesn't change every academic year then Fee Structure can be created without the Acadamic year. In doing so, the same Fee Structure can be used every academic year until the Fees for that particular program doesn't change. Still you can set the academic year and term while creating the Fees or Fee Schedule records.
+
+#### Accounting Impact
+
+You can set the "Income Account" and "Receivable Account" in the Accounts section which refers to an Account of you [Chart of Accounts](/docs/user/manual/en/accounts/chart-of-accounts.md). You must also mention the Cost Center in which your income will be booked.
+
+If you are going to use this in the Fee Schedule, you must select the Accounts carefully as Fee Schedule updates the respected Accounts in bulk.
+
{next}
\ No newline at end of file
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.js b/erpnext/education/doctype/fee_schedule/fee_schedule.js
index a560ea7..a36b9cb 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.js
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.js
@@ -30,6 +30,7 @@
frm.set_query("student_group", "student_groups", function() {
return {
"program": frm.doc.program,
+ "academic_term": frm.doc.academic_term,
"academic_year": frm.doc.academic_year
};
});
@@ -95,19 +96,21 @@
frappe.ui.form.on("Fee Schedule Student Group", {
student_group: function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
- frappe.call({
- method: "erpnext.education.doctype.fee_schedule.fee_schedule.get_total_students",
- args: {
- "student_group": row.student_group,
- "academic_year": frm.doc.academic_year,
- "academic_term": frm.doc.academic_term,
- "student_category": frm.doc.student_category
- },
- callback: function(r) {
- if(!r.exc) {
- frappe.model.set_value(cdt, cdn, "total_students", r.message);
+ if (row.student_group && frm.doc.academic_year) {
+ frappe.call({
+ method: "erpnext.education.doctype.fee_schedule.fee_schedule.get_total_students",
+ args: {
+ "student_group": row.student_group,
+ "academic_year": frm.doc.academic_year,
+ "academic_term": frm.doc.academic_term,
+ "student_category": frm.doc.student_category
+ },
+ callback: function(r) {
+ if(!r.exc) {
+ frappe.model.set_value(cdt, cdn, "total_students", r.message);
+ }
}
- }
- });
+ });
+ }
}
})
\ No newline at end of file
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.json b/erpnext/education/doctype/fee_schedule/fee_schedule.json
index a1ea9bd..a77cc59 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.json
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.json
@@ -280,10 +280,10 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 0,
+ "reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -311,7 +311,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -1029,7 +1029,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-11-10 18:56:46.330631",
+ "modified": "2017-12-04 13:08:27.727709",
"modified_by": "Administrator",
"module": "Education",
"name": "Fee Schedule",
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.py b/erpnext/education/doctype/fee_schedule/fee_schedule.py
index 3e1dd0c..59acf46 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.py
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.py
@@ -34,15 +34,21 @@
return info
def validate(self):
- self.calculate_total()
+ self.calculate_total_and_program()
- def calculate_total(self):
+ def calculate_total_and_program(self):
no_of_students = 0
for d in self.student_groups:
# if not d.total_students:
d.total_students = get_total_students(d.student_group, self.academic_year,
self.academic_term, self.student_category)
no_of_students += cint(d.total_students)
+
+ # validate the program of fee structure and student groups
+ student_group_program = frappe.db.get_value("Student Group", d.student_group, "program")
+ if self.program and student_group_program and self.program != student_group_program:
+ frappe.msgprint(_("Program in the Fee Structure and Student Group {0} are different.")
+ .format(d.student_group))
self.grand_total = no_of_students*self.total_amount
self.grand_total_in_words = money_in_words(self.grand_total)
diff --git a/erpnext/education/doctype/fee_structure/fee_structure.json b/erpnext/education/doctype/fee_structure/fee_structure.json
index 428b1b1..98b8faa 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure.json
+++ b/erpnext/education/doctype/fee_structure/fee_structure.json
@@ -50,37 +50,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "student_category",
- "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": "Student Category",
- "length": 0,
- "no_copy": 0,
- "options": "Student Category",
- "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": "program",
"fieldtype": "Link",
"hidden": 0,
@@ -114,6 +83,37 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "student_category",
+ "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": "Student Category",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Student Category",
+ "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_2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -197,7 +197,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
@@ -577,7 +577,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-11-10 18:56:59.698192",
+ "modified": "2017-12-04 12:51:06.864660",
"modified_by": "Administrator",
"module": "Education",
"name": "Fee Structure",