From 3385bd492112bb5c33111b6033fb5f999c6aa222 Mon Sep 17 00:00:00 2001 From: bcornwellmott Date: Wed, 21 Dec 2016 12:33:32 -0800 Subject: [PATCH 1/2] Add hours to label in calendar view Adds a label for the number of hours to each calendar event --- erpnext/projects/doctype/timesheet/timesheet_calendar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet_calendar.js b/erpnext/projects/doctype/timesheet/timesheet_calendar.js index b22cd09f7f..0af1a6c58e 100644 --- a/erpnext/projects/doctype/timesheet/timesheet_calendar.js +++ b/erpnext/projects/doctype/timesheet/timesheet_calendar.js @@ -6,7 +6,8 @@ frappe.views.calendar["Timesheet"] = { "id": "name", "title": "name", "allDay": "allDay", - "child_name": "name" + "child_name": "name", + "title": "title" }, style_map: { "0": "info", From e549984a42b3c63cd456b5822af7269352791df5 Mon Sep 17 00:00:00 2001 From: bcornwellmott Date: Wed, 21 Dec 2016 12:36:45 -0800 Subject: [PATCH 2/2] Grabs title from SQL Gets a concatenated title label for the Calendar event that includes the number of hours --- erpnext/projects/doctype/timesheet/timesheet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 48d3e00213..778bf90139 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -356,7 +356,8 @@ def get_events(start, end, filters=None): conditions = get_conditions(filters) return frappe.db.sql("""select `tabTimesheet Detail`.name as name, `tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent, - from_time as start_date, hours, activity_type, project, to_time as end_date + from_time as start_date, hours, activity_type, project, to_time as end_date, + CONCAT(`tabTimesheet Detail`.parent, ' (', ROUND(hours,2),' hrs)') as title from `tabTimesheet Detail`, `tabTimesheet` where `tabTimesheet Detail`.parent = `tabTimesheet`.name and `tabTimesheet`.docstatus < 2