From 9071bcbfa8c04e9259162727b0667bc1c05414b3 Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 31 Jan 2017 16:36:29 +0530 Subject: [PATCH 1/2] Added Student table in Guardian (Only rendered for display purpose) --- .../schools/doctype/guardian/guardian.json | 60 +++++++++++- erpnext/schools/doctype/guardian/guardian.py | 20 +++- .../doctype/guardian_student/__init__.py | 0 .../guardian_student/guardian_student.json | 96 +++++++++++++++++++ .../guardian_student/guardian_student.py | 10 ++ 5 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 erpnext/schools/doctype/guardian_student/__init__.py create mode 100644 erpnext/schools/doctype/guardian_student/guardian_student.json create mode 100644 erpnext/schools/doctype/guardian_student/guardian_student.py diff --git a/erpnext/schools/doctype/guardian/guardian.json b/erpnext/schools/doctype/guardian/guardian.json index 8368f4a097..883d728780 100644 --- a/erpnext/schools/doctype/guardian/guardian.json +++ b/erpnext/schools/doctype/guardian/guardian.json @@ -346,6 +346,62 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_13", + "fieldtype": "Section 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": "students", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Students", + "length": 0, + "no_copy": 0, + "options": "Guardian Student", + "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, @@ -414,7 +470,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2016-12-28 16:14:58.836437", + "modified": "2017-01-31 11:57:02.644296", "modified_by": "Administrator", "module": "Schools", "name": "Guardian", @@ -431,7 +487,6 @@ "export": 1, "if_owner": 0, "import": 0, - "is_custom": 0, "permlevel": 0, "print": 1, "read": 1, @@ -449,5 +504,6 @@ "sort_field": "modified", "sort_order": "DESC", "title_field": "guardian_name", + "track_changes": 0, "track_seen": 0 } \ No newline at end of file diff --git a/erpnext/schools/doctype/guardian/guardian.py b/erpnext/schools/doctype/guardian/guardian.py index 1388cfe534..38597f0fed 100644 --- a/erpnext/schools/doctype/guardian/guardian.py +++ b/erpnext/schools/doctype/guardian/guardian.py @@ -7,4 +7,22 @@ import frappe from frappe.model.document import Document class Guardian(Document): - pass + def __setup__(self): + self.onload() + + def onload(self): + """Load Students for quick view""" + self.load_students() + + def load_students(self): + """Load `students` from the database""" + self.students = [] + students = frappe.get_all("Student Guardian", filters={"guardian":self.name}, fields=["parent"]) + for student in students: + self.append("students", { + "student":student.parent, + "student_name": frappe.db.get_value("Student", student.parent, "title") + }) + + def validate(self): + self.students = [] \ No newline at end of file diff --git a/erpnext/schools/doctype/guardian_student/__init__.py b/erpnext/schools/doctype/guardian_student/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/schools/doctype/guardian_student/guardian_student.json b/erpnext/schools/doctype/guardian_student/guardian_student.json new file mode 100644 index 0000000000..ce078e64e8 --- /dev/null +++ b/erpnext/schools/doctype/guardian_student/guardian_student.json @@ -0,0 +1,96 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-01-31 11:53:21.580099", + "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", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_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": 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_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Student Name", + "length": 0, + "no_copy": 0, + "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 + } + ], + "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-01-31 11:56:14.666255", + "modified_by": "Administrator", + "module": "Schools", + "name": "Guardian Student", + "name_case": "", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 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/guardian_student/guardian_student.py b/erpnext/schools/doctype/guardian_student/guardian_student.py new file mode 100644 index 0000000000..bf6f5c1373 --- /dev/null +++ b/erpnext/schools/doctype/guardian_student/guardian_student.py @@ -0,0 +1,10 @@ +# -*- 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 GuardianStudent(Document): + pass From 477c88450f768c3a4276c58a31ff450881ef317f Mon Sep 17 00:00:00 2001 From: Neil Trini Lasrado Date: Tue, 31 Jan 2017 16:49:39 +0530 Subject: [PATCH 2/2] UI fixes for Guardian Doctype --- .../schools/doctype/guardian/guardian.json | 97 +++++++------------ .../guardian_student/guardian_student.json | 29 +++++- 2 files changed, 64 insertions(+), 62 deletions(-) diff --git a/erpnext/schools/doctype/guardian/guardian.json b/erpnext/schools/doctype/guardian/guardian.json index 883d728780..6f5e25dd36 100644 --- a/erpnext/schools/doctype/guardian/guardian.json +++ b/erpnext/schools/doctype/guardian/guardian.json @@ -129,14 +129,15 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "column_break_3", - "fieldtype": "Column Break", + "fieldname": "date_of_birth", + "fieldtype": "Date", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Date of Birth", "length": 0, "no_copy": 0, "permlevel": 0, @@ -156,15 +157,14 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "date_of_birth", - "fieldtype": "Date", + "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, - "label": "Date of Birth", "length": 0, "no_copy": 0, "permlevel": 0, @@ -263,61 +263,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "image", - "fieldtype": "Attach Image", - "hidden": 1, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Image", - "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": "section_break_9", - "fieldtype": "Section 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, @@ -346,6 +291,34 @@ "set_only_once": 0, "unique": 0 }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "image", + "fieldtype": "Attach Image", + "hidden": 1, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Image", + "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, @@ -359,6 +332,7 @@ "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Guardian Of ", "length": 0, "no_copy": 0, "permlevel": 0, @@ -415,6 +389,7 @@ "in_filter": 0, "in_list_view": 0, "in_standard_filter": 0, + "label": "Guardian Interests", "length": 0, "no_copy": 0, "permlevel": 0, @@ -470,7 +445,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2017-01-31 11:57:02.644296", + "modified": "2017-01-31 16:47:23.436075", "modified_by": "Administrator", "module": "Schools", "name": "Guardian", diff --git a/erpnext/schools/doctype/guardian_student/guardian_student.json b/erpnext/schools/doctype/guardian_student/guardian_student.json index ce078e64e8..948ed70fae 100644 --- a/erpnext/schools/doctype/guardian_student/guardian_student.json +++ b/erpnext/schools/doctype/guardian_student/guardian_student.json @@ -32,6 +32,33 @@ "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": "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, @@ -79,7 +106,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2017-01-31 11:56:14.666255", + "modified": "2017-01-31 16:40:26.551040", "modified_by": "Administrator", "module": "Schools", "name": "Guardian Student",