From 464289b7260f675af2ce0f338c78c7d5e98583b2 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 25 Oct 2017 12:13:42 +0530 Subject: [PATCH] copy the older total amount field and corrsp. changes in report (#11322) --- erpnext/patches.txt | 1 + erpnext/patches/v9_0/copy_old_fees_field_data.py | 11 +++++++++++ erpnext/schools/doctype/fees/fees.py | 2 +- .../student_fee_collection.json | 6 +++--- 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 erpnext/patches/v9_0/copy_old_fees_field_data.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index f6289f59ce..805e1ef259 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -452,3 +452,4 @@ erpnext.patches.v9_0.fix_subscription_next_date #2017-10-23 erpnext.patches.v9_0.add_healthcare_domain erpnext.patches.v9_0.set_variant_item_description erpnext.patches.v9_0.set_uoms_in_variant_field +erpnext.patches.v9_0.copy_old_fees_field_data diff --git a/erpnext/patches/v9_0/copy_old_fees_field_data.py b/erpnext/patches/v9_0/copy_old_fees_field_data.py new file mode 100644 index 0000000000..fb11ee5a56 --- /dev/null +++ b/erpnext/patches/v9_0/copy_old_fees_field_data.py @@ -0,0 +1,11 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +def execute(): + if "total_amount" not in frappe.db.get_table_columns("Fees"): + return + + frappe.db.sql("""update tabFees set grand_total=total_amount where grand_total = 0.0""") \ No newline at end of file diff --git a/erpnext/schools/doctype/fees/fees.py b/erpnext/schools/doctype/fees/fees.py index 42b329e4b7..bfe6af4bdb 100644 --- a/erpnext/schools/doctype/fees/fees.py +++ b/erpnext/schools/doctype/fees/fees.py @@ -112,7 +112,7 @@ def get_fee_list(doctype, txt, filters, limit_start, limit_page_length=20, order user = frappe.session.user student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user) if student: - return frappe. db.sql('''select name, program, due_date, paid_amount, outstanding_amount, total_amount from `tabFees` + return frappe. db.sql('''select name, program, due_date, paid_amount, outstanding_amount, grand_total from `tabFees` where student= %s and docstatus=1 order by due_date asc limit {0} , {1}''' .format(limit_start, limit_page_length), student, as_dict = True) diff --git a/erpnext/schools/report/student_fee_collection/student_fee_collection.json b/erpnext/schools/report/student_fee_collection/student_fee_collection.json index 264638f821..5c63765cf8 100644 --- a/erpnext/schools/report/student_fee_collection/student_fee_collection.json +++ b/erpnext/schools/report/student_fee_collection/student_fee_collection.json @@ -5,14 +5,14 @@ "disabled": 0, "docstatus": 0, "doctype": "Report", - "idx": 2, + "idx": 3, "is_standard": "Yes", - "modified": "2017-02-24 20:05:08.514320", + "modified": "2017-10-25 11:59:26.003899", "modified_by": "Administrator", "module": "Schools", "name": "Student Fee Collection", "owner": "Administrator", - "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(paid_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(total_amount) as \"Total Amount:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student", + "query": "SELECT\n student as \"Student:Link/Student:200\",\n student_name as \"Student Name::200\",\n sum(paid_amount) as \"Paid Amount:Currency:150\",\n sum(outstanding_amount) as \"Outstanding Amount:Currency:150\",\n sum(grand_total) as \"Grand Total:Currency:150\"\nFROM\n `tabFees` \nGROUP BY\n student", "ref_doctype": "Fees", "report_name": "Student Fee Collection", "report_type": "Query Report",