Merge pull request #7851 from rohitwaghchaure/account_paid_to_payment_entry
[Fix] Payment entry account Paid To Show receivable accounts for supplier
diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py
index e95b734..b1e0472 100644
--- a/erpnext/config/schools.py
+++ b/erpnext/config/schools.py
@@ -116,7 +116,8 @@
},
{
"type": "doctype",
- "name": "Assessment Group"
+ "name": "Assessment Group",
+ "link": "Tree/Assessment Group",
},
{
"type": "doctype",
diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py
index 25ae1b2..cb73159 100644
--- a/erpnext/controllers/print_settings.py
+++ b/erpnext/controllers/print_settings.py
@@ -16,14 +16,13 @@
if doc.flags.compact_item_print:
doc.print_templates["description"] = "templates/print_formats/includes/item_table_description.html"
- doc.hide_in_print_layout += ["item_code", "item_name", "image"]
-
doc.flags.compact_item_fields = ["description", "qty", "rate", "amount"]
- doc.flags.show_in_description = []
+ doc.flags.format_columns = format_columns
- for df in doc.meta.fields:
- if df.fieldtype not in ("Section Break", "Column Break", "Button"):
- if not doc.is_print_hide(df.fieldname):
- if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in doc.flags.compact_item_fields:
- doc.hide_in_print_layout.append(df.fieldname)
- doc.flags.show_in_description.append(df.fieldname)
+def format_columns(display_columns, compact_fields):
+ compact_fields = compact_fields + ["image", "item_code", "item_name"]
+ final_columns = []
+ for column in display_columns:
+ if column not in compact_fields:
+ final_columns.append(column)
+ return final_columns
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index 79c6d95..3bf41bb 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -23,6 +23,10 @@
},
+ validate: function(frm) {
+ frm.toggle_reqd("half_day_date", frm.doc.half_day == 1);
+ },
+
refresh: function(frm) {
if (frm.is_new()) {
frm.set_value("status", "Open");
@@ -45,28 +49,38 @@
},
half_day: function(frm) {
- if (frm.doc.from_date) {
- frm.set_value("to_date", frm.doc.from_date);
- frm.trigger("calculate_total_days");
+ if (frm.doc.from_date == frm.doc.to_date) {
+ frm.set_value("half_day_date", frm.doc.from_date);
}
+ else {
+ frm.trigger("half_day_datepicker");
+ }
+ frm.trigger("calculate_total_days");
},
from_date: function(frm) {
- if (cint(frm.doc.half_day)==1) {
- frm.set_value("to_date", frm.doc.from_date);
- }
+ frm.trigger("half_day_datepicker");
frm.trigger("calculate_total_days");
},
to_date: function(frm) {
- if (cint(frm.doc.half_day)==1 && cstr(frm.doc.from_date) && frm.doc.from_date != frm.doc.to_date) {
- msgprint(__("To Date should be same as From Date for Half Day leave"));
- frm.set_value("to_date", frm.doc.from_date);
- }
-
+ frm.trigger("half_day_datepicker");
frm.trigger("calculate_total_days");
},
+ half_day_date(frm) {
+ frm.trigger("calculate_total_days");
+ },
+
+ half_day_datepicker: function(frm) {
+ frm.set_value('half_day_date', '');
+ var half_day_datepicker = frm.fields_dict.half_day_date.datepicker;
+ half_day_datepicker.update({
+ minDate: frappe.datetime.str_to_obj(frm.doc.from_date),
+ maxDate: frappe.datetime.str_to_obj(frm.doc.to_date)
+ })
+ },
+
get_leave_balance: function(frm) {
if(frm.doc.docstatus==0 && frm.doc.employee && frm.doc.leave_type && frm.doc.from_date) {
return frappe.call({
@@ -87,29 +101,25 @@
},
calculate_total_days: function(frm) {
- if(frm.doc.from_date && frm.doc.to_date) {
- if (cint(frm.doc.half_day)==1) {
- frm.set_value("total_leave_days", 0.5);
- } else if (frm.doc.employee && frm.doc.leave_type){
+ if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) {
// server call is done to include holidays in leave days calculations
- return frappe.call({
- method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',
- args: {
- "employee": frm.doc.employee,
- "leave_type": frm.doc.leave_type,
- "from_date": frm.doc.from_date,
- "to_date": frm.doc.to_date,
- "half_day": frm.doc.half_day
- },
- callback: function(r) {
- if (r && r.message) {
- frm.set_value('total_leave_days', r.message);
- frm.trigger("get_leave_balance");
- }
+ return frappe.call({
+ method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',
+ args: {
+ "employee": frm.doc.employee,
+ "leave_type": frm.doc.leave_type,
+ "from_date": frm.doc.from_date,
+ "to_date": frm.doc.to_date,
+ "half_day": frm.doc.half_day,
+ "half_day_date": frm.doc.half_day_date,
+ },
+ callback: function(r) {
+ if (r && r.message) {
+ frm.set_value('total_leave_days', r.message);
+ frm.trigger("get_leave_balance");
}
- });
- }
+ }
+ });
}
},
-
});
diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json
index 3939739..ca69417 100644
--- a/erpnext/hr/doctype/leave_application/leave_application.json
+++ b/erpnext/hr/doctype/leave_application/leave_application.json
@@ -274,6 +274,36 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:doc.half_day && (doc.from_date != doc.to_date)",
+ "fieldname": "half_day_date",
+ "fieldtype": "Date",
+ "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": "Half Day Date",
+ "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": "total_leave_days",
"fieldtype": "Float",
"hidden": 0,
@@ -287,6 +317,7 @@
"length": 0,
"no_copy": 1,
"permlevel": 0,
+ "precision": "1",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
@@ -738,7 +769,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 3,
- "modified": "2017-02-17 17:09:38.828496",
+ "modified": "2017-02-24 07:33:08.907824",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Application",
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 84c14c9..d869e0a 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -63,7 +63,10 @@
def validate_dates(self):
if self.from_date and self.to_date and (getdate(self.to_date) < getdate(self.from_date)):
frappe.throw(_("To date cannot be before from date"))
-
+
+ if self.half_day and (getdate(self.half_day_date) < getdate(self.from_date) or (getdate(self.half_day_date) > getdate(self.to_date))):
+ frappe.throw(_("Half Day Date should be between From Date and To Date"))
+
if not is_lwp(self.leave_type):
self.validate_dates_acorss_allocation()
self.validate_back_dated_application()
@@ -129,7 +132,7 @@
def validate_balance_leaves(self):
if self.from_date and self.to_date:
self.total_leave_days = get_number_of_leave_days(self.employee, self.leave_type,
- self.from_date, self.to_date, self.half_day)
+ self.from_date, self.to_date, self.half_day, self.half_day_date)
if self.total_leave_days == 0:
frappe.throw(_("The day(s) on which you are applying for leave are holidays. You need not apply for leave."))
@@ -294,13 +297,18 @@
return approvers_list
@frappe.whitelist()
-def get_number_of_leave_days(employee, leave_type, from_date, to_date, half_day=None):
- if half_day==1:
- return 0.5
- number_of_days = date_diff(to_date, from_date) + 1
+def get_number_of_leave_days(employee, leave_type, from_date, to_date, half_day = None, half_day_date = None):
+ number_of_days = 0
+ if half_day == 1:
+ if from_date == to_date:
+ number_of_days = 0.5
+ else:
+ number_of_days = date_diff(to_date, from_date) + .5
+ else:
+ number_of_days = date_diff(to_date, from_date) + 1
+
if not frappe.db.get_value("Leave Type", leave_type, "include_holiday"):
number_of_days = flt(number_of_days) - flt(get_holidays(employee, from_date, to_date))
-
return number_of_days
@frappe.whitelist()
diff --git a/erpnext/public/css/website.css b/erpnext/public/css/website.css
index 4f41937..0370dd0 100644
--- a/erpnext/public/css/website.css
+++ b/erpnext/public/css/website.css
@@ -254,7 +254,7 @@
display: inline-block;
color: white;
background: #8FD288;
- padding: 2px;
+ padding: 3px;
}
.duration-invisible {
visibility: hidden;
@@ -269,5 +269,5 @@
border: none;
}
.bom-spec {
- margin-bottom: 20px;
-}
\ No newline at end of file
+ margin-bottom: 20px;
+}
diff --git a/erpnext/schools/doctype/assessment_code/__init__.py b/erpnext/schools/doctype/assessment_code/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_code/__init__.py
diff --git a/erpnext/schools/doctype/assessment_code/assessment_code.js b/erpnext/schools/doctype/assessment_code/assessment_code.js
new file mode 100644
index 0000000..143791b
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_code/assessment_code.js
@@ -0,0 +1,8 @@
+// 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
new file mode 100644
index 0000000..d3acf7a
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_code/assessment_code.json
@@ -0,0 +1,89 @@
+{
+ "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
new file mode 100644
index 0000000..175564e
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_code/assessment_code.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 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
new file mode 100644
index 0000000..d6ccb8f
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_code/test_assessment_code.py
@@ -0,0 +1,12 @@
+# -*- 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_group/assessment_group.js b/erpnext/schools/doctype/assessment_group/assessment_group.js
index 8847472..6be5102 100644
--- a/erpnext/schools/doctype/assessment_group/assessment_group.js
+++ b/erpnext/schools/doctype/assessment_group/assessment_group.js
@@ -2,7 +2,7 @@
// For license information, please see license.txt
frappe.ui.form.on('Assessment Group', {
- refresh: function(frm) {
-
+ onload: function(frm) {
+ frm.list_route = "Tree/Assessment Group";
}
});
diff --git a/erpnext/schools/doctype/assessment_group/assessment_group.json b/erpnext/schools/doctype/assessment_group/assessment_group.json
index fb370a9..55b5ee7 100644
--- a/erpnext/schools/doctype/assessment_group/assessment_group.json
+++ b/erpnext/schools/doctype/assessment_group/assessment_group.json
@@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "assessment_group_name",
"fieldtype": "Data",
"hidden": 0,
@@ -22,6 +23,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Assessment Group Name",
"length": 0,
"no_copy": 0,
@@ -30,6 +32,7 @@
"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,
@@ -40,14 +43,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "assessment_group_code",
- "fieldtype": "Data",
+ "columns": 0,
+ "fieldname": "is_group",
+ "fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Assessment Group Code",
+ "in_standard_filter": 0,
+ "label": "Is Group",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -55,8 +60,150 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_2",
+ "fieldtype": "Section Break",
+ "hidden": 1,
+ "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": "parent_assessment_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Parent 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "lft",
+ "fieldtype": "Int",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "lft",
+ "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": "rgt",
+ "fieldtype": "Int",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "rgt",
+ "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": "old_parent",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "old_parent",
+ "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
@@ -72,7 +219,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-08-05 04:55:21.429710",
+ "modified": "2017-02-15 12:44:47.198945",
"modified_by": "Administrator",
"module": "Schools",
"name": "Assessment Group",
@@ -105,5 +252,6 @@
"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_group/assessment_group_tree.js b/erpnext/schools/doctype/assessment_group/assessment_group_tree.js
new file mode 100644
index 0000000..e467683
--- /dev/null
+++ b/erpnext/schools/doctype/assessment_group/assessment_group_tree.js
@@ -0,0 +1,3 @@
+frappe.treeview_settings["Assessment Group"] = {
+
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/assessment_plan/assessment_plan.json b/erpnext/schools/doctype/assessment_plan/assessment_plan.json
index bf1f2c2..a5bcc70 100644
--- a/erpnext/schools/doctype/assessment_plan/assessment_plan.json
+++ b/erpnext/schools/doctype/assessment_plan/assessment_plan.json
@@ -47,7 +47,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "assessment_code",
- "fieldtype": "Data",
+ "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -58,6 +58,7 @@
"label": "Assessment Code",
"length": 0,
"no_copy": 0,
+ "options": "Assessment Code",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -727,7 +728,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2017-02-17 17:15:26.824469",
+ "modified": "2017-02-13 19:34:09.724549",
"modified_by": "Administrator",
"module": "Schools",
"name": "Assessment Plan",
diff --git a/erpnext/schools/doctype/student/student.py b/erpnext/schools/doctype/student/student.py
index b660bb3..a830e5b 100644
--- a/erpnext/schools/doctype/student/student.py
+++ b/erpnext/schools/doctype/student/student.py
@@ -6,6 +6,7 @@
import frappe
from frappe.model.document import Document
from frappe import _
+from frappe.desk.form.linked_with import get_linked_doctypes
class Student(Document):
def validate(self):
@@ -15,6 +16,21 @@
self.check_unique()
self.update_applicant_status()
+ if frappe.get_value("Student", self.name, "title") != self.title:
+ self.update_student_name_in_linked_doctype()
+
+ def update_student_name_in_linked_doctype(self):
+ linked_doctypes = get_linked_doctypes("Student")
+ for d in linked_doctypes:
+ if "student_name" in [f.fieldname for f in frappe.get_meta(d).fields]:
+ frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
+ .format(d, linked_doctypes[d]["fieldname"]),(self.title, self.name))
+
+ if "child_doctype" in linked_doctypes[d].keys() and "student_name" in \
+ [f.fieldname for f in frappe.get_meta(linked_doctypes[d]["child_doctype"]).fields]:
+ frappe.db.sql("""UPDATE `tab{0}` set student_name = %s where {1} = %s"""
+ .format(linked_doctypes[d]["child_doctype"], linked_doctypes[d]["fieldname"]),(self.title, self.name))
+
def check_unique(self):
"""Validates if the Student Applicant is Unique"""
student = frappe.db.sql("select name from `tabStudent` where student_applicant=%s and name!=%s", (self.student_applicant, self.name))
diff --git a/erpnext/schools/doctype/student_applicant/student_applicant.js b/erpnext/schools/doctype/student_applicant/student_applicant.js
index 36baa80..c14c6f7 100644
--- a/erpnext/schools/doctype/student_applicant/student_applicant.js
+++ b/erpnext/schools/doctype/student_applicant/student_applicant.js
@@ -1,3 +1,6 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
frappe.ui.form.on("Student Applicant", {
refresh: function(frm) {
if(frm.doc.application_status== "Applied" && frm.doc.docstatus== 1 ) {
@@ -26,4 +29,13 @@
frm: frm
})
}
-});
\ No newline at end of file
+});
+
+
+frappe.ui.form.on('Student Sibling', {
+ student: function(frm) {
+ frm.add_fetch("student", "title", "full_name");
+ frm.add_fetch("student", "gender", "gender");
+ frm.add_fetch("student", "date_of_birth", "date_of_birth");
+ }
+});
diff --git a/erpnext/schools/doctype/student_sibling/student_sibling.json b/erpnext/schools/doctype/student_sibling/student_sibling.json
index b74d48c..87cdbf1 100644
--- a/erpnext/schools/doctype/student_sibling/student_sibling.json
+++ b/erpnext/schools/doctype/student_sibling/student_sibling.json
@@ -14,6 +14,36 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "fieldname": "studying_in_same_institute",
+ "fieldtype": "Select",
+ "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": "Studying in Same Institute",
+ "length": 0,
+ "no_copy": 0,
+ "options": "NO\nYES",
+ "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": 3,
"fieldname": "full_name",
"fieldtype": "Data",
@@ -21,7 +51,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Full Name",
"length": 0,
"no_copy": 0,
@@ -31,8 +63,9 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -48,7 +81,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Gender",
"length": 0,
"no_copy": 0,
@@ -59,32 +94,7 @@
"print_hide_if_no_value": 0,
"print_width": "",
"read_only": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 2,
- "fieldname": "date_of_birth",
- "fieldtype": "Date",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "label": "Date of Birth",
- "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,
@@ -102,7 +112,9 @@
"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,
@@ -110,6 +122,68 @@
"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,
+ "depends_on": "eval:doc.studying_in_same_institute == \"YES\"",
+ "fieldname": "student",
+ "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": "Student ID",
+ "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": 2,
+ "depends_on": "eval:doc.studying_in_same_institute == \"NO\"",
+ "fieldname": "institution",
+ "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,
+ "label": "Institution",
+ "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,
@@ -127,7 +201,9 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Program",
"length": 0,
"no_copy": 0,
@@ -136,6 +212,7 @@
"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,
@@ -147,21 +224,25 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
- "fieldname": "institution",
- "fieldtype": "Data",
+ "fieldname": "date_of_birth",
+ "fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
+ "in_global_search": 0,
"in_list_view": 1,
- "label": "Institution",
+ "in_standard_filter": 0,
+ "label": "Date of Birth",
"length": 0,
"no_copy": 0,
+ "options": "",
"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,
@@ -179,7 +260,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-09-14 06:03:44.067781",
+ "modified": "2017-02-24 11:43:01.311010",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Sibling",
@@ -189,7 +270,9 @@
"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,
"track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/install_fixtures.py b/erpnext/setup/setup_wizard/install_fixtures.py
index e6b4208..ef276a0 100644
--- a/erpnext/setup/setup_wizard/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/install_fixtures.py
@@ -193,6 +193,11 @@
{'doctype': "Print Heading", 'print_heading': _("Credit Note")},
{'doctype': "Print Heading", 'print_heading': _("Debit Note")},
+
+ # Assessment Group
+ {'doctype': 'Assessment Group', 'assessment_group_name': _('All Assessment Groups'),
+ 'is_group': 1, 'parent_assessment_group': ''},
+
]
from erpnext.setup.setup_wizard.industry_type import get_industry_types
diff --git a/erpnext/templates/print_formats/includes/item_table_description.html b/erpnext/templates/print_formats/includes/item_table_description.html
index e99d712..070cca5 100644
--- a/erpnext/templates/print_formats/includes/item_table_description.html
+++ b/erpnext/templates/print_formats/includes/item_table_description.html
@@ -1,14 +1,16 @@
{%- set compact = doc.flags.compact_item_print -%}
{%- set compact_fields = doc.flags.compact_item_fields -%}
+{%- set display_columns = visible_columns|map(attribute="fieldname")| list -%}
+{%- set columns = doc.flags.format_columns(display_columns, compact_fields) -%}
-{% if doc.in_format_data("image") and doc.get("image") and not doc.is_print_hide("image")-%}
+{% if doc.in_format_data("image") and doc.get("image") and "image" in display_columns -%}
<div class="pull-left" style="max-width: 40%; margin-right: 10px;">
<img class="print-item-image" src="{{ doc.image }}" alt="">
</div>
{%- endif %}
<div>
- {% if doc.in_format_data("item_code") and not doc.is_print_hide("item_code") -%}
+ {% if doc.in_format_data("item_code") and "item_code" in display_columns -%}
<div class="primary">
{% if compact %}<strong>{% endif %}
{{ _(doc.item_code) }}
@@ -16,9 +18,8 @@
</div>
{%- endif %}
- {% if (doc.in_format_data("item_name") and not doc.is_print_hide("item_name") and
- (not doc.in_format_data("item_code") or doc.is_print_hide("item_code")
- or doc.item_code != doc.item_name)) -%}
+ {%- if doc.in_format_data("item_name") and "item_name" in display_columns and
+ not (doc.in_format_data("item_code") and doc.item_code == doc.item_name) -%}
<div class="primary">{{ doc.get_formatted("item_name", translated=True) }}</div>
{%- endif %}
@@ -34,7 +35,7 @@
{%- endif %}
{% if compact -%}
- {%- for fieldname in doc.flags.show_in_description -%}
+ {%- for fieldname in columns -%}
{% if doc.get(fieldname) and doc.in_format_data(fieldname) -%}
<p>
<strong>{{ _(doc.meta.get_label(fieldname)) }}:</strong>