From 426b8a14fdf5ff5853ccfaaead83f1b02789b04b Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Tue, 9 May 2017 15:32:52 +0530 Subject: [PATCH 01/11] Merge the student group and student batch (#8663) * deleted student batch creation tool * Patch for deleting the doctype and config * Changes in the student attendance * Patch for renaming the student batch as student group * Changes in the student attendance * Change in the student attendance reports - Absent student report - Student Batch-wise attendance - Student monthly attendance sheet * Changes in the patch * Changes in the course schedule * Changes in the course scheduling tool * Change in the assessment plan * Changes in the assessment result tool * Cleanup * Changes in the api.py * create student group from student batch * delete student batch * add patch * remove student batch from config/schools.py * Delete the depricated doctype with patch * Changes in patch * Changes as per PR --- erpnext/config/schools.py | 8 - erpnext/patches.txt | 3 +- .../merge_student_batch_and_student_group.py | 49 +++ erpnext/public/js/schools/student_button.html | 4 +- erpnext/schools/api.py | 45 +-- .../doctype/assessment_code/__init__.py | 0 .../assessment_code/assessment_code.js | 8 - .../assessment_code/assessment_code.json | 89 ---- .../assessment_code/assessment_code.py | 10 - .../assessment_code/test_assessment_code.py | 12 - .../assessment_plan/assessment_plan.js | 3 +- .../assessment_plan/assessment_plan.json | 109 ++--- .../assessment_plan/assessment_plan.py | 15 +- .../assessment_result_tool.js | 6 +- .../assessment_result_tool.json | 48 +-- .../attendance_tool_student/__init__.py | 0 .../attendance_tool_student.json | 114 ------ .../attendance_tool_student.py | 10 - erpnext/schools/doctype/course/.txt | 0 .../course_schedule/course_schedule.js | 1 + .../course_schedule/course_schedule.json | 50 +-- .../course_schedule/course_schedule.py | 26 +- .../course_scheduling_tool.js | 1 - .../course_scheduling_tool.json | 251 ++++++------ .../course_scheduling_tool.py | 16 +- .../doctype/grading_scale/grading_scale.py | 2 +- .../doctype/student/student_dashboard.py | 2 +- .../student_attendance/student_attendance.js | 2 +- .../student_attendance.json | 49 +-- .../student_attendance/student_attendance.py | 28 +- .../doctype/student_attendance/untitled.txt | 20 - .../student_attendance_tool.js | 29 +- .../student_attendance_tool.json | 26 +- .../student_attendance_tool.py | 25 +- .../schools/doctype/student_batch/__init__.py | 0 .../doctype/student_batch/student_batch.js | 34 -- .../doctype/student_batch/student_batch.json | 379 ------------------ .../doctype/student_batch/student_batch.py | 24 -- .../student_batch/test_student_batch.py | 12 - .../student_batch_creation_tool/__init__.py | 0 .../student_batch_creation_tool.js | 8 - .../student_batch_creation_tool.json | 176 -------- .../student_batch_creation_tool.py | 27 -- .../student_batch_instructor/__init__.py | 0 .../student_batch_instructor.json | 123 ------ .../student_batch_instructor.py | 10 - .../doctype/student_batch_student/__init__.py | 0 .../student_batch_student.json | 148 ------- .../student_batch_student.py | 10 - .../doctype/student_group/student_group.py | 10 +- .../absent_student_report.py | 8 +- .../student_batch_wise_attendance.py | 40 +- .../student_monthly_attendance_sheet.js | 6 +- .../student_monthly_attendance_sheet.py | 18 +- 54 files changed, 405 insertions(+), 1689 deletions(-) create mode 100644 erpnext/patches/v8_0/merge_student_batch_and_student_group.py delete mode 100644 erpnext/schools/doctype/assessment_code/__init__.py delete mode 100644 erpnext/schools/doctype/assessment_code/assessment_code.js delete mode 100644 erpnext/schools/doctype/assessment_code/assessment_code.json delete mode 100644 erpnext/schools/doctype/assessment_code/assessment_code.py delete mode 100644 erpnext/schools/doctype/assessment_code/test_assessment_code.py delete mode 100644 erpnext/schools/doctype/attendance_tool_student/__init__.py delete mode 100644 erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json delete mode 100644 erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py delete mode 100644 erpnext/schools/doctype/course/.txt delete mode 100644 erpnext/schools/doctype/student_attendance/untitled.txt delete mode 100644 erpnext/schools/doctype/student_batch/__init__.py delete mode 100644 erpnext/schools/doctype/student_batch/student_batch.js delete mode 100644 erpnext/schools/doctype/student_batch/student_batch.json delete mode 100644 erpnext/schools/doctype/student_batch/student_batch.py delete mode 100644 erpnext/schools/doctype/student_batch/test_student_batch.py delete mode 100644 erpnext/schools/doctype/student_batch_creation_tool/__init__.py delete mode 100644 erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js delete mode 100644 erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json delete mode 100644 erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py delete mode 100644 erpnext/schools/doctype/student_batch_instructor/__init__.py delete mode 100644 erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json delete mode 100644 erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py delete mode 100644 erpnext/schools/doctype/student_batch_student/__init__.py delete mode 100644 erpnext/schools/doctype/student_batch_student/student_batch_student.json delete mode 100644 erpnext/schools/doctype/student_batch_student/student_batch_student.py diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py index c88a8ccf4b..c54f808bbc 100644 --- a/erpnext/config/schools.py +++ b/erpnext/config/schools.py @@ -18,10 +18,6 @@ def get_data(): "type": "doctype", "name": "Student Log" }, - { - "type": "doctype", - "name": "Student Batch" - }, { "type": "doctype", "name": "Student Group" @@ -58,10 +54,6 @@ def get_data(): { "type": "doctype", "name": "Program Enrollment Tool" - }, - { - "type": "doctype", - "name": "Student Batch Creation Tool" } ] }, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 853d3bbced..c5281bbc61 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -391,4 +391,5 @@ erpnext.patches.v8_0.set_project_copied_from erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim erpnext.patches.v7_2.stock_uom_in_selling erpnext.patches.v8_0.revert_manufacturers_table_from_item -erpnext.patches.v8_0.disable_instructor_role \ No newline at end of file +erpnext.patches.v8_0.disable_instructor_role +erpnext.patches.v8_0.merge_student_batch_and_student_group diff --git a/erpnext/patches/v8_0/merge_student_batch_and_student_group.py b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py new file mode 100644 index 0000000000..5b45cc7602 --- /dev/null +++ b/erpnext/patches/v8_0/merge_student_batch_and_student_group.py @@ -0,0 +1,49 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe +from frappe.model.utils.rename_field import * +from frappe.model.mapper import get_mapped_doc + + +def execute(): + + # for converting student batch into student group + frappe.reload_doctype("Student Group") + student_batches = frappe.db.sql('''select name as student_group_name, student_batch_name as batch, + program, academic_year, academic_term from `tabStudent Batch`''', as_dict=1) + for student_batch in student_batches: + student_batch.update({"doctype":"Student Group", "group_based_on": "Batch"}) + doc = frappe.get_doc(student_batch) + student_list = frappe.db.sql('''select student, student_name, active from `tabStudent Batch Student` + where parent=%s''', (doc.name), as_dict=1) + for i, student in enumerate(student_list): + student.update({"group_roll_number": i+1}) + + if student_list: + doc.extend("students", student_list) + + instructor_list = frappe.db.sql('''select instructor, instructor_name from `tabStudent Batch Instructor` + where parent=%s''', (doc.name), as_dict=1) + if instructor_list: + doc.extend("instructors", instructor_list) + doc.save() + + # delete the student batch and child-table + frappe.delete_doc("DocType", "Student Batch", force=1) + frappe.delete_doc("DocType", "Student Batch Student", force=1) + frappe.delete_doc("DocType", "Student Batch Instructor", force=1) + + # delete the student batch creation tool + frappe.delete_doc("DocType", "Student Batch Creation Tool", force=1) + + # delete the student batch creation tool + frappe.delete_doc("DocType", "Attendance Tool Student", force=1) + + # change the student batch to student group in the student attendance + frappe.reload_doctype("Student Attendance") + + table_columns = frappe.db.get_table_columns("Student Attendance") + if "student_batch" in table_columns: + rename_field("Student Attendance", "student_batch", "student_group") diff --git a/erpnext/public/js/schools/student_button.html b/erpnext/public/js/schools/student_button.html index 4196808355..3cf259216a 100644 --- a/erpnext/public/js/schools/student_button.html +++ b/erpnext/public/js/schools/student_button.html @@ -3,7 +3,7 @@ \ No newline at end of file diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py index 623b1e0a0e..43d24383f9 100644 --- a/erpnext/schools/api.py +++ b/erpnext/schools/api.py @@ -33,26 +33,26 @@ def enroll_student(source_name): return program_enrollment @frappe.whitelist() -def check_attendance_records_exist(course_schedule=None, student_batch=None, date=None): - """Check if Attendance Records are made against the specified Course Schedule or Student Batch for given date. +def check_attendance_records_exist(course_schedule=None, student_group=None, date=None): + """Check if Attendance Records are made against the specified Course Schedule or Student Group for given date. :param course_schedule: Course Schedule. - :param student_batch: Student Batch. + :param student_group: Student Group. :param date: Date. """ if course_schedule: return frappe.get_list("Student Attendance", filters={"course_schedule": course_schedule}) else: - return frappe.get_list("Student Attendance", filters={"student_batch": student_batch, "date": date}) + return frappe.get_list("Student Attendance", filters={"student_group": student_group, "date": date}) @frappe.whitelist() -def mark_attendance(students_present, students_absent, course_schedule=None, student_batch=None, date=None): +def mark_attendance(students_present, students_absent, course_schedule=None, student_group=None, date=None): """Creates Multiple Attendance Records. :param students_present: Students Present JSON. :param students_absent: Students Absent JSON. :param course_schedule: Course Schedule. - :param student_batch: Student Batch. + :param student_group: Student Group. :param date: Date. """ @@ -60,15 +60,15 @@ def mark_attendance(students_present, students_absent, course_schedule=None, stu absent = json.loads(students_absent) for d in present: - make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_batch, date) + make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_group, date) for d in absent: - make_attendance_records(d["student"], d["student_name"], "Absent", course_schedule, student_batch, date) + make_attendance_records(d["student"], d["student_name"], "Absent", course_schedule, student_group, date) frappe.db.commit() frappe.msgprint(_("Attendance has been marked successfully.")) -def make_attendance_records(student, student_name, status, course_schedule=None, student_batch=None, date=None): +def make_attendance_records(student, student_name, status, course_schedule=None, student_group=None, date=None): """Creates/Update Attendance Record. :param student: Student. @@ -79,7 +79,7 @@ def make_attendance_records(student, student_name, status, course_schedule=None, student_attendance_list = frappe.get_list("Student Attendance", fields = ['name'], filters = { "student": student, "course_schedule": course_schedule, - "student_batch": student_batch, + "student_group": student_group, "date": date }) @@ -90,7 +90,7 @@ def make_attendance_records(student, student_name, status, course_schedule=None, student_attendance.student = student student_attendance.student_name = student_name student_attendance.course_schedule = course_schedule - student_attendance.student_batch = student_batch + student_attendance.student_group = student_group student_attendance.date = date student_attendance.status = status student_attendance.save() @@ -105,16 +105,6 @@ def get_student_guardians(student): filters={"parent": student}) return guardians -@frappe.whitelist() -def get_student_batch_students(student_batch): - """Returns List of student, student_name, idx in Student Batch. - - :param student_batch: Student Batch. - """ - students = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , - filters={"parent": student_batch, "active": 1}, order_by= "idx") - return students - @frappe.whitelist() def get_student_group_students(student_group): """Returns List of student, student_name in Student Group. @@ -122,7 +112,7 @@ def get_student_group_students(student_group): :param student_group: Student Group. """ students = frappe.get_list("Student Group Student", fields=["student", "student_name"] , - filters={"parent": student_group, "active": 1}, order_by= "idx") + filters={"parent": student_group, "active": 1}, order_by= "group_roll_number") return students @frappe.whitelist() @@ -199,12 +189,9 @@ def get_assessment_criteria(course): fields=["assessment_criteria", "weightage"], filters={"parent": course}, order_by= "idx") @frappe.whitelist() -def get_assessment_students(assessment_plan, student_group=None, student_batch=None): - student_list = [] - if student_group: - student_list = get_student_group_students(student_group) - elif student_batch: - student_list = get_student_batch_students(student_batch) +def get_assessment_students(assessment_plan, student_group): + + student_list = get_student_group_students(student_group) for i, student in enumerate(student_list): result = get_result(student.student, assessment_plan) if result: @@ -286,8 +273,6 @@ def update_email_group(doctype, name): email_group.save() email_list = [] students = [] - if doctype == "Student Batch": - students = get_student_batch_students(name) if doctype == "Student Group": students = get_student_group_students(name) for stud in students: diff --git a/erpnext/schools/doctype/assessment_code/__init__.py b/erpnext/schools/doctype/assessment_code/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/assessment_code/assessment_code.js b/erpnext/schools/doctype/assessment_code/assessment_code.js deleted file mode 100644 index 143791b8a8..0000000000 --- a/erpnext/schools/doctype/assessment_code/assessment_code.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Assessment Code', { - refresh: function(frm) { - - } -}); diff --git a/erpnext/schools/doctype/assessment_code/assessment_code.json b/erpnext/schools/doctype/assessment_code/assessment_code.json deleted file mode 100644 index d3acf7a910..0000000000 --- a/erpnext/schools/doctype/assessment_code/assessment_code.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:assessment_code", - "beta": 0, - "creation": "2017-02-13 19:33:43.843028", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "assessment_code", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Assessment Code", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-02-13 19:33:47.037170", - "modified_by": "Administrator", - "module": "Schools", - "name": "Assessment Code", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Academics User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/assessment_code/assessment_code.py b/erpnext/schools/doctype/assessment_code/assessment_code.py deleted file mode 100644 index 175564e04e..0000000000 --- a/erpnext/schools/doctype/assessment_code/assessment_code.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class AssessmentCode(Document): - pass diff --git a/erpnext/schools/doctype/assessment_code/test_assessment_code.py b/erpnext/schools/doctype/assessment_code/test_assessment_code.py deleted file mode 100644 index d6ccb8f57d..0000000000 --- a/erpnext/schools/doctype/assessment_code/test_assessment_code.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -import frappe -import unittest - -# test_records = frappe.get_test_records('Assessment Code') - -class TestAssessmentCode(unittest.TestCase): - pass diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.js b/erpnext/schools/doctype/assessment_plan/assessment_plan.js index b1e87687ff..3c9ab80d2d 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.js +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.js @@ -2,7 +2,6 @@ // For license information, please see license.txt cur_frm.add_fetch("student_group", "course", "course"); -cur_frm.add_fetch("student_group", "student_batch", "student_batch"); cur_frm.add_fetch("examiner", "instructor_name", "examiner_name"); cur_frm.add_fetch("supervisor", "instructor_name", "supervisor_name"); @@ -12,7 +11,7 @@ frappe.ui.form.on("Assessment Plan", { frm.add_custom_button(__("Assessment Result"), function() { frappe.route_options = { assessment_plan: frm.doc.name, - student_batch: frm.doc.student_batch + student_group: frm.doc.student_group } frappe.set_route("Form", "Assessment Result Tool"); }); diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.json b/erpnext/schools/doctype/assessment_plan/assessment_plan.json index 042bdaf774..697a0d4edc 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.json +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.json @@ -43,68 +43,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "assessment_group", - "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": 1, - "label": "Assessment Group", - "length": 0, - "no_copy": 0, - "options": "Assessment Group", - "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": "student_batch", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch", - "length": 0, - "no_copy": 0, - "options": "Student Batch", - "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, @@ -113,7 +51,7 @@ "columns": 0, "fieldname": "student_group", "fieldtype": "Link", - "hidden": 1, + "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, @@ -131,7 +69,38 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "course", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 1, + "in_list_view": 0, + "in_standard_filter": 1, + "label": "Course", + "length": 0, + "no_copy": 0, + "options": "Course", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -171,19 +140,19 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "course", + "fieldname": "assessment_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 1, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 1, - "label": "Course", + "label": "Assessment Group", "length": 0, "no_copy": 0, - "options": "Course", + "options": "Assessment Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -191,7 +160,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 @@ -664,7 +633,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-04-25 12:23:32.528982", + "modified": "2017-05-02 12:54:11.991616", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Plan", diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.py b/erpnext/schools/doctype/assessment_plan/assessment_plan.py index 31e96aac5d..7f83c0176b 100644 --- a/erpnext/schools/doctype/assessment_plan/assessment_plan.py +++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.py @@ -9,21 +9,15 @@ from frappe import _ class AssessmentPlan(Document): def validate(self): - if not (self.student_batch or self.student_group): - frappe.throw(_("Please select Student Group or Student Batch")) - self.validate_student_batch() self.validate_overlap() self.validate_max_score() def validate_overlap(self): - """Validates overlap for Student Group/Student Batch, Instructor, Room""" + """Validates overlap for Student Group, Instructor, Room""" from erpnext.schools.utils import validate_overlap_for #Validate overlapping course schedules. - if self.student_batch: - validate_overlap_for(self, "Course Schedule", "student_batch") - if self.student_group: validate_overlap_for(self, "Course Schedule", "student_group") @@ -31,19 +25,12 @@ class AssessmentPlan(Document): validate_overlap_for(self, "Course Schedule", "room") #validate overlapping assessment schedules. - if self.student_batch: - validate_overlap_for(self, "Assessment Plan", "student_batch") - if self.student_group: validate_overlap_for(self, "Assessment Plan", "student_group") validate_overlap_for(self, "Assessment Plan", "room") validate_overlap_for(self, "Assessment Plan", "supervisor", self.supervisor) - def validate_student_batch(self): - if self.student_group: - self.student_batch = frappe.db.get_value("Student Group", self.student_group, "student_batch") - def validate_max_score(self): max_score = 0 for d in self.assessment_criteria: diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js index 213111ac4d..3cadea6edc 100644 --- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.js @@ -3,12 +3,11 @@ // For license information, please see license.txt cur_frm.add_fetch("assessment_plan", "student_group", "student_group"); -cur_frm.add_fetch("assessment_plan", "student_batch", "student_batch"); frappe.ui.form.on('Assessment Result Tool', { refresh: function(frm) { if (frappe.route_options) { - frm.set_value("student_batch", frappe.route_options.student_batch); + frm.set_value("student_group", frappe.route_options.student_group); frm.set_value("assessment_plan", frappe.route_options.assessment_plan); frappe.route_options = null; } @@ -17,12 +16,11 @@ frappe.ui.form.on('Assessment Result Tool', { }, assessment_plan: function(frm) { - if(!(frm.doc.student_batch || frm.doc.student_group)) return; + if(!frm.doc.student_group) return; frappe.call({ method: "erpnext.schools.api.get_assessment_students", args: { "assessment_plan": frm.doc.assessment_plan, - "student_batch": frm.doc.student_batch, "student_group": frm.doc.student_group }, callback: function(r) { diff --git a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json index 87dff4d154..d82aaf5bc8 100644 --- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json @@ -1,5 +1,6 @@ { "allow_copy": 1, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, "beta": 0, @@ -12,6 +13,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -23,6 +25,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Assessment Plan", @@ -42,6 +45,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -52,6 +56,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "length": 0, @@ -69,6 +74,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -79,6 +85,7 @@ "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 Group", @@ -92,41 +99,13 @@ "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch", - "length": 0, - "no_copy": 0, - "options": "Student Batch", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -138,6 +117,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "length": 0, @@ -155,6 +135,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -165,6 +146,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Result HTML", @@ -183,17 +165,17 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 1, "hide_toolbar": 1, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-01-05 15:45:59.338722", + "modified": "2017-05-02 15:12:30.953036", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Result Tool", @@ -210,7 +192,6 @@ "export": 0, "if_owner": 0, "import": 0, - "is_custom": 0, "permlevel": 0, "print": 1, "read": 1, @@ -225,6 +206,7 @@ "quick_entry": 1, "read_only": 0, "read_only_onload": 0, + "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", "track_changes": 0, diff --git a/erpnext/schools/doctype/attendance_tool_student/__init__.py b/erpnext/schools/doctype/attendance_tool_student/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json deleted file mode 100644 index 731de83cda..0000000000 --- a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2015-11-10 16:28:51.366668", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "student", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Student", - "length": 0, - "no_copy": 0, - "options": "Student", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "student_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Student Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "status", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Status", - "length": 0, - "no_copy": 0, - "options": "Absent\nPresent\n", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2016-07-21 12:30:02.983801", - "modified_by": "Administrator", - "module": "Schools", - "name": "Attendance Tool Student", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py deleted file mode 100644 index 99a89d987b..0000000000 --- a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class AttendanceToolStudent(Document): - pass diff --git a/erpnext/schools/doctype/course/.txt b/erpnext/schools/doctype/course/.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.js b/erpnext/schools/doctype/course_schedule/course_schedule.js index 12e852215a..6521469b24 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.js +++ b/erpnext/schools/doctype/course_schedule/course_schedule.js @@ -1,5 +1,6 @@ frappe.provide("schools") +cur_frm.add_fetch("student_group", "course", "course") frappe.ui.form.on("Course Schedule", { refresh: function(frm) { if (!frm.doc.__islocal) { diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.json b/erpnext/schools/doctype/course_schedule/course_schedule.json index d678d280a3..f70db4e2aa 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.json +++ b/erpnext/schools/doctype/course_schedule/course_schedule.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, "autoname": "naming_series:", @@ -13,36 +14,7 @@ "engine": "InnoDB", "fields": [ { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch", - "length": 0, - "no_copy": 0, - "options": "Student Batch", - "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, @@ -67,12 +39,13 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -103,6 +76,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -133,6 +107,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -161,6 +136,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -192,6 +168,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -222,6 +199,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -250,6 +228,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -280,6 +259,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -310,6 +290,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -338,6 +319,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -367,6 +349,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -396,6 +379,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -425,18 +409,18 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-02-17 17:14:46.074804", + "modified": "2017-05-02 12:12:35.785061", "modified_by": "Administrator", "module": "Schools", "name": "Course Schedule", diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.py b/erpnext/schools/doctype/course_schedule/course_schedule.py index d12ae9dfbf..845f5f5f92 100644 --- a/erpnext/schools/doctype/course_schedule/course_schedule.py +++ b/erpnext/schools/doctype/course_schedule/course_schedule.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- + # -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies and contributors # For license information, please see license.txt @@ -11,7 +11,6 @@ class CourseSchedule(Document): def validate(self): self.instructor_name = frappe.db.get_value("Instructor", self.instructor, "instructor_name") self.set_title() - self.validate_mandatory() self.validate_course() self.validate_date() self.validate_overlap() @@ -19,33 +18,23 @@ class CourseSchedule(Document): def set_title(self): """Set document Title""" self.title = self.course + " by " + (self.instructor_name if self.instructor_name else self.instructor) - - def validate_mandatory(self): - if not (self.student_batch or self.student_group): - frappe.throw(_("""Student Batch or Student Group is mandatory""")) def validate_course(self): - if self.student_group: - self.course= frappe.db.get_value("Student Group", self.student_group, "course") - - def set_student_batch(self): - if self.student_group: - self.student_batch = frappe.db.get_value("Student Group", self.student_group, "student_batch") - + group_based_on, course = frappe.db.get_value("Student Group", self.student_group, ["group_based_on", "course"]) + if group_based_on == "Course": + self.course = course + def validate_date(self): """Validates if from_time is greater than to_time""" if self.from_time > self.to_time: frappe.throw(_("From Time cannot be greater than To Time.")) def validate_overlap(self): - """Validates overlap for Student Group/Student Batch, Instructor, Room""" + """Validates overlap for Student Group, Instructor, Room""" from erpnext.schools.utils import validate_overlap_for #Validate overlapping course schedules. - if self.student_batch: - validate_overlap_for(self, "Course Schedule", "student_batch") - if self.student_group: validate_overlap_for(self, "Course Schedule", "student_group") @@ -53,9 +42,6 @@ class CourseSchedule(Document): validate_overlap_for(self, "Course Schedule", "room") #validate overlapping assessment schedules. - if self.student_batch: - validate_overlap_for(self, "Assessment Plan", "student_batch") - if self.student_group: validate_overlap_for(self, "Assessment Plan", "student_group") diff --git a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js index ea62b8f544..b835ce05d4 100644 --- a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js +++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.js @@ -2,7 +2,6 @@ // For license information, please see license.txt cur_frm.add_fetch("student_group", "program", "program"); -cur_frm.add_fetch("student_group", "student_batch", "student_batch"); cur_frm.add_fetch("student_group", "course", "course"); cur_frm.add_fetch("student_group", "academic_year", "academic_year"); cur_frm.add_fetch("student_group", "academic_term", "academic_term"); diff --git a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json index a66960ef0a..944b3d5b16 100644 --- a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json +++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.json @@ -1,5 +1,6 @@ { "allow_copy": 1, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, "beta": 0, @@ -12,35 +13,7 @@ "engine": "InnoDB", "fields": [ { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch", - "length": 0, - "no_copy": 0, - "options": "Student Batch", - "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, @@ -51,6 +24,7 @@ "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 Group", @@ -64,12 +38,13 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -80,6 +55,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Course", @@ -99,91 +75,7 @@ "unique": 0 }, { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_year", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Academic Year", - "length": 0, - "no_copy": 0, - "options": "Academic Year", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_term", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Academic Term", - "length": 0, - "no_copy": 0, - "options": "Academic Term", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "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, @@ -194,6 +86,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Program", @@ -213,16 +106,18 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "section_break_6", - "fieldtype": "Section Break", + "fieldname": "column_break_3", + "fieldtype": "Column Break", "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, "length": 0, @@ -240,6 +135,98 @@ "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "academic_year", + "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": "Academic Year", + "length": 0, + "no_copy": 0, + "options": "Academic Year", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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": "academic_term", + "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": "Academic Term", + "length": 0, + "no_copy": 0, + "options": "Academic Term", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "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": "section_break_6", + "fieldtype": "Section Break", + "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, + "length": 0, + "no_copy": 0, + "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, @@ -250,6 +237,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Instructor", @@ -269,6 +257,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -279,6 +268,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Instructor Name", @@ -298,6 +288,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -308,6 +299,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "length": 0, @@ -325,6 +317,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -335,6 +328,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Room", @@ -354,6 +348,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -364,6 +359,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "length": 0, @@ -381,6 +377,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -392,6 +389,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "From Time", @@ -410,6 +408,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -421,6 +420,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Course Start Date", @@ -440,6 +440,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -450,6 +451,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Day", @@ -469,6 +471,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -479,6 +482,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Rechedule", @@ -497,6 +501,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -507,6 +512,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "length": 0, @@ -524,6 +530,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -534,6 +541,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "To TIme", @@ -552,6 +560,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -563,6 +572,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, + "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, "label": "Course End Date", @@ -581,18 +591,18 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 1, "hide_toolbar": 1, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2016-11-21 16:58:29.295922", + "modified": "2017-05-02 12:25:35.428490", "modified_by": "Administrator", "module": "Schools", "name": "Course Scheduling Tool", @@ -609,7 +619,6 @@ "export": 0, "if_owner": 0, "import": 0, - "is_custom": 0, "permlevel": 0, "print": 0, "read": 1, @@ -624,7 +633,9 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 0, + "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", + "track_changes": 1, "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py index 86fefe20cc..4e079221ff 100644 --- a/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py +++ b/erpnext/schools/doctype/course_scheduling_tool/course_scheduling_tool.py @@ -22,10 +22,11 @@ class CourseSchedulingTool(Document): self.validate_mandatory() self.validate_date() self.instructor_name= frappe.db.get_value("Instructor", self.instructor, "instructor_name") - - if self.student_group: - self.course= frappe.db.get_value("Student Group", self.student_group, "course") - + + group_based_on, course = frappe.db.get_value("Student Group", self.student_group, ["group_based_on", "course"]) + if group_based_on == "Course": + self.course = course + if self.rechedule: rescheduled, reschedule_errors = self.delete_course_schedule(rescheduled, reschedule_errors) @@ -57,9 +58,6 @@ class CourseSchedulingTool(Document): def validate_mandatory(self): """Validates all mandatory fields""" - if not (self.student_batch or self.student_group): - frappe.throw(_("""Student Batch or Student Group is mandatory""")) - fields = ['course', 'room', 'instructor', 'from_time', 'to_time', 'course_start_date', 'course_end_date', 'day'] for d in fields: if not self.get(d): @@ -74,7 +72,6 @@ class CourseSchedulingTool(Document): """Delete all course schedule within the Date range and specified filters""" schedules = frappe.get_list("Course Schedule", fields=["name", "schedule_date"], filters = [["student_group", "=", self.student_group], - ["student_batch", "=", self.student_batch], ["course", "=", self.course], ["schedule_date", ">=", self.course_start_date], ["schedule_date", "<=", self.course_end_date]]) @@ -93,7 +90,6 @@ class CourseSchedulingTool(Document): course_schedule = frappe.new_doc("Course Schedule") course_schedule.student_group = self.student_group - course_schedule.student_batch = self.student_batch course_schedule.course = self.course course_schedule.instructor = self.instructor course_schedule.instructor_name = self.instructor_name @@ -102,4 +98,4 @@ class CourseSchedulingTool(Document): course_schedule.from_time= self.from_time course_schedule.to_time= self.to_time return course_schedule - + \ No newline at end of file diff --git a/erpnext/schools/doctype/grading_scale/grading_scale.py b/erpnext/schools/doctype/grading_scale/grading_scale.py index 4abff96462..e981f9f587 100644 --- a/erpnext/schools/doctype/grading_scale/grading_scale.py +++ b/erpnext/schools/doctype/grading_scale/grading_scale.py @@ -17,4 +17,4 @@ class GradingScale(Document): else: thresholds.append(cint(d.threshold)) if 0 not in thresholds: - frappe.throw(_("Please define grade for treshold 0%")) \ No newline at end of file + frappe.throw(_("Please define grade for Threshold 0%")) \ No newline at end of file diff --git a/erpnext/schools/doctype/student/student_dashboard.py b/erpnext/schools/doctype/student/student_dashboard.py index ca2a660292..cd2314ef12 100644 --- a/erpnext/schools/doctype/student/student_dashboard.py +++ b/erpnext/schools/doctype/student/student_dashboard.py @@ -7,7 +7,7 @@ def get_data(): 'fieldname': 'student', 'transactions': [ { - 'items': ['Student Log', 'Student Batch', 'Student Group', 'Program Enrollment'] + 'items': ['Student Log', 'Student Group', 'Program Enrollment'] }, { 'items': ['Fees', 'Assessment Result', 'Student Attendance', 'Student Leave Application'] diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.js b/erpnext/schools/doctype/student_attendance/student_attendance.js index ec2a0cbf8d..f025a1a539 100644 --- a/erpnext/schools/doctype/student_attendance/student_attendance.js +++ b/erpnext/schools/doctype/student_attendance/student_attendance.js @@ -2,4 +2,4 @@ // For license information, please see license.txt cur_frm.add_fetch("course_schedule", "schedule_date", "date"); -cur_frm.add_fetch("course_schedule", "student_batch", "student_batch") \ No newline at end of file +cur_frm.add_fetch("course_schedule", "student_group", "student_group") \ No newline at end of file diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.json b/erpnext/schools/doctype/student_attendance/student_attendance.json index e5a4075ba0..83a07d500a 100644 --- a/erpnext/schools/doctype/student_attendance/student_attendance.json +++ b/erpnext/schools/doctype/student_attendance/student_attendance.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_guest_to_view": 0, "allow_import": 1, "allow_rename": 0, "autoname": "SA.######", @@ -13,6 +14,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -43,6 +45,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -73,6 +76,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -102,6 +106,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -130,6 +135,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -160,23 +166,24 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "student_batch", + "fieldname": "student_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 1, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 1, - "label": "Student Batch", + "label": "Student Group", "length": 0, "no_copy": 0, - "options": "Student Batch", + "options": "Student Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -190,6 +197,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -219,48 +227,19 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "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": "Amended From", - "length": 0, - "no_copy": 1, - "options": "Student Attendance", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 } ], + "has_web_view": 0, "hide_heading": 0, "hide_toolbar": 0, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-02-21 01:15:20.989687", + "modified": "2017-05-01 12:02:01.116733", "modified_by": "Administrator", "module": "Schools", "name": "Student Attendance", diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.py b/erpnext/schools/doctype/student_attendance/student_attendance.py index 8a72e704d6..2688123f97 100644 --- a/erpnext/schools/doctype/student_attendance/student_attendance.py +++ b/erpnext/schools/doctype/student_attendance/student_attendance.py @@ -7,7 +7,7 @@ import frappe from frappe.model.document import Document from frappe import _ from frappe.utils import cstr -from erpnext.schools.api import get_student_batch_students, get_student_group_students +from erpnext.schools.api import get_student_group_students class StudentAttendance(Document): @@ -23,27 +23,23 @@ class StudentAttendance(Document): self.date = frappe.db.get_value("Course Schedule", self.course_schedule, "schedule_date") def validate_mandatory(self): - if not (self.student_batch or self.course_schedule): - frappe.throw(_("""Student Batch or Course Schedule is mandatory""")) + if not (self.student_group or self.course_schedule): + frappe.throw(_("""Student Group or Course Schedule is mandatory""")) def validate_course_schedule(self): if self.course_schedule: - self.student_batch = frappe.db.get_value("Course Schedule", self.course_schedule, "student_batch") + self.student_group = frappe.db.get_value("Course Schedule", self.course_schedule, "student_group") def validate_student(self): if self.course_schedule: student_group = frappe.db.get_value("Course Schedule", self.course_schedule, "student_group") - student_group_students = [] - for d in get_student_group_students(student_group): - student_group_students.append(d.student) - if student_group and self.student not in student_group_students: - frappe.throw(_("""Student {0}: {1} does not belong to Student Group {2}""".format(self.student, self.student_name, student_group))) else: - student_batch_students = [] - for d in get_student_batch_students(self.student_batch): - student_batch_students.append(d.student) - if self.student not in student_batch_students: - frappe.throw(_("""Student {0}: {1} does not belong to Student Batch {2}""".format(self.student, self.student_name, self.student_batch))) + student_group = self.student_group + student_group_students = [] + for d in get_student_group_students(student_group): + student_group_students.append(d.student) + if student_group and self.student not in student_group_students: + frappe.throw(_('''Student {0}: {1} does not belong to Student Group {2}'''.format(self.student, self.student_name, student_group))) def validate_duplication(self): """Check if the Attendance Record is Unique""" @@ -54,9 +50,9 @@ class StudentAttendance(Document): (self.student, cstr(self.course_schedule), self.name)) else: attendance_records= frappe.db.sql("""select name from `tabStudent Attendance` where \ - student= %s and student_batch= %s and date= %s and name != %s and \ + student= %s and student_group= %s and date= %s and name != %s and \ (course_schedule is Null or course_schedule='')""", - (self.student, self.student_batch, self.date, self.name)) + (self.student, self.student_group, self.date, self.name)) if attendance_records: frappe.throw(_("Attendance Record {0} exists against Student {1}") diff --git a/erpnext/schools/doctype/student_attendance/untitled.txt b/erpnext/schools/doctype/student_attendance/untitled.txt deleted file mode 100644 index b2f4c36837..0000000000 --- a/erpnext/schools/doctype/student_attendance/untitled.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document -from frappe import _ - -class Studentattendance(Document): - def validate(self): - self.validate_duplication() - - def validate_duplication(self): - attendance_records= frappe.db.sql("""select name from `tabStudent attendance` where \ - student= %s and course_schedule= %s and name != %s""", - (self.student, self.course_schedule, self.name)) - if attendance_records: - frappe.throw(_("attendance Record {0} exists against Student {1} for Course Schedule {2}") - .format(attendance_records[0][0], self.student, self.course_schedule)) diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js index 3b0022fa0d..b092a3f2ee 100644 --- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js +++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js @@ -8,22 +8,22 @@ frappe.ui.form.on('Student Attendance Tool', { }, based_on: function(frm) { - if (frm.doc.based_on == "Student Batch") { + if (frm.doc.based_on == "Student Group") { frm.set_value("course_schedule", ""); } else { - frm.set_value("student_batch", ""); + frm.set_value("student_group", ""); } }, - student_batch: function(frm) { - if ((frm.doc.student_batch && frm.doc.date) || frm.doc.course_schedule) { + student_group: function(frm) { + if ((frm.doc.student_group && frm.doc.date) || frm.doc.course_schedule) { var method = "erpnext.schools.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records"; frappe.call({ method: method, args: { based_on: frm.doc.based_on, - student_batch: frm.doc.student_batch, + student_group: frm.doc.student_group, date: frm.doc.date, course_schedule: frm.doc.course_schedule }, @@ -35,11 +35,11 @@ frappe.ui.form.on('Student Attendance Tool', { }, date: function(frm) { - frm.trigger("student_batch"); + frm.trigger("student_group"); }, course_schedule: function(frm) { - frm.trigger("student_batch"); + frm.trigger("student_group"); }, get_students: function(frm, students) { @@ -47,6 +47,7 @@ frappe.ui.form.on('Student Attendance Tool', { frm.students_area = $('
') .appendTo(frm.fields_dict.students_html.wrapper); } + console.log(students); frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students) } }); @@ -89,12 +90,12 @@ schools.StudentsEditor = Class.extend({ var get_present_student = function(student) { return students.filter(function(s) { - return s.idx === idx; + return s.group_roll_number === group_roll_number; }) } - var get_absent_student = function(idx) { + var get_absent_student = function(group_roll_number) { return students.filter(function(s) { - return s.idx === idx; + return s.group_roll_number === group_roll_number; }) } @@ -108,7 +109,7 @@ schools.StudentsEditor = Class.extend({ studs.push({ student: $check.data().student, student_name: $check.data().studentName, - idx: $check.data().idx, + group_roll_number: $check.data().group_roll_number, disabled: $check.prop("disabled"), checked: $check.is(":checked") }); @@ -132,13 +133,13 @@ schools.StudentsEditor = Class.extend({ args: { "students_present": students_present, "students_absent": students_absent, - "student_batch": frm.doc.student_batch, + "student_group": frm.doc.student_group, "course_schedule": frm.doc.course_schedule, "date": frm.doc.date }, callback: function(r) { $(me.wrapper.find(".btn-mark-att")).attr("disabled", false); - frm.trigger("student_batch"); + frm.trigger("student_group"); } }); }, @@ -152,7 +153,7 @@ schools.StudentsEditor = Class.extend({ return frappe.render_template("student_button", { student: student.student, student_name: student.student_name, - idx: student.idx, + group_roll_number: student.group_roll_number, status: student.status }) }); diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json index 51b015caa3..291e027adf 100644 --- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json +++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json @@ -1,5 +1,6 @@ { "allow_copy": 1, + "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, "beta": 0, @@ -12,6 +13,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -29,7 +31,7 @@ "label": "Based On", "length": 0, "no_copy": 0, - "options": "Student Batch\nCourse Schedule", + "options": "Student Group\nCourse Schedule", "permlevel": 0, "precision": "", "print_hide": 0, @@ -43,6 +45,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -71,12 +74,13 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.based_on ==\"Student Batch\"", - "fieldname": "student_batch", + "depends_on": "eval:doc.based_on ==\"Student Group\"", + "fieldname": "student_group", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -85,10 +89,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Student Batch", + "label": "Student Group", "length": 0, "no_copy": 0, - "options": "Student Batch", + "options": "Student Group", "permlevel": 0, "precision": "", "print_hide": 0, @@ -102,6 +106,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -133,11 +138,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.based_on ==\"Student Batch\"", + "depends_on": "eval:doc.based_on ==\"Student Group\"", "fieldname": "date", "fieldtype": "Date", "hidden": 0, @@ -163,11 +169,12 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval: (doc.course_schedule \n|| (doc.student_batch && doc.date))", + "depends_on": "eval: (doc.course_schedule \n|| (doc.student_group && doc.date))", "fieldname": "attendance", "fieldtype": "Section Break", "hidden": 0, @@ -193,6 +200,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -222,17 +230,17 @@ "unique": 0 } ], + "has_web_view": 0, "hide_heading": 1, "hide_toolbar": 1, "idx": 0, "image_view": 0, "in_create": 0, - "in_dialog": 0, "is_submittable": 0, "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-02-21 01:15:11.435110", + "modified": "2017-05-01 15:09:55.740005", "modified_by": "Administrator", "module": "Schools", "name": "Student Attendance Tool", diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py index 073474769d..be2644077a 100644 --- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py +++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py @@ -10,29 +10,28 @@ class StudentAttendanceTool(Document): pass @frappe.whitelist() -def get_student_attendance_records(based_on, date=None, student_batch=None, course_schedule=None): +def get_student_attendance_records(based_on, date=None, student_group=None, course_schedule=None): student_list = [] student_attendance_list = [] if based_on=="Course Schedule": student_group = frappe.db.get_value("Course Schedule", course_schedule, "student_group") if student_group: - student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "idx"] , \ - filters={"parent": student_group, "active": 1}, order_by= "idx") - else: - student_batch = frappe.db.get_value("Course Schedule", course_schedule, "student_batch") + student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "group_roll_number"] , \ + filters={"parent": student_group, "active": 1}, order_by= "group_roll_number") + if not student_list: - student_list = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , - filters={"parent": student_batch, "active": 1}, order_by= "idx") + student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "group_roll_number"] , + filters={"parent": student_group, "active": 1}, order_by= "group_roll_number") if course_schedule: - student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \ - course_schedule= %s""", (course_schedule), as_dict=1) + student_attendance_list= frappe.db.sql('''select student, status from `tabStudent Attendance` where \ + course_schedule= %s''', (course_schedule), as_dict=1) else: - student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \ - student_batch= %s and date= %s and \ - (course_schedule is Null or course_schedule='')""", - (student_batch, date), as_dict=1) + student_attendance_list= frappe.db.sql('''select student, status from `tabStudent Attendance` where \ + student_group= %s and date= %s and \ + (course_schedule is Null or course_schedule='')''', + (student_group, date), as_dict=1) for attendance in student_attendance_list: for student in student_list: diff --git a/erpnext/schools/doctype/student_batch/__init__.py b/erpnext/schools/doctype/student_batch/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/student_batch/student_batch.js b/erpnext/schools/doctype/student_batch/student_batch.js deleted file mode 100644 index 00b261e3a1..0000000000 --- a/erpnext/schools/doctype/student_batch/student_batch.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Student Batch', { - refresh: function(frm) { - if (!frm.doc.__islocal) { - frm.add_custom_button(__("Update Email Group"), function() { - frappe.call({ - method: "erpnext.schools.api.update_email_group", - args: { - "doctype": "Student Batch", - "name": frm.doc.name - } - }); - }); - frm.add_custom_button(__("Newsletter"), function() { - frappe.set_route("List", "Newsletter"); - }); - } - }, - - onload: function(frm){ - cur_frm.set_query("academic_term",function(){ - return{ - "filters":{ - "academic_year": (frm.doc.academic_year) - } - }; - }); - } - -}); - -cur_frm.add_fetch("student", "title", "student_name"); diff --git a/erpnext/schools/doctype/student_batch/student_batch.json b/erpnext/schools/doctype/student_batch/student_batch.json deleted file mode 100644 index 1b7239b765..0000000000 --- a/erpnext/schools/doctype/student_batch/student_batch.json +++ /dev/null @@ -1,379 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 1, - "allow_rename": 1, - "autoname": "", - "beta": 0, - "creation": "2016-07-21 15:49:53.776461", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch_name", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch Name", - "length": 0, - "no_copy": 0, - "options": "Student Batch Name", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_year", - "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": 1, - "label": "Academic Year", - "length": 0, - "no_copy": 0, - "options": "Academic Year", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "fieldname": "enabled", - "fieldtype": "Check", - "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": "Active", - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "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, - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "program", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 0, - "in_standard_filter": 1, - "label": "Program", - "length": 0, - "no_copy": 0, - "options": "Program", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_term", - "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": 1, - "label": "Academic Term", - "length": 0, - "no_copy": 0, - "options": "Academic Term", - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_6", - "fieldtype": "Section Break", - "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": "Students", - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "students", - "fieldtype": "Table", - "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": "Students", - "length": 0, - "no_copy": 0, - "options": "Student Batch Student", - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_8", - "fieldtype": "Section Break", - "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": "Instructors", - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "instructors", - "fieldtype": "Table", - "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": "Instructors", - "length": 0, - "no_copy": 0, - "options": "Student Batch Instructor", - "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 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2017-02-17 17:17:00.460594", - "modified_by": "Administrator", - "module": "Schools", - "name": "Student Batch", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "if_owner": 0, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Academics User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 0, - "read": 1, - "report": 0, - "role": "Instructor", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 0 - } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "", - "track_changes": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_batch/student_batch.py b/erpnext/schools/doctype/student_batch/student_batch.py deleted file mode 100644 index 9c0f3d7530..0000000000 --- a/erpnext/schools/doctype/student_batch/student_batch.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -from frappe.model.document import Document -from erpnext.schools.utils import validate_duplicate_student -import frappe -from frappe import _ - -class StudentBatch(Document): - def autoname(self): - prog_abb = frappe.db.get_value("Program", self.program, "program_abbreviation") - if not prog_abb: - prog_abb = self.program - self.name = prog_abb + "-"+ self.student_batch_name + "-" + self.academic_year - - def validate(self): - validate_duplicate_student(self.students) - self.validate_name() - - def validate_name(self): - if frappe.db.exists("Student Group", self.name): - frappe.throw(_("""Student Group exists with same name""")) diff --git a/erpnext/schools/doctype/student_batch/test_student_batch.py b/erpnext/schools/doctype/student_batch/test_student_batch.py deleted file mode 100644 index 55796eeb72..0000000000 --- a/erpnext/schools/doctype/student_batch/test_student_batch.py +++ /dev/null @@ -1,12 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# See license.txt -from __future__ import unicode_literals - -import frappe -import unittest - -# test_records = frappe.get_test_records('Student Batch') - -class TestStudentBatch(unittest.TestCase): - pass diff --git a/erpnext/schools/doctype/student_batch_creation_tool/__init__.py b/erpnext/schools/doctype/student_batch_creation_tool/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js deleted file mode 100644 index 316717450f..0000000000 --- a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Student Batch Creation Tool', { - refresh: function(frm) { - frm.disable_save(); - } -}); diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json deleted file mode 100644 index d94c4808fb..0000000000 --- a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "allow_copy": 1, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2016-11-14 18:20:12.160405", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "academic_year", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Academic Year", - "length": 0, - "no_copy": 0, - "options": "Academic Year", - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "program", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Program", - "length": 0, - "no_copy": 0, - "options": "Program", - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_batch_name", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Student Batch Name", - "length": 0, - "no_copy": 0, - "options": "Student Batch Name", - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "make_student_batch", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Make Student Batch", - "length": 0, - "no_copy": 0, - "options": "make_batch", - "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 - } - ], - "hide_heading": 1, - "hide_toolbar": 1, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2016-11-21 16:47:56.823988", - "modified_by": "Administrator", - "module": "Schools", - "name": "Student Batch Creation Tool", - "name_case": "", - "owner": "Administrator", - "permissions": [ - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "is_custom": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "Academics User", - "set_user_permissions": 0, - "share": 1, - "submit": 0, - "write": 1 - } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py b/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py deleted file mode 100644 index deda1373d9..0000000000 --- a/erpnext/schools/doctype/student_batch_creation_tool/student_batch_creation_tool.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class StudentBatchCreationTool(Document): - def make_batch(self): - if self.academic_year and self.program and self.student_batch_name: - students = frappe.get_list("Program Enrollment", fields=["student", "student_name"], - filters={"academic_year":self.academic_year, "program": self.program, "student_batch_name": self.student_batch_name}, - order_by= "student_name") - if students: - student_batch = frappe.new_doc("Student Batch") - student_batch.update({ - "academic_year": self.academic_year, - "program": self.program, - "student_batch_name": self.student_batch_name, - "students": students - }) - student_batch.save() - frappe.msgprint("Student Batch created.") - else: - frappe.msgprint("No students found.") - diff --git a/erpnext/schools/doctype/student_batch_instructor/__init__.py b/erpnext/schools/doctype/student_batch_instructor/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json deleted file mode 100644 index 29680fb614..0000000000 --- a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2016-11-21 19:04:48.211565", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "instructor", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Instructor", - "length": 0, - "no_copy": 0, - "options": "Instructor", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "instructor_name", - "fieldtype": "Read Only", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Instructor Name", - "length": 0, - "no_copy": 0, - "options": "instructor.instructor_name", - "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 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2016-11-21 19:08:07.680320", - "modified_by": "Administrator", - "module": "Schools", - "name": "Student Batch Instructor", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py b/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py deleted file mode 100644 index 19a759d0f3..0000000000 --- a/erpnext/schools/doctype/student_batch_instructor/student_batch_instructor.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class StudentBatchInstructor(Document): - pass diff --git a/erpnext/schools/doctype/student_batch_student/__init__.py b/erpnext/schools/doctype/student_batch_student/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/schools/doctype/student_batch_student/student_batch_student.json b/erpnext/schools/doctype/student_batch_student/student_batch_student.json deleted file mode 100644 index 3558cc8528..0000000000 --- a/erpnext/schools/doctype/student_batch_student/student_batch_student.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2016-07-22 03:27:20.120023", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Student", - "length": 0, - "no_copy": 0, - "options": "Student", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "student_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Student Name", - "length": 0, - "no_copy": 0, - "options": "student.title", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 1, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "1", - "fieldname": "active", - "fieldtype": "Check", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Active", - "length": 0, - "no_copy": 0, - "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 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2017-02-03 05:26:35.518004", - "modified_by": "Administrator", - "module": "Schools", - "name": "Student Batch Student", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/schools/doctype/student_batch_student/student_batch_student.py b/erpnext/schools/doctype/student_batch_student/student_batch_student.py deleted file mode 100644 index 542f3c4da9..0000000000 --- a/erpnext/schools/doctype/student_batch_student/student_batch_student.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe.model.document import Document - -class StudentBatchStudent(Document): - pass diff --git a/erpnext/schools/doctype/student_group/student_group.py b/erpnext/schools/doctype/student_group/student_group.py index 5520ec7b5e..81e0ed946f 100644 --- a/erpnext/schools/doctype/student_group/student_group.py +++ b/erpnext/schools/doctype/student_group/student_group.py @@ -7,7 +7,6 @@ import frappe from frappe.model.document import Document from frappe import _ from erpnext.schools.utils import validate_duplicate_student -from erpnext.schools.api import get_student_batch_students class StudentGroup(Document): def validate(self): @@ -15,6 +14,7 @@ class StudentGroup(Document): self.validate_strength() if frappe.defaults.get_defaults().student_validation_setting: self.validate_students() + self.validate_roll_no() validate_duplicate_student(self.students) def validate_mandatory_fields(self): @@ -38,6 +38,14 @@ class StudentGroup(Document): if not frappe.db.get_value("Student", d.student, "enabled") and d.active: frappe.throw(_("{0} - {1} is inactive student".format(d.group_roll_number, d.student_name))) + def validate_roll_no(self): + roll_no_list = [] + for d in self.students: + if d.group_roll_number in roll_no_list: + frappe.throw(_("Duplicate roll number for student {0}".format(d.student_name))) + else: + roll_no_list.append(d.group_roll_number) + @frappe.whitelist() def get_students(academic_year, group_based_on, academic_term=None, program=None, batch=None, course=None): enrolled_students = get_program_enrollment(academic_year, academic_term, program, batch, course) diff --git a/erpnext/schools/report/absent_student_report/absent_student_report.py b/erpnext/schools/report/absent_student_report/absent_student_report.py index ba2b7add75..094983108a 100644 --- a/erpnext/schools/report/absent_student_report/absent_student_report.py +++ b/erpnext/schools/report/absent_student_report/absent_student_report.py @@ -20,7 +20,7 @@ def execute(filters=None): data = [] for student in absent_students: if not student.student in leave_applicants: - row = [student.student, student.student_name, student.student_batch] + row = [student.student, student.student_name, student.student_group] stud_details = frappe.db.get_value("Student", student.student, ['student_email_id', 'student_mobile_number'], as_dict=True) if stud_details.student_email_id: @@ -41,15 +41,15 @@ def get_columns(filters): columns = [ _("Student") + ":Link/Student:90", _("Student Name") + "::150", - _("Student Batch") + "::180", + _("Student Group") + "::180", _("Student Email Address") + "::180", _("Student Mobile No.") + "::150", ] return columns def get_absent_students(date): - absent_students = frappe.db.sql("""select student, student_name, student_batch from `tabStudent Attendance` - where status="Absent" and date = %s order by student_batch, student_name""", date, as_dict=1) + absent_students = frappe.db.sql("""select student, student_name, student_group from `tabStudent Attendance` + where status="Absent" and date = %s order by student_group, student_name""", date, as_dict=1) return absent_students def get_leave_applications(date): diff --git a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py index d8df3a02ad..ddb4889cbf 100644 --- a/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py +++ b/erpnext/schools/report/student_batch_wise_attendance/student_batch_wise_attendance.py @@ -14,15 +14,15 @@ def execute(filters=None): columns = get_columns(filters) - active_student_batch = get_active_student_batch() + active_student_group = get_active_student_group() data = [] - for student_batch in active_student_batch: - row = [student_batch.name] + for student_group in active_student_group: + row = [student_group.name] present_students = 0 absent_students = 0 - student_batch_strength = get_student_batch_strength(student_batch.name) - student_attendance = get_student_attendance(student_batch.name, filters.get("date")) + student_group_strength = get_student_group_strength(student_group.name) + student_attendance = get_student_attendance(student_group.name, filters.get("date")) if student_attendance: for attendance in student_attendance: if attendance.status== "Present": @@ -30,35 +30,35 @@ def execute(filters=None): elif attendance.status== "Absent": absent_students = attendance.count - unmarked_students = student_batch_strength - (present_students + absent_students) - row+= [student_batch_strength, present_students, absent_students, unmarked_students] + unmarked_students = student_group_strength - (present_students + absent_students) + row+= [student_group_strength, present_students, absent_students, unmarked_students] data.append(row) return columns, data def get_columns(filters): columns = [ - _("Student batch") + ":Link/Student Batch:250", - _("Student batch Strength") + "::170", + _("Student Group") + ":Link/Student Batch:250", + _("Student Group Strength") + "::170", _("Present") + "::90", _("Absent") + "::90", _("Not Marked") + "::90" ] return columns -def get_active_student_batch(): - active_student_batch = frappe.db.sql("""select name from `tabStudent Batch` - where enabled = 1 order by name""", as_dict=1) - return active_student_batch +def get_active_student_group(): + active_student_groups = frappe.db.sql("""select name from `tabStudent Group` where group_based_on = "Batch" + and academic_year=%s order by name""", (frappe.defaults.get_defaults().academic_year), as_dict=1) + return active_student_groups -def get_student_batch_strength(student_batch): - student_batch_strength = frappe.db.sql("""select count(*) from `tabStudent Batch Student` - where parent = %s and active=1""", student_batch)[0][0] - return student_batch_strength +def get_student_group_strength(student_group): + student_group_strength = frappe.db.sql("""select count(*) from `tabStudent Group Student` + where parent = %s and active=1""", student_group)[0][0] + return student_group_strength -def get_student_attendance(student_batch, date): +def get_student_attendance(student_group, date): student_attendance = frappe.db.sql("""select count(*) as count, status from `tabStudent Attendance` where \ - student_batch= %s and date= %s and\ + student_group= %s and date= %s and\ (course_schedule is Null or course_schedule='') group by status""", - (student_batch, date), as_dict=1) + (student_group, date), as_dict=1) return student_attendance \ No newline at end of file diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js index 8d914cba2e..57927fa9d9 100644 --- a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js +++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.js @@ -19,10 +19,10 @@ frappe.query_reports["Student Monthly Attendance Sheet"] = { "reqd": 1 }, { - "fieldname": "student_batch", - "label": __("Student Batch"), + "fieldname": "student_group", + "label": __("Student Group"), "fieldtype": "Link", - "options": "Student Batch", + "options": "Student Group", "reqd": 1 } ], diff --git a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py index f906034948..91f6c364cb 100644 --- a/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py +++ b/erpnext/schools/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py @@ -6,7 +6,7 @@ import frappe from frappe.utils import cstr, cint, getdate, get_first_day, get_last_day, date_diff, add_days from frappe import msgprint, _ from calendar import monthrange -from erpnext.schools.api import get_student_batch_students +from erpnext.schools.api import get_student_group_students def execute(filters=None): if not filters: filters = {} @@ -15,9 +15,9 @@ def execute(filters=None): to_date = get_last_day(filters["month"] + '-' + filters["year"]) total_days_in_month = date_diff(to_date, from_date) +1 columns = get_columns(total_days_in_month) - students = get_student_batch_students(filters.get("student_batch")) + students = get_student_group_students(filters.get("student_group")) students_list = get_students_list(students) - att_map = get_attendance_list(from_date, to_date, filters.get("student_batch"), students_list) + att_map = get_attendance_list(from_date, to_date, filters.get("student_group"), students_list) data = [] for stud in students: row = [stud.student, stud.student_name] @@ -51,12 +51,12 @@ def get_students_list(students): student_list.append(stud.student) return student_list -def get_attendance_list(from_date, to_date, student_batch, students_list): - attendance_list = frappe.db.sql("""select student, date, status - from `tabStudent Attendance` where student_batch = %s +def get_attendance_list(from_date, to_date, student_group, students_list): + attendance_list = frappe.db.sql('''select student, date, status + from `tabStudent Attendance` where student_group = %s and date between %s and %s - order by student, date""", - (student_batch, from_date, to_date), as_dict=1) + order by student, date''', + (student_group, from_date, to_date), as_dict=1) att_map = {} students_with_leave_application = get_students_with_leave_application(from_date, to_date, students_list) for d in attendance_list: @@ -97,7 +97,7 @@ def daterange(d1, d2): @frappe.whitelist() def get_attendance_years(): - year_list = frappe.db.sql_list("""select distinct YEAR(date) from `tabStudent Attendance` ORDER BY YEAR(date) DESC""") + year_list = frappe.db.sql_list('''select distinct YEAR(date) from `tabStudent Attendance` ORDER BY YEAR(date) DESC''') if not year_list: year_list = [getdate().year] return "\n".join(str(year) for year in year_list) From 62414565b145e5d72497ca2f0cc32f93dfb5a04c Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 10 May 2017 14:52:03 +0530 Subject: [PATCH 02/11] [minor] added the address_html field in company doctype (#8754) --- erpnext/setup/doctype/company/company.js | 3 + erpnext/setup/doctype/company/company.json | 68 +++++++++++++++++++--- erpnext/setup/doctype/company/company.py | 2 + 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 0b0a02081e..ca60b1184f 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -13,7 +13,10 @@ frappe.ui.form.on("Company", { frm.set_df_property("abbr", "read_only", 1); } + frm.toggle_display('address_html', !frm.doc.__islocal); if(!frm.doc.__islocal) { + frappe.geo.render_address_and_contact(frm); + frm.toggle_enable("default_currency", (frm.doc.__onload && !frm.doc.__onload.transactions_exist)); diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 60268a983e..c5e8c5c702 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -14,6 +14,7 @@ "editable_grid": 0, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -43,6 +44,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -73,6 +75,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -104,6 +107,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -133,6 +137,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -160,6 +165,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -189,6 +195,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -217,6 +224,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -247,6 +255,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -277,6 +286,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -306,6 +316,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -335,6 +346,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -363,6 +375,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -392,6 +405,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -422,6 +436,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -453,6 +468,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -484,6 +500,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -513,6 +530,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -545,6 +563,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -575,6 +594,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -607,6 +627,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -637,6 +658,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -667,6 +689,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -697,6 +720,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -726,6 +750,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -758,6 +783,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -788,6 +814,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -818,6 +845,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -849,6 +877,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -879,6 +908,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -907,6 +937,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -937,6 +968,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -969,6 +1001,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -997,6 +1030,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1027,6 +1061,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1058,6 +1093,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1087,6 +1123,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1116,6 +1153,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1145,6 +1183,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1173,6 +1212,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1202,6 +1242,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1231,6 +1272,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1261,6 +1303,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1291,6 +1334,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1319,6 +1363,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1349,6 +1394,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1379,6 +1425,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1408,12 +1455,13 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "address", - "fieldtype": "Small Text", + "fieldname": "address_html", + "fieldtype": "HTML", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -1421,12 +1469,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Address", "length": 0, "no_copy": 0, - "oldfieldname": "address", - "oldfieldtype": "Small Text", "permlevel": 0, + "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, @@ -1438,6 +1484,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1467,6 +1514,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1498,6 +1546,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1529,6 +1578,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1560,6 +1610,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1590,6 +1641,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1621,6 +1673,7 @@ "width": "50%" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1652,6 +1705,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1693,7 +1747,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-03-14 17:04:38.115970", + "modified": "2017-05-09 11:06:33.629948", "modified_by": "Administrator", "module": "Setup", "name": "Company", @@ -1847,4 +1901,4 @@ "sort_order": "ASC", "track_changes": 1, "track_seen": 0 -} +} \ No newline at end of file diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index cc5e65d881..9f355f7ee9 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -10,9 +10,11 @@ import frappe.defaults from frappe.model.document import Document +from frappe.geo.address_and_contact import load_address_and_contact class Company(Document): def onload(self): + load_address_and_contact(self, "company") self.get("__onload")["transactions_exist"] = self.check_if_transactions_exist() def check_if_transactions_exist(self): From 323e46ba5a206e5be85f200a04174d44f8b858a4 Mon Sep 17 00:00:00 2001 From: KanchanChauhan Date: Wed, 10 May 2017 17:46:32 +0530 Subject: [PATCH 03/11] Added parent filter to the Salary Structure Employee since it was getting base and variable value from first found Salary Structure Employee (#8756) --- erpnext/hr/doctype/salary_slip/salary_slip.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index e42295810d..c7bbe65a47 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -99,7 +99,8 @@ class SalarySlip(TransactionBase): '''Returns data for evaluating formula''' data = frappe._dict() - data.update(frappe.get_doc("Salary Structure Employee", {"employee": self.employee}).as_dict()) + data.update(frappe.get_doc("Salary Structure Employee", + {"employee": self.employee, "parent": self.salary_structure}).as_dict()) data.update(frappe.get_doc("Employee", self.employee).as_dict()) data.update(self.as_dict()) From 464f108586268c3247c87c55d46f15aae736534b Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 10 May 2017 19:40:36 +0530 Subject: [PATCH 04/11] [minor] added currency in Totals for Trial Balance report (#8757) * [minor] added currency in Totals for Trial Balance report * [minor] used erpnext.get_default_currency to fetch the company currency --- .../report/trial_balance/trial_balance.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py index 5f606e4e98..9eea472086 100644 --- a/erpnext/accounts/report/trial_balance/trial_balance.py +++ b/erpnext/accounts/report/trial_balance/trial_balance.py @@ -2,7 +2,7 @@ # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals -import frappe +import frappe, erpnext from frappe import _ from frappe.utils import flt, getdate, formatdate, cstr from erpnext.accounts.report.financial_statements \ @@ -53,6 +53,7 @@ def validate_filters(filters): def get_data(filters): accounts = frappe.db.sql("""select name, parent_account, account_name, root_type, report_type, lft, rgt from `tabAccount` where company=%s order by lft""", filters.company, as_dict=True) + company_currency = erpnext.get_company_currency(filters.company) if not accounts: return None @@ -69,10 +70,10 @@ def get_data(filters): opening_balances = get_opening_balances(filters) - total_row = calculate_values(accounts, gl_entries_by_account, opening_balances, filters) + total_row = calculate_values(accounts, gl_entries_by_account, opening_balances, filters, company_currency) accumulate_values_into_parents(accounts, accounts_by_name) - data = prepare_data(accounts, filters, total_row, parent_children_map) + data = prepare_data(accounts, filters, total_row, parent_children_map, company_currency) data = filter_out_zero_value_rows(data, parent_children_map, show_zero_values=filters.get("show_zero_values")) @@ -119,7 +120,7 @@ def get_rootwise_opening_balances(filters, report_type): return opening -def calculate_values(accounts, gl_entries_by_account, opening_balances, filters): +def calculate_values(accounts, gl_entries_by_account, opening_balances, filters, company_currency): init = { "opening_debit": 0.0, "opening_credit": 0.0, @@ -137,7 +138,8 @@ def calculate_values(accounts, gl_entries_by_account, opening_balances, filters) "credit": 0.0, "parent_account": None, "indent": 0, - "has_value": True + "has_value": True, + "currency": company_currency } for d in accounts: @@ -164,9 +166,8 @@ def accumulate_values_into_parents(accounts, accounts_by_name): for key in value_fields: accounts_by_name[d.parent_account][key] += d[key] -def prepare_data(accounts, filters, total_row, parent_children_map): +def prepare_data(accounts, filters, total_row, parent_children_map, company_currency): data = [] - company_currency = frappe.db.get_value("Company", filters.company, "default_currency") for d in accounts: has_value = False From 734d7795f80f8b151b4a7b29706bfae8ecdc922a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 11 May 2017 11:38:30 +0530 Subject: [PATCH 05/11] Show party name in General Ledger print report (#8760) --- .../report/general_ledger/general_ledger.html | 10 +++++++++- .../report/general_ledger/general_ledger.js | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html index 95918117c7..b0ca19f325 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.html +++ b/erpnext/accounts/report/general_ledger/general_ledger.html @@ -5,7 +5,15 @@
{% } %}

{%= __("Statement of Account") %}

-

{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ") || "" %} {%= filters.company %}

+

+ {% if (filters.party_name) { %} + {%= filters.party_name %} + {% } else if (filters.party) { %} + {%= filters.party %} + {% } else if (filters.account) { %} + {%= filters.account %} + {% } %} +

{%= dateutil.str_to_user(filters.from_date) %} {%= __("to") %} diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index a422871b05..b5199650fb 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -74,8 +74,27 @@ frappe.query_reports["General Ledger"] = { frappe.throw(__("Please select Party Type first")); } return party_type; + }, + change: function() { + var party_type = frappe.query_report_filters_by_name.party_type.get_value(); + var party = frappe.query_report_filters_by_name.party.get_value(); + if(!party_type || !party) { + frappe.query_report_filters_by_name.party_name.set_value(""); + return; + } + + var fieldname = party_type.toLowerCase() + "_name"; + frappe.db.get_value(party_type, party, fieldname, function(value) { + frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]); + }); } }, + { + "fieldname":"party_name", + "label": __("Party Name"), + "fieldtype": "Data", + "hidden": 1 + }, { "fieldname":"group_by_voucher", "label": __("Group by Voucher"), From 0e4c5c9efb840c9c0ee9a4dbe71aabe4cb94365c Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Thu, 11 May 2017 11:40:02 +0530 Subject: [PATCH 06/11] [minor] renamed a Total Margin field to Rate With Margin (#8720) * [minor] renamed a Total Margin field to Rate With Margin * [minor] minor fixes in field lable --- .../sales_invoice_item.json | 197 ++++++++++++------ erpnext/controllers/taxes_and_totals.py | 12 +- erpnext/patches.txt | 1 + ...rename_total_margin_to_rate_with_margin.py | 24 +++ .../public/js/controllers/taxes_and_totals.js | 10 +- .../doctype/quotation/test_quotation.py | 10 +- .../quotation_item/quotation_item.json | 134 ++++++------ .../sales_order_item/sales_order_item.json | 192 +++++++++++------ .../delivery_note_item.json | 134 ++++++------ 9 files changed, 436 insertions(+), 278 deletions(-) create mode 100644 erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 80f8b57fb9..9f7085ad54 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -13,6 +13,7 @@ "editable_grid": 1, "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -41,6 +42,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -72,6 +74,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -99,6 +102,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -129,6 +133,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -157,6 +162,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -186,6 +192,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -218,6 +225,7 @@ "width": "200px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -246,6 +254,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -276,6 +285,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -305,6 +315,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -333,6 +344,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -363,6 +375,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -392,6 +405,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -419,6 +433,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -449,6 +464,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -478,6 +494,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -507,6 +524,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -535,6 +553,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -566,6 +585,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -597,6 +617,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -626,65 +647,7 @@ "unique": 0 }, { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "price_list_rate", - "fieldname": "discount_percentage", - "fieldtype": "Percent", - "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": "Discount on Price List Rate (%)", - "length": 0, - "no_copy": 0, - "oldfieldname": "adj_rate", - "oldfieldtype": "Float", - "permlevel": 0, - "print_hide": 1, - "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_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_19", - "fieldtype": "Column Break", - "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, - "length": 0, - "no_copy": 0, - "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, @@ -716,6 +679,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -746,12 +710,13 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.margin_type && doc.price_list_rate", - "fieldname": "total_margin", + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "rate_with_margin", "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, @@ -760,7 +725,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Total Margin", + "label": "Rate With Margin", "length": 0, "no_copy": 0, "permlevel": 0, @@ -776,6 +741,69 @@ "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_19", + "fieldtype": "Column Break", + "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, + "length": 0, + "no_copy": 0, + "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, + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "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": "Discount (%) on Price List Rate with Margin", + "length": 0, + "no_copy": 0, + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "precision": "2", + "print_hide": 1, + "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, @@ -803,6 +831,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -834,6 +863,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -865,6 +895,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -892,6 +923,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -923,6 +955,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -954,6 +987,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -983,6 +1017,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1011,6 +1046,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1041,6 +1077,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1071,6 +1108,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1099,6 +1137,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1129,6 +1168,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1159,6 +1199,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1189,6 +1230,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1218,6 +1260,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1246,6 +1289,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1279,6 +1323,7 @@ "width": "120px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1309,6 +1354,7 @@ "width": "120px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1336,6 +1382,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1370,6 +1417,7 @@ "width": "120px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1400,6 +1448,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1431,6 +1480,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1461,6 +1511,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1492,6 +1543,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1521,6 +1573,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1548,6 +1601,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1577,6 +1631,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1607,6 +1662,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1639,6 +1695,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1669,6 +1726,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1699,6 +1757,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1730,6 +1789,7 @@ "width": "150px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1760,6 +1820,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1789,6 +1850,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1820,6 +1882,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1850,6 +1913,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1878,6 +1942,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1909,6 +1974,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1939,6 +2005,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1969,6 +2036,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1998,6 +2066,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2028,6 +2097,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -2056,6 +2126,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -2094,7 +2165,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-04-19 11:53:26.682964", + "modified": "2017-05-10 17:14:42.681757", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 362d07515b..7889ead057 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -59,10 +59,10 @@ class calculate_taxes_and_totals(object): (1.0 - (item.discount_percentage / 100.0)), item.precision("rate")) if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']: - item.total_margin = self.calculate_margin(item) + item.rate_with_margin = self.calculate_margin(item) - item.rate = flt(item.total_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\ - if item.total_margin > 0 else item.rate + item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))\ + if item.rate_with_margin > 0 else item.rate item.net_rate = item.rate item.amount = flt(item.rate * item.qty, item.precision("amount")) @@ -487,7 +487,7 @@ class calculate_taxes_and_totals(object): self.doc.precision("base_write_off_amount")) def calculate_margin(self, item): - total_margin = 0.0 + rate_with_margin = 0.0 if item.price_list_rate: if item.pricing_rule and not self.doc.ignore_pricing_rule: pricing_rule = frappe.get_doc('Pricing Rule', item.pricing_rule) @@ -496,6 +496,6 @@ class calculate_taxes_and_totals(object): if item.margin_type and item.margin_rate_or_amount: margin_value = item.margin_rate_or_amount if item.margin_type == 'Amount' else flt(item.price_list_rate) * flt(item.margin_rate_or_amount) / 100 - total_margin = flt(item.price_list_rate) + flt(margin_value) + rate_with_margin = flt(item.price_list_rate) + flt(margin_value) - return total_margin + return rate_with_margin diff --git a/erpnext/patches.txt b/erpnext/patches.txt index c5281bbc61..b28ef229a3 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -393,3 +393,4 @@ erpnext.patches.v7_2.stock_uom_in_selling erpnext.patches.v8_0.revert_manufacturers_table_from_item erpnext.patches.v8_0.disable_instructor_role erpnext.patches.v8_0.merge_student_batch_and_student_group +erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin \ No newline at end of file diff --git a/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py b/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py new file mode 100644 index 0000000000..a324751241 --- /dev/null +++ b/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py @@ -0,0 +1,24 @@ +from __future__ import unicode_literals +import frappe + +from frappe.model.utils.rename_field import rename_field + +def execute(): + """ + Rename Total Margin field to Rate With Margin in + "Sales Order Item", "Sales Invoice Item", "Delivery Note Item", + "Quotation Item" + """ + + for d in ("Sales Order Item", "Sales Invoice Item", + "Delivery Note Item", "Quotation Item"): + + rename_field_if_exists(d, "total_margin", "rate_with_margin") + + +def rename_field_if_exists(doctype, old_fieldname, new_fieldname): + try: + rename_field(doctype, old_fieldname, new_fieldname) + except Exception, e: + if e.args[0] != 1054: + raise diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 08dd224fb1..c925f4577b 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -5,17 +5,17 @@ erpnext.taxes_and_totals = erpnext.payments.extend({ setup: function() {}, apply_pricing_rule_on_item: function(item){ if(item.margin_type == "Percentage"){ - item.total_margin = flt(item.price_list_rate) + item.rate_with_margin = flt(item.price_list_rate) + flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100); } else { - item.total_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount); + item.rate_with_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount); } - item.rate = flt(item.total_margin , precision("rate", item)); + item.rate = flt(item.rate_with_margin , precision("rate", item)); if(item.discount_percentage){ - discount_value = flt(item.total_margin) * flt(item.discount_percentage) / 100; - item.rate = flt((item.total_margin) - (discount_value), precision('rate', item)); + discount_value = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100; + item.rate = flt((item.rate_with_margin) - (discount_value), precision('rate', item)); } }, diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py index 36cc472574..640c026c66 100644 --- a/erpnext/selling/doctype/quotation/test_quotation.py +++ b/erpnext/selling/doctype/quotation/test_quotation.py @@ -37,7 +37,7 @@ class TestQuotation(unittest.TestCase): from erpnext.selling.doctype.sales_order.sales_order \ import make_delivery_note, make_sales_invoice - total_margin = flt((1500*18.75)/100 + 1500) + rate_with_margin = flt((1500*18.75)/100 + 1500) test_records[0]['items'][0]['price_list_rate'] = 1500 test_records[0]['items'][0]['margin_type'] = 'Percentage' @@ -46,7 +46,7 @@ class TestQuotation(unittest.TestCase): quotation = frappe.copy_doc(test_records[0]) quotation.insert() - self.assertEquals(quotation.get("items")[0].rate, total_margin) + self.assertEquals(quotation.get("items")[0].rate, rate_with_margin) self.assertRaises(frappe.ValidationError, make_sales_order, quotation.name) quotation.submit() @@ -56,16 +56,16 @@ class TestQuotation(unittest.TestCase): sales_order.transaction_date = "2016-01-01" sales_order.insert() - self.assertEquals(quotation.get("items")[0].rate, total_margin) + self.assertEquals(quotation.get("items")[0].rate, rate_with_margin) sales_order.submit() dn = make_delivery_note(sales_order.name) - self.assertEquals(quotation.get("items")[0].rate, total_margin) + self.assertEquals(quotation.get("items")[0].rate, rate_with_margin) dn.save() si = make_sales_invoice(sales_order.name) - self.assertEquals(quotation.get("items")[0].rate, total_margin) + self.assertEquals(quotation.get("items")[0].rate, rate_with_margin) si.save() test_records = frappe.get_test_records('Quotation') diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index fe747ec4f8..794494d8ee 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -632,69 +632,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "price_list_rate", - "fieldname": "discount_percentage", - "fieldtype": "Percent", - "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": "Discount on Price List Rate (%)", - "length": 0, - "no_copy": 0, - "oldfieldname": "adj_rate", - "oldfieldtype": "Float", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": "100px", - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "100px" - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_18", - "fieldtype": "Column Break", - "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, - "length": 0, - "no_copy": 0, - "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, @@ -764,8 +701,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.margin_type && doc.price_list_rate", - "fieldname": "total_margin", + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "rate_with_margin", "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, @@ -774,7 +711,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Total Margin", + "label": "Rate With Margin", "length": 0, "no_copy": 0, "permlevel": 0, @@ -789,6 +726,69 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_18", + "fieldtype": "Column Break", + "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, + "length": 0, + "no_copy": 0, + "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, + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "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": "Discount (%) on Price List Rate with Margin", + "length": 0, + "no_copy": 0, + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "100px" + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1583,7 +1583,7 @@ "istable": 1, "max_attachments": 0, "menu_index": 0, - "modified": "2017-04-25 10:34:17.987184", + "modified": "2017-05-10 17:14:45.736424", "modified_by": "Administrator", "module": "Selling", "name": "Quotation Item", diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json index 10096d0ae4..2aae9118ff 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -14,6 +14,7 @@ "engine": "InnoDB", "fields": [ { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 1, "collapsible": 0, @@ -47,6 +48,7 @@ "width": "150px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -75,6 +77,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -102,6 +105,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -134,6 +138,7 @@ "width": "150" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -163,6 +168,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -195,6 +201,7 @@ "width": "300px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -223,6 +230,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -252,6 +260,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -282,6 +291,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -310,6 +320,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -342,6 +353,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -375,6 +387,7 @@ "width": "70px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -402,6 +415,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -432,6 +446,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -461,6 +476,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -490,6 +506,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -518,6 +535,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -551,6 +569,7 @@ "width": "70px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -584,6 +603,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -613,67 +633,7 @@ "unique": 0 }, { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "price_list_rate", - "fieldname": "discount_percentage", - "fieldtype": "Percent", - "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": "Discount on Price List Rate (%)", - "length": 0, - "no_copy": 0, - "oldfieldname": "adj_rate", - "oldfieldtype": "Float", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": "70px", - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "70px" - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_19", - "fieldtype": "Column Break", - "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, - "length": 0, - "no_copy": 0, - "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, @@ -705,6 +665,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -735,12 +696,13 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.margin_type && doc.price_list_rate", - "fieldname": "total_margin", + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "rate_with_margin", "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, @@ -749,7 +711,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Total Margin", + "label": "Rate With Margin", "length": 0, "no_copy": 0, "permlevel": 0, @@ -765,6 +727,70 @@ "unique": 0 }, { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_19", + "fieldtype": "Column Break", + "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, + "length": 0, + "no_copy": 0, + "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, + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "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": "Discount (%) on Price List Rate with Margin", + "length": 0, + "no_copy": 0, + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "70px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "70px" + }, + { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -781,6 +807,7 @@ "length": 0, "no_copy": 0, "permlevel": 0, + "precision": "2", "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, @@ -792,6 +819,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -826,6 +854,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -860,6 +889,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -887,6 +917,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -920,6 +951,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -953,6 +985,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -982,6 +1015,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1010,6 +1044,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1040,6 +1075,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1070,6 +1106,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1098,6 +1135,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1128,6 +1166,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1158,6 +1197,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 1, @@ -1188,6 +1228,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1217,6 +1258,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1247,6 +1289,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1275,6 +1318,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1309,6 +1353,7 @@ "width": "150px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1340,6 +1385,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1371,6 +1417,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1402,6 +1449,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1434,6 +1482,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1464,6 +1513,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1491,6 +1541,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1523,6 +1574,7 @@ "width": "70px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 1, "bold": 0, "collapsible": 0, @@ -1553,6 +1605,7 @@ "width": "70px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1582,6 +1635,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1614,6 +1668,7 @@ "width": "100px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1644,6 +1699,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1673,6 +1729,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1703,6 +1760,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1733,6 +1791,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1766,6 +1825,7 @@ "width": "50px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1799,6 +1859,7 @@ "width": "50px" }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1829,6 +1890,7 @@ "unique": 0 }, { + "allow_bulk_edit": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -1871,7 +1933,7 @@ "istable": 1, "max_attachments": 0, "menu_index": 0, - "modified": "2017-04-18 18:43:47.150922", + "modified": "2017-05-10 17:14:48.277982", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json index 71a22e9daa..a441a7f51d 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -661,69 +661,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "price_list_rate", - "fieldname": "discount_percentage", - "fieldtype": "Float", - "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": "Discount on Price List Rate (%)", - "length": 0, - "no_copy": 0, - "oldfieldname": "adj_rate", - "oldfieldtype": "Float", - "permlevel": 0, - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": "100px", - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0, - "width": "100px" - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_19", - "fieldtype": "Column Break", - "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, - "length": 0, - "no_copy": 0, - "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, @@ -793,8 +730,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:doc.margin_type && doc.price_list_rate", - "fieldname": "total_margin", + "depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount", + "fieldname": "rate_with_margin", "fieldtype": "Currency", "hidden": 0, "ignore_user_permissions": 0, @@ -803,7 +740,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Total Margin", + "label": "Rate With Margin", "length": 0, "no_copy": 0, "permlevel": 0, @@ -818,6 +755,69 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_19", + "fieldtype": "Column Break", + "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, + "length": 0, + "no_copy": 0, + "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, + "depends_on": "price_list_rate", + "fieldname": "discount_percentage", + "fieldtype": "Float", + "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": "Discount (%) on Price List Rate with Margin", + "length": 0, + "no_copy": 0, + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "print_hide": 1, + "print_hide_if_no_value": 0, + "print_width": "100px", + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "unique": 0, + "width": "100px" + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -1956,7 +1956,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-04-28 14:18:51.028570", + "modified": "2017-05-10 17:14:50.456930", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", From f74010d379dc006eb1483650a02b5527f312dcd9 Mon Sep 17 00:00:00 2001 From: KanchanChauhan Date: Thu, 11 May 2017 11:42:35 +0530 Subject: [PATCH 07/11] Calculations based on working and payment days should be made if salary structure exists (#8770) --- erpnext/hr/doctype/salary_slip/salary_slip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py index c7bbe65a47..e18fc27e67 100644 --- a/erpnext/hr/doctype/salary_slip/salary_slip.py +++ b/erpnext/hr/doctype/salary_slip/salary_slip.py @@ -327,10 +327,10 @@ class SalarySlip(TransactionBase): relieving_date = getdate(self.end_date) if not joining_date: - frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(employee.employee))) + frappe.throw(_("Please set the Date Of Joining for employee {0}").format(frappe.bold(self.employee_name))) for d in self.get(component_type): - if ((cint(d.depends_on_lwp) == 1 and not self.salary_slip_based_on_timesheet) or\ + if self.salary_structure and ((cint(d.depends_on_lwp) == 1 and not self.salary_slip_based_on_timesheet) or\ getdate(self.start_date) < joining_date or getdate(self.end_date) > relieving_date): d.amount = rounded((flt(d.default_amount) * flt(self.payment_days) From 62d27ab7d3ccca2c29c2f044dac831ff71a57563 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 May 2017 13:26:55 +0530 Subject: [PATCH 08/11] Reload doctype bewfore renaming margin fields (#8771) --- erpnext/patches.txt | 2 +- erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index b28ef229a3..8907cf3e16 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -393,4 +393,4 @@ erpnext.patches.v7_2.stock_uom_in_selling erpnext.patches.v8_0.revert_manufacturers_table_from_item erpnext.patches.v8_0.disable_instructor_role erpnext.patches.v8_0.merge_student_batch_and_student_group -erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin \ No newline at end of file +erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin # 11-05-2017 \ No newline at end of file diff --git a/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py b/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py index a324751241..3fc477ec8f 100644 --- a/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py +++ b/erpnext/patches/v8_0/rename_total_margin_to_rate_with_margin.py @@ -12,7 +12,7 @@ def execute(): for d in ("Sales Order Item", "Sales Invoice Item", "Delivery Note Item", "Quotation Item"): - + frappe.reload_doctype(d) rename_field_if_exists(d, "total_margin", "rate_with_margin") From 5ad612683223e5a5b01d2a2cea929aaa4ff877a3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 May 2017 13:34:04 +0530 Subject: [PATCH 09/11] On saving of Accounts Settings, only save enabled warehouses (#8772) --- erpnext/accounts/doctype/account/account.py | 6 +++--- .../doctype/accounts_settings/accounts_settings.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 998fee9732..189d37754f 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -188,9 +188,9 @@ class Account(Document): account_balance = get_balance_on(self.name) if account_balance != stock_balance: - frappe.throw(_('Account balance ({0}) and stock value ({1}) must be same')\ - .format(fmt_money(account_balance, currency=self.account_currency), - fmt_money(stock_balance, currency=self.account_currency))) + frappe.throw(_('Account balance ({0}) for {1} and stock value ({2}) for warehouse {3} must be same') + .format(fmt_money(account_balance, currency=self.account_currency), self.name, + fmt_money(stock_balance, currency=self.account_currency), self.warehouse)) elif self.warehouse: self.warehouse = None diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index 5f569a8305..52e1b63871 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -21,10 +21,13 @@ class AccountsSettings(Document): company.save() # Create account head for warehouses - warehouse_list = frappe.db.sql("select name, company from tabWarehouse", as_dict=1) + warehouse_list = frappe.db.sql("""select name, company from tabWarehouse + where disabled=0""", as_dict=1) warehouse_with_no_company = [d.name for d in warehouse_list if not d.company] if warehouse_with_no_company: - frappe.throw(_("Company is missing in warehouses {0}").format(comma_and(warehouse_with_no_company))) + frappe.throw(_("Company is missing in warehouses {0}") + .format(comma_and(warehouse_with_no_company))) + for wh in warehouse_list: wh_doc = frappe.get_doc("Warehouse", wh.name) wh_doc.flags.ignore_permissions = True From 4f5ad50ecf2410686633d1f169d3181c64ab1336 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 May 2017 16:44:19 +0530 Subject: [PATCH 10/11] Item Rate in Sales Return must be less than or equal to reference doc (#8775) * Item Rate in Sales Return must be less than or equal to reference doc * Fix as rate field is not there in Packed Item --- erpnext/controllers/sales_and_purchase_return.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py index d8f28af1d6..d2f894a6a4 100644 --- a/erpnext/controllers/sales_and_purchase_return.py +++ b/erpnext/controllers/sales_and_purchase_return.py @@ -53,8 +53,8 @@ def validate_returned_items(doc): valid_items = frappe._dict() - select_fields = "item_code, qty, parenttype" if doc.doctype=="Purchase Invoice" \ - else "item_code, qty, serial_no, batch_no, parenttype" + select_fields = "item_code, qty, rate, parenttype" if doc.doctype=="Purchase Invoice" \ + else "item_code, qty, rate, serial_no, batch_no, parenttype" if doc.doctype in ['Purchase Invoice', 'Purchase Receipt']: select_fields += ",rejected_qty, received_qty" @@ -82,10 +82,15 @@ def validate_returned_items(doc): else: ref = valid_items.get(d.item_code, frappe._dict()) validate_quantity(doc, d, ref, valid_items, already_returned_items) - - if ref.batch_no and d.batch_no not in ref.batch_no: + + if ref.rate and doc.doctype in ("Delivery Note", "Sales Invoice") and flt(d.rate) > ref.rate: + frappe.throw(_("Row # {0}: Rate cannot be greater than the rate used in {1} {2}") + .format(d.idx, doc.doctype, doc.return_against)) + + elif ref.batch_no and d.batch_no not in ref.batch_no: frappe.throw(_("Row # {0}: Batch No must be same as {1} {2}") .format(d.idx, doc.doctype, doc.return_against)) + elif ref.serial_no: if not d.serial_no: frappe.throw(_("Row # {0}: Serial No is mandatory").format(d.idx)) @@ -131,6 +136,7 @@ def get_ref_item_dict(valid_items, ref_item_row): valid_items.setdefault(ref_item_row.item_code, frappe._dict({ "qty": 0, + "rate": 0, "rejected_qty": 0, "received_qty": 0, "serial_no": [], @@ -138,6 +144,7 @@ def get_ref_item_dict(valid_items, ref_item_row): })) item_dict = valid_items[ref_item_row.item_code] item_dict["qty"] += ref_item_row.qty + item_dict["rate"] = ref_item_row.get("rate", 0) if ref_item_row.parenttype in ['Purchase Invoice', 'Purchase Receipt']: item_dict["received_qty"] += ref_item_row.received_qty From b579fd7ada605f40c8b53429cc2a27389e984ca2 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 11 May 2017 17:36:56 +0600 Subject: [PATCH 11/11] bumped to version 8.0.25 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 693c9bee1b..b378f21957 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals import frappe -__version__ = '8.0.24' +__version__ = '8.0.25' def get_default_company(user=None): '''Get default company for user'''