diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 362d8aa423..f8cade95ab 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -4,7 +4,7 @@ import inspect import frappe from erpnext.hooks import regional_overrides -__version__ = '9.2.7' +__version__ = '9.2.8' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index b1618d5eb9..37afed7a0e 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -185,7 +185,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals "page_len": page_len }, as_dict=as_dict) -def bom(doctype, txt, searchfield, start, page_len, filters): +def bom(doctype, txt, searchfield, filters, start=0, page_len=20): conditions = [] return frappe.db.sql("""select tabBOM.name, tabBOM.item diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 220250b131..8d7ca10a19 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -456,4 +456,5 @@ erpnext.patches.v9_0.set_variant_item_description erpnext.patches.v9_0.set_uoms_in_variant_field erpnext.patches.v9_0.copy_old_fees_field_data erpnext.patches.v9_0.set_pos_profile_name -erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings \ No newline at end of file +erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings +execute:frappe.delete_doc_if_exists("DocType", "Program Fee") diff --git a/erpnext/patches/v9_0/set_pos_profile_name.py b/erpnext/patches/v9_0/set_pos_profile_name.py index 3ae3774e3e..1958e2c777 100644 --- a/erpnext/patches/v9_0/set_pos_profile_name.py +++ b/erpnext/patches/v9_0/set_pos_profile_name.py @@ -11,7 +11,7 @@ def execute(): for pos in frappe.get_all(doctype, filters={'disabled': 0}): doc = frappe.get_doc(doctype, pos.name) - if not doc.user and doc.pos_profile_name: continue + if not doc.user or doc.pos_profile_name: continue try: doc.pos_profile_name = doc.user + ' - ' + doc.company diff --git a/erpnext/schools/doctype/assessment_plan/test_assessment_plan.js b/erpnext/schools/doctype/assessment_plan/test_assessment_plan.js index b75a41a4a0..faa39bf4e6 100644 --- a/erpnext/schools/doctype/assessment_plan/test_assessment_plan.js +++ b/erpnext/schools/doctype/assessment_plan/test_assessment_plan.js @@ -2,7 +2,7 @@ QUnit.module('schools'); QUnit.test('Test: Assessment Plan', function(assert){ - assert.expect(7); + assert.expect(6); let done = assert.async(); let room_name, instructor_name, assessment_name; @@ -49,10 +49,6 @@ QUnit.test('Test: Assessment Plan', function(assert){ assert.equal(cur_frm.doc.assessment_plan, assessment_name, 'Assessment correctly set'); assert.equal(cur_frm.doc.student_group, 'test-course-wise-group-2', 'Course for Assessment correctly set'); }, - () => cur_frm.print_doc(), - () => frappe.timeout(1), - () => {assert.ok($('.btn-print-print').is(':visible'), "Print Format Available");}, - () => done() ]); -}); \ No newline at end of file +}); diff --git a/erpnext/schools/doctype/assessment_result/assessment_result.js b/erpnext/schools/doctype/assessment_result/assessment_result.js index e75f314a04..7bd1d1960b 100644 --- a/erpnext/schools/doctype/assessment_result/assessment_result.js +++ b/erpnext/schools/doctype/assessment_result/assessment_result.js @@ -7,23 +7,25 @@ cur_frm.add_fetch("assessment_plan", "maximum_assessment_score", "maximum_score" frappe.ui.form.on("Assessment Result", { assessment_plan: function(frm) { - frappe.call({ - method: "erpnext.schools.api.get_assessment_details", - args: { - assessment_plan: frm.doc.assessment_plan - }, - callback: function(r) { - if (r.message) { - frm.doc.details = []; - $.each(r.message, function(i, d) { - var row = frappe.model.add_child(frm.doc, "Assessment Result Detail", "details"); - row.assessment_criteria = d.assessment_criteria; - row.maximum_score = d.maximum_score; - }); + if (frm.doc.assessment_plan) { + frappe.call({ + method: "erpnext.schools.api.get_assessment_details", + args: { + assessment_plan: frm.doc.assessment_plan + }, + callback: function(r) { + if (r.message) { + frm.doc.details = []; + $.each(r.message, function(i, d) { + var row = frappe.model.add_child(frm.doc, "Assessment Result Detail", "details"); + row.assessment_criteria = d.assessment_criteria; + row.maximum_score = d.maximum_score; + }); + } + refresh_field("details"); } - refresh_field("details"); - } - }); + }); + } } }); 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 a62a4d5434..116fbad81e 100644 --- a/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json +++ b/erpnext/schools/doctype/assessment_result_tool/assessment_result_tool.json @@ -175,7 +175,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-06-30 08:21:47.184562", + "modified": "2017-11-08 11:51:43.247815", "modified_by": "Administrator", "module": "Schools", "name": "Assessment Result Tool", @@ -188,17 +188,17 @@ "cancel": 0, "create": 1, "delete": 0, - "email": 1, + "email": 0, "export": 0, "if_owner": 0, "import": 0, "permlevel": 0, - "print": 1, + "print": 0, "read": 1, "report": 0, "role": "Academics User", "set_user_permissions": 0, - "share": 1, + "share": 0, "submit": 0, "write": 1 } diff --git a/erpnext/schools/doctype/fee_category/fee_category.json b/erpnext/schools/doctype/fee_category/fee_category.json index c51027a389..2b55f8d87a 100644 --- a/erpnext/schools/doctype/fee_category/fee_category.json +++ b/erpnext/schools/doctype/fee_category/fee_category.json @@ -90,7 +90,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-06-30 08:21:47.851347", + "modified": "2017-11-02 17:57:18.069158", "modified_by": "Administrator", "module": "Schools", "name": "Fee Category", @@ -116,6 +116,46 @@ "share": 1, "submit": 0, "write": 1 + }, + { + "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": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 + }, + { + "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": "Accounts Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 } ], "quick_entry": 1, diff --git a/erpnext/schools/doctype/fee_schedule/fee_schedule.json b/erpnext/schools/doctype/fee_schedule/fee_schedule.json index d2b5c52227..ab609112a1 100644 --- a/erpnext/schools/doctype/fee_schedule/fee_schedule.json +++ b/erpnext/schools/doctype/fee_schedule/fee_schedule.json @@ -25,7 +25,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 1, "in_standard_filter": 0, "label": "Fee Structure", @@ -1029,7 +1029,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-09-19 16:24:17.266071", + "modified": "2017-11-02 17:55:22.851581", "modified_by": "Administrator", "module": "Schools", "name": "Fee Schedule", @@ -1039,7 +1039,7 @@ { "amend": 1, "apply_user_permissions": 0, - "cancel": 1, + "cancel": 0, "create": 1, "delete": 1, "email": 1, @@ -1053,6 +1053,46 @@ "role": "Academics User", "set_user_permissions": 0, "share": 1, + "submit": 0, + "write": 1 + }, + { + "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": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "set_user_permissions": 0, + "share": 1, "submit": 1, "write": 1 } @@ -1060,6 +1100,7 @@ "quick_entry": 0, "read_only": 0, "read_only_onload": 0, + "restrict_to_domain": "Education", "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/schools/doctype/fee_structure/fee_structure.json b/erpnext/schools/doctype/fee_structure/fee_structure.json index d93a667bd3..2ae0a488bb 100644 --- a/erpnext/schools/doctype/fee_structure/fee_structure.json +++ b/erpnext/schools/doctype/fee_structure/fee_structure.json @@ -165,7 +165,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 1, "set_only_once": 0, "unique": 0, @@ -197,7 +197,7 @@ "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -577,7 +577,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-09-11 15:18:27.975666", + "modified": "2017-11-02 17:43:16.796845", "modified_by": "Administrator", "module": "Schools", "name": "Fee Structure", @@ -587,7 +587,7 @@ { "amend": 1, "apply_user_permissions": 0, - "cancel": 1, + "cancel": 0, "create": 1, "delete": 1, "email": 1, @@ -601,6 +601,46 @@ "role": "Academics User", "set_user_permissions": 0, "share": 1, + "submit": 0, + "write": 1 + }, + { + "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": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Accounts Manager", + "set_user_permissions": 0, + "share": 1, "submit": 1, "write": 1 } @@ -609,6 +649,7 @@ "read_only": 0, "read_only_onload": 0, "restrict_to_domain": "Education", + "search_fields": "program, student_category, academic_year", "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/schools/doctype/fees/fees.json b/erpnext/schools/doctype/fees/fees.json index ab9a792c68..f34caf77c4 100644 --- a/erpnext/schools/doctype/fees/fees.json +++ b/erpnext/schools/doctype/fees/fees.json @@ -1,7 +1,7 @@ { "allow_copy": 0, "allow_guest_to_view": 0, - "allow_import": 0, + "allow_import": 1, "allow_rename": 0, "autoname": "naming_series:", "beta": 1, @@ -87,7 +87,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 0, "label": "Student Name", @@ -118,7 +118,7 @@ "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, - "in_global_search": 0, + "in_global_search": 1, "in_list_view": 0, "in_standard_filter": 0, "label": "Fee Schedule", @@ -158,7 +158,7 @@ "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -249,7 +249,7 @@ "options": "Company", "permlevel": 0, "precision": "", - "print_hide": 1, + "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 1, @@ -310,7 +310,7 @@ "no_copy": 1, "permlevel": 0, "precision": "", - "print_hide": 1, + "print_hide": 0, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -494,7 +494,7 @@ "options": "Student Batch Name", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -708,7 +708,7 @@ "options": "Currency", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, "remember_last_selected_value": 0, @@ -739,7 +739,7 @@ "options": "Fee Structure", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1011,7 +1011,7 @@ "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1132,7 +1132,7 @@ "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1163,7 +1163,7 @@ "options": "Account", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1194,7 +1194,7 @@ "options": "Account", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1223,7 +1223,7 @@ "no_copy": 0, "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1254,6 +1254,35 @@ "options": "Cost Center", "permlevel": 0, "precision": "", + "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, + "columns": 0, + "fieldname": "data_42", + "fieldtype": "Data", + "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, @@ -1276,13 +1305,53 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-09-20 23:17:09.819606", + "modified": "2017-11-02 17:31:47.155873", "modified_by": "Administrator", "module": "Schools", "name": "Fees", "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 + }, + { + "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": "Accounts User", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, { "amend": 0, "apply_user_permissions": 0, @@ -1297,7 +1366,7 @@ "print": 1, "read": 1, "report": 1, - "role": "Academics User", + "role": "Accounts Manager", "set_user_permissions": 0, "share": 1, "submit": 1, @@ -1308,7 +1377,8 @@ "read_only": 0, "read_only_onload": 0, "restrict_to_domain": "Education", - "show_name_in_global_search": 0, + "search_fields": "student, student_name", + "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", "title_field": "student_name", diff --git a/erpnext/schools/doctype/program/program.json b/erpnext/schools/doctype/program/program.json index 95ef166cb9..46581a16ca 100644 --- a/erpnext/schools/doctype/program/program.json +++ b/erpnext/schools/doctype/program/program.json @@ -223,67 +223,6 @@ "search_index": 0, "set_only_once": 0, "unique": 0 - }, - { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "fee_schedule", - "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": "Fee Schedule", - "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, - "fieldname": "fees", - "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": "Fees", - "length": 0, - "no_copy": 0, - "options": "Program Fee", - "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 } ], "has_web_view": 0, @@ -297,7 +236,7 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2017-06-30 08:21:49.176708", + "modified": "2017-11-02 18:08:20.823972", "modified_by": "Administrator", "module": "Schools", "name": "Program", diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.py b/erpnext/schools/doctype/student_applicant/student_applicant.py index 465b4e474a..6d0957c502 100644 --- a/erpnext/schools/doctype/student_applicant/student_applicant.py +++ b/erpnext/schools/doctype/student_applicant/student_applicant.py @@ -12,10 +12,14 @@ class StudentApplicant(Document): def autoname(self): from frappe.model.naming import set_name_by_naming_series if self.student_admission: + naming_series = None if self.program: + # set the naming series from the student admission if provided. student_admission = get_student_admission_data(self.student_admission, self.program) if student_admission: naming_series = student_admission.get("applicant_naming_series") + else: + naming_series = None else: frappe.throw(_("Select the program first")) @@ -40,15 +44,16 @@ class StudentApplicant(Document): def validation_from_student_admission(self): student_admission = get_student_admission_data(self.student_admission, self.program) - if student_admission: - if (( - student_admission.minimum_age - and getdate(student_admission.minimum_age) > getdate(self.date_of_birth) - ) or ( - student_admission.maximum_age - and getdate(student_admission.maximum_age) < getdate(self.date_of_birth) - )): - frappe.throw(_("Not eligible for the admission in this program as per DOB")) + + # different validation for minimum and maximum age so that either min/max can also work independently. + if student_admission and student_admission.minimum_age and \ + getdate(student_admission.minimum_age) < getdate(self.date_of_birth): + frappe.throw(_("Not eligible for the admission in this program as per DOB")) + + if student_admission and student_admission.maximum_age and \ + getdate(student_admission.maximum_age) > getdate(self.date_of_birth): + frappe.throw(_("Not eligible for the admission in this program as per DOB")) + def on_payment_authorized(self, *args, **kwargs): self.db_set('paid', 1) 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 59c1a84240..5c28655fa7 100644 --- a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json +++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json @@ -273,7 +273,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2017-06-30 08:21:51.390809", + "modified": "2017-11-08 11:53:27.994112", "modified_by": "Administrator", "module": "Schools", "name": "Student Attendance Tool", @@ -306,17 +306,17 @@ "cancel": 0, "create": 1, "delete": 0, - "email": 1, + "email": 0, "export": 0, "if_owner": 0, "import": 0, "permlevel": 0, - "print": 1, + "print": 0, "read": 1, "report": 0, "role": "Academics User", "set_user_permissions": 0, - "share": 1, + "share": 0, "submit": 0, "write": 1 } diff --git a/erpnext/schools/doctype/student_group/student_group.py b/erpnext/schools/doctype/student_group/student_group.py index 0a7fdf1e85..950632ba50 100644 --- a/erpnext/schools/doctype/student_group/student_group.py +++ b/erpnext/schools/doctype/student_group/student_group.py @@ -7,6 +7,7 @@ import frappe from frappe.model.document import Document from frappe import _ from erpnext.schools.utils import validate_duplicate_student +from frappe.utils import cint class StudentGroup(Document): def validate(self): @@ -34,9 +35,13 @@ class StudentGroup(Document): for d in self.students: 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))) - if self.group_based_on == "Batch" and d.student not in students and frappe.defaults.get_defaults().validate_batch: + + if (self.group_based_on == "Batch") and cint(frappe.defaults.get_defaults().validate_batch)\ + and d.student not in students: frappe.throw(_("{0} - {1} is not enrolled in the Batch {2}".format(d.group_roll_number, d.student_name, self.batch))) - if self.group_based_on == "Course" and d.student not in students and frappe.defaults.get_defaults().validate_course: + + if (self.group_based_on == "Course") and cint(frappe.defaults.get_defaults().validate_course)\ + and (d.student not in students): frappe.throw(_("{0} - {1} is not enrolled in the Course {2}".format(d.group_roll_number, d.student_name, self.course))) def validate_and_set_child_table_fields(self): @@ -108,14 +113,14 @@ def fetch_students(doctype, txt, searchfield, start, page_len, filters): students = ([d.student for d in enrolled_students if d.student not in student_group_student] if enrolled_students else [""]) or [""] return frappe.db.sql("""select name, title from tabStudent - where name in ({0}) and `{1}` LIKE %s + where name in ({0}) and (`{1}` LIKE %s or title LIKE %s) order by idx desc, name limit %s, %s""".format(", ".join(['%s']*len(students)), searchfield), - tuple(students + ["%%%s%%" % txt, start, page_len])) + tuple(students + ["%%%s%%" % txt, "%%%s%%" % txt, start, page_len])) else: return frappe.db.sql("""select name, title from tabStudent - where `{0}` LIKE %s + where `{0}` LIKE %s or title LIKE %s order by idx desc, name limit %s, %s""".format(searchfield), - tuple(["%%%s%%" % txt, start, page_len])) + tuple(["%%%s%%" % txt, "%%%s%%" % txt, start, page_len])) diff --git a/erpnext/schools/report/course_wise_assessment_report/course_wise_assessment_report.py b/erpnext/schools/report/course_wise_assessment_report/course_wise_assessment_report.py index 9bdf621a61..492d738448 100644 --- a/erpnext/schools/report/course_wise_assessment_report/course_wise_assessment_report.py +++ b/erpnext/schools/report/course_wise_assessment_report/course_wise_assessment_report.py @@ -173,14 +173,16 @@ def get_column(assessment_criteria, total_maximum_score): def get_chart_data(grades, assessment_criteria_list, kounter): grades = sorted(grades) datasets = [] + for grade in grades: - tmp = [] - for ac in assessment_criteria_list: - if grade in kounter[ac]: - tmp.append(kounter[ac][grade]) + tmp = frappe._dict({"values":[], "title": grade}) + for criteria in assessment_criteria_list: + if grade in kounter[criteria]: + tmp["values"].append(kounter[criteria][grade]) else: - tmp.append(0) + tmp["values"].append(0) datasets.append(tmp) + return { "data": { "labels": assessment_criteria_list, diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py index 844d62bd17..6a6af3d583 100644 --- a/erpnext/stock/doctype/item/item.py +++ b/erpnext/stock/doctype/item/item.py @@ -91,7 +91,7 @@ class Item(WebsiteGenerator): self.validate_barcode() self.cant_change() self.validate_warehouse_for_reorder() - self.update_item_desc() + self.update_bom_item_desc() self.synced_with_hub = 0 self.validate_has_variants() @@ -599,13 +599,27 @@ class Item(WebsiteGenerator): row.label = label row.description = desc - def update_item_desc(self): - if frappe.db.get_value('BOM',self.name, 'description') != self.description: - frappe.db.sql("""update `tabBOM` set description = %s where item = %s and docstatus < 2""",(self.description, self.name)) - frappe.db.sql("""update `tabBOM Item` set description = %s where - item_code = %s and docstatus < 2""",(self.description, self.name)) - frappe.db.sql("""update `tabBOM Explosion Item` set description = %s where - item_code = %s and docstatus < 2""",(self.description, self.name)) + def update_bom_item_desc(self): + if self.is_new(): return + + if self.db_get('description') != self.description: + frappe.db.sql(""" + update `tabBOM` + set description = %s + where item = %s and docstatus < 2 + """, (self.description, self.name)) + + frappe.db.sql(""" + update `tabBOM Item` + set description = %s + where item_code = %s and docstatus < 2 + """, (self.description, self.name)) + + frappe.db.sql(""" + update `tabBOM Explosion Item` + set description = %s + where item_code = %s and docstatus < 2 + """, (self.description, self.name)) def update_template_item(self): """Set Show in Website for Template Item if True for its Variant"""