From 9c688f6dbf71ce02a3426738577c1a21206e968e Mon Sep 17 00:00:00 2001 From: Shreya Date: Sun, 29 Apr 2018 12:14:13 +0530 Subject: [PATCH] color field for calendar in leave application --- .../leave_application/leave_application.json | 33 ++++++++++++++++++- .../leave_application/leave_application.py | 6 ++-- .../leave_application_calendar.js | 3 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.json b/erpnext/hr/doctype/leave_application/leave_application.json index d657ec4b9b..24f2dc67e3 100644 --- a/erpnext/hr/doctype/leave_application/leave_application.json +++ b/erpnext/hr/doctype/leave_application/leave_application.json @@ -689,6 +689,37 @@ "translatable": 0, "unique": 0 }, + { + "allow_bulk_edit": 0, + "allow_on_submit": 1, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "_color", + "fieldtype": "Color", + "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": "Color", + "length": 0, + "no_copy": 0, + "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, + "translatable": 0, + "unique": 0 + }, { "allow_bulk_edit": 0, "allow_on_submit": 0, @@ -823,7 +854,7 @@ "issingle": 0, "istable": 0, "max_attachments": 3, - "modified": "2018-04-16 09:46:44.650629", + "modified": "2018-04-27 17:37:43.021792", "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 df554e85a5..eca858b846 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -382,7 +382,6 @@ def get_events(start, end, filters=None): from frappe.desk.reportview import get_filters_cond conditions = get_filters_cond("Leave Application", filters, []) - # show department leaves for employee if "Employee" in frappe.get_roles(): add_department_leaves(events, start, end, employee, company) @@ -408,7 +407,7 @@ def add_department_leaves(events, start, end, employee, company): add_leaves(events, start, end, match_conditions=match_conditions) def add_leaves(events, start, end, match_conditions=None): - query = """select name, from_date, to_date, employee_name, half_day, + query = """select name, from_date, to_date, employee_name, _color, half_day, employee, docstatus from `tabLeave Application` where from_date <= %(end)s and to_date >= %(start)s <= to_date @@ -422,9 +421,10 @@ def add_leaves(events, start, end, match_conditions=None): "doctype": "Leave Application", "from_date": d.from_date, "to_date": d.to_date, + "docstatus": d.docstatus, + "color": d._color, "title": cstr(d.employee_name) + \ (d.half_day and _(" (Half Day)") or ""), - "docstatus": d.docstatus } if e not in events: events.append(e) diff --git a/erpnext/hr/doctype/leave_application/leave_application_calendar.js b/erpnext/hr/doctype/leave_application/leave_application_calendar.js index 0286f30064..3fbf42a182 100644 --- a/erpnext/hr/doctype/leave_application/leave_application_calendar.js +++ b/erpnext/hr/doctype/leave_application/leave_application_calendar.js @@ -7,7 +7,8 @@ frappe.views.calendar["Leave Application"] = { "end": "to_date", "id": "name", "title": "title", - "docstatus": 1 + "docstatus": 1, + "color": "_color" }, options: { header: {