added the test case for the fees
diff --git a/erpnext/schools/doctype/academic_term/test_records.json b/erpnext/schools/doctype/academic_term/test_records.json
index 2d84383..6bd3655 100644
--- a/erpnext/schools/doctype/academic_term/test_records.json
+++ b/erpnext/schools/doctype/academic_term/test_records.json
@@ -13,5 +13,15 @@
"doctype": "Academic Term",
"academic_year": "2014-2015",
"term_name": "_Test Academic Term 2"
+ },
+ {
+ "doctype": "Academic Term",
+ "academic_year": "2017-2018",
+ "term_name": "_Test AT1"
+ },
+ {
+ "doctype": "Academic Term",
+ "academic_year": "2017-2018",
+ "term_name": "_Test AT2"
}
]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/academic_year/test_records.json b/erpnext/schools/doctype/academic_year/test_records.json
index dba4f12..5eb5e2e 100644
--- a/erpnext/schools/doctype/academic_year/test_records.json
+++ b/erpnext/schools/doctype/academic_year/test_records.json
@@ -1,11 +1,18 @@
[
{
+ "doctype": "Academic Year",
"academic_year_name": "2014-2015"
},
{
+ "doctype": "Academic Year",
"academic_year_name": "2015-2016"
},
{
+ "doctype": "Academic Year",
"academic_year_name": "2016-2017"
+ },
+ {
+ "doctype": "Academic Year",
+ "academic_year_name": "2017-2018"
}
]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_category/test_records.json b/erpnext/schools/doctype/fee_category/test_records.json
new file mode 100644
index 0000000..598c1ed
--- /dev/null
+++ b/erpnext/schools/doctype/fee_category/test_records.json
@@ -0,0 +1,11 @@
+[
+ {
+ "category_name": "Admission Fee"
+ },
+ {
+ "category_name": "Tuition Fee"
+ },
+ {
+ "category_name": "Transportation Fee"
+ }
+]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_structure/test_records.json b/erpnext/schools/doctype/fee_structure/test_records.json
new file mode 100644
index 0000000..8b7dc16
--- /dev/null
+++ b/erpnext/schools/doctype/fee_structure/test_records.json
@@ -0,0 +1,42 @@
+[
+ {
+ "doctype": "Fee Structure",
+ "academic_year": "2017-2018",
+ "academic_term": "2017-2018 (_Test AT1)",
+ "components": [
+ {
+ "fees_category": "Tuition Fee",
+ "amount": 40000
+ },
+ {
+ "fees_category": "Transportation Fee",
+ "amount": 10000
+ }
+ ],
+ "total_amount": 50000,
+ "debit_to": "_Test Receivable - _TC",
+ "against_income_account": "Sales - _TC",
+ "cost_center": "_Test Cost Center - _TC",
+ "company": "_Test Company"
+ },
+ {
+ "doctype": "Fee Structure",
+ "academic_year": "2017-2018",
+ "academic_term": "2017-2018 (_Test AT2)",
+ "components": [
+ {
+ "fees_category": "Tuition Fee",
+ "amount": 40000
+ },
+ {
+ "fees_category": "Transportation Fee",
+ "amount": 10000
+ }
+ ],
+ "total_amount": 50000,
+ "debit_to": "_Test Receivable - _TC",
+ "against_income_account": "Sales - _TC",
+ "cost_center": "_Test Cost Center - _TC",
+ "company": "_Test Company"
+ }
+]
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fees/fees.py b/erpnext/schools/doctype/fees/fees.py
index c27f818..78154e0 100644
--- a/erpnext/schools/doctype/fees/fees.py
+++ b/erpnext/schools/doctype/fees/fees.py
@@ -12,6 +12,8 @@
from erpnext.accounts.utils import get_account_currency
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
+from erpnext.accounts.general_ledger import delete_gl_entries
+
class Fees(AccountsController):
def set_indicator(self):
@@ -44,6 +46,10 @@
submit_doc=True, use_dummy_message=True)
frappe.msgprint(_("Payment request {0} created").format(getlink("Payment Request", pr.name)))
+ def on_cancel(self):
+ delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
+ # frappe.db.set(self, 'status', 'Cancelled')
+
def make_gl_entries(self):
if not self.grand_total:
diff --git a/erpnext/schools/doctype/fees/test_fees.js b/erpnext/schools/doctype/fees/test_fees.js
index 8ec7eec..22e987e 100644
--- a/erpnext/schools/doctype/fees/test_fees.js
+++ b/erpnext/schools/doctype/fees/test_fees.js
@@ -9,14 +9,22 @@
assert.expect(1);
frappe.run_serially('Fees', [
+
// insert a new Fees
- () => frappe.tests.make([
- // values to be set
- {key: 'value'}
- ]),
() => {
- assert.equal(cur_frm.doc.key, 'value');
+ return frappe.tests.make('Fees', [
+ {student: 'STUD00001'},
+ {due_date: frappe.datetime.get_today()},
+ {fee_structure: 'FS00001'}
+ ]);
},
+ () => {
+ assert.equal(cur_frm.doc.grand_total===cur_frm.doc.outstanding_amount);
+ },
+ () => frappe.timeout(0.3),
+ () => cur_frm.save(),
+ () => frappe.tests.click_button('Submit'),
+ () => frappe.tests.click_button('Yes'),
() => done()
]);
diff --git a/erpnext/schools/doctype/fees/test_fees.py b/erpnext/schools/doctype/fees/test_fees.py
index 3ea83ee..283e17b 100644
--- a/erpnext/schools/doctype/fees/test_fees.py
+++ b/erpnext/schools/doctype/fees/test_fees.py
@@ -5,8 +5,49 @@
import frappe
import unittest
+from frappe.utils import nowdate
+from frappe.utils.make_random import get_random
+
# test_records = frappe.get_test_records('Fees')
class TestFees(unittest.TestCase):
- pass
+
+ def test_fees(self):
+ student = get_random("Student")
+ fee = frappe.new_doc("Fees")
+ fee.posting_date = nowdate()
+ fee.due_date = nowdate()
+ fee.student = student
+ fee.debit_to = "_Test Receivable - _TC"
+ fee.against_income_account = "Sales - _TC"
+ fee.cost_center = "_Test Cost Center - _TC"
+ fee.company = "_Test Company"
+
+ fee.extend("components", [
+ {
+ "fees_category": "Tuition Fee",
+ "amount": 40000
+ },
+ {
+ "fees_category": "Transportation Fee",
+ "amount": 10000
+ }])
+ fee.save()
+ fee.submit()
+
+ gl_entries = frappe.db.sql("""
+ select account, posting_date, party_type, party, cost_center, fiscal_year, voucher_type,
+ voucher_no, against_voucher_type, against_voucher, cost_center, company, credit, debit
+ from `tabGL Entry` where voucher_type=%s and voucher_no=%s""", ("Fees", fee.name), as_dict=True)
+
+ if gl_entries[0].account == "_Test Receivable - _TC":
+ self.assertEquals(gl_entries[0].debit, 50000)
+ self.assertEquals(gl_entries[0].credit, 0)
+ self.assertEquals(gl_entries[1].debit, 0)
+ self.assertEquals(gl_entries[1].credit, 50000)
+ else:
+ self.assertEquals(gl_entries[0].credit, 50000)
+ self.assertEquals(gl_entries[0].debit, 0)
+ self.assertEquals(gl_entries[1].credit, 0)
+ self.assertEquals(gl_entries[1].debit, 50000)