diff --git a/patches/patch_list.py b/patches/patch_list.py index 4c69e303a43..8974f00f89d 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -235,4 +235,5 @@ patch_list = [ 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02', 'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02', "patches.april_2013.p04_reverse_modules_list", + "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')" ] \ No newline at end of file diff --git a/projects/doctype/time_log/time_log.txt b/projects/doctype/time_log/time_log.txt index 838d3f178a2..09c04c5167a 100644 --- a/projects/doctype/time_log/time_log.txt +++ b/projects/doctype/time_log/time_log.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-05 10:52:02", + "creation": "2013-03-06 14:08:07", "docstatus": 0, - "modified": "2013-03-05 10:54:07", + "modified": "2013-04-03 15:51:32", "modified_by": "Administrator", "owner": "Administrator" }, @@ -48,6 +48,7 @@ "label": "Naming Series", "options": "TL-", "permlevel": 0, + "read_only": 0, "reqd": 1 }, { @@ -57,6 +58,7 @@ "in_list_view": 1, "label": "From Time", "permlevel": 0, + "read_only": 0, "reqd": 1 }, { @@ -66,6 +68,7 @@ "in_list_view": 0, "label": "To Time", "permlevel": 0, + "read_only": 0, "reqd": 1 }, { @@ -80,7 +83,8 @@ "doctype": "DocField", "fieldname": "column_break_3", "fieldtype": "Column Break", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", @@ -101,6 +105,7 @@ "label": "Activity Type", "options": "Activity Type", "permlevel": 0, + "read_only": 0, "reqd": 1 }, { @@ -109,7 +114,8 @@ "fieldtype": "Link", "label": "Task", "options": "Task", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", @@ -117,26 +123,30 @@ "fieldtype": "Check", "in_list_view": 1, "label": "Billable", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break_7", "fieldtype": "Section Break", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "note", "fieldtype": "Text Editor", "label": "Note", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", "fieldname": "section_break_9", "fieldtype": "Section Break", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", @@ -145,7 +155,8 @@ "in_list_view": 1, "label": "Project", "options": "Project", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "description": "Will be updated when batched.", @@ -171,7 +182,8 @@ "doctype": "DocField", "fieldname": "column_break_16", "fieldtype": "Column Break", - "permlevel": 0 + "permlevel": 0, + "read_only": 0 }, { "doctype": "DocField", @@ -181,7 +193,8 @@ "label": "File List", "no_copy": 1, "permlevel": 0, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "doctype": "DocField", @@ -191,7 +204,8 @@ "no_copy": 1, "options": "Time Log", "permlevel": 1, - "print_hide": 1 + "print_hide": 1, + "read_only": 0 }, { "create": 1, diff --git a/projects/page/projects_home/projects_home.js b/projects/page/projects_home/projects_home.js index f3ef71a2daa..cfde6b30d21 100644 --- a/projects/page/projects_home/projects_home.js +++ b/projects/page/projects_home/projects_home.js @@ -56,8 +56,8 @@ wn.module_page["Projects"] = [ icon: "icon-list", items: [ { - "label":wn._("Time Log Summary"), - route: "Report2/Time Log/Time Log Summary", + "label":wn._("Daily Time Log Summary"), + route: "query-report/Daily Time Log Summary", doctype: "Time Log" }, ] diff --git a/projects/report/time_log_summary/__init__.py b/projects/report/daily_time_log_summary/__init__.py similarity index 100% rename from projects/report/time_log_summary/__init__.py rename to projects/report/daily_time_log_summary/__init__.py diff --git a/projects/report/daily_time_log_summary/daily_time_log_summary.js b/projects/report/daily_time_log_summary/daily_time_log_summary.js new file mode 100644 index 00000000000..81476767047 --- /dev/null +++ b/projects/report/daily_time_log_summary/daily_time_log_summary.js @@ -0,0 +1,16 @@ +wn.query_reports["Daily Time Log Summary"] = { + "filters": [ + { + "fieldname":"from_date", + "label": "From Date", + "fieldtype": "Datetime", + "default": wn.datetime.get_today() + }, + { + "fieldname":"to_date", + "label": "To Date", + "fieldtype": "Datetime", + "default": wn.datetime.get_today() + }, + ] +} \ No newline at end of file diff --git a/projects/report/daily_time_log_summary/daily_time_log_summary.py b/projects/report/daily_time_log_summary/daily_time_log_summary.py new file mode 100644 index 00000000000..0309977a8cb --- /dev/null +++ b/projects/report/daily_time_log_summary/daily_time_log_summary.py @@ -0,0 +1,46 @@ +from __future__ import unicode_literals +import webnotes + +def execute(filters=None): + if not filters: filters = {} + columns = ["Employee::150", "From Datetime::120", "To Datetime::120", "Hours::70", "Task::150", + "Project:Link/Project:120", "Status::70"] + + profile_map = get_profile_map() + + conditions = build_conditions(filters) + time_logs = webnotes.conn.sql("""select * from `tabTime Log` + where docstatus < 2 %s order by owner asc""" % (conditions,), filters, as_dict=1) + + data = [] + profiles = [time_logs[0].owner] + + for tl in time_logs: + + if tl.owner not in profiles: + profiles.append(tl.owner) + data.append([]) + + data.append([profile_map[tl.owner], tl.from_time, tl.to_time, tl.hours, + tl.task, tl.project, tl.status]) + + return columns, data + +def get_profile_map(): + profiles = webnotes.conn.sql("""select name, + concat(first_name, if(last_name, (' ' + last_name), '')) as fullname + from tabProfile""", as_dict=1) + profile_map = {} + for p in profiles: + profile_map.setdefault(p.name, []).append(p.fullname) + + return profile_map + +def build_conditions(filters): + conditions = "" + if filters.get("from_date"): + conditions += " and from_time >= %(from_date)s" + if filters.get("to_date"): + conditions += " and to_time <= %(to_date)s" + + return conditions \ No newline at end of file diff --git a/projects/report/daily_time_log_summary/daily_time_log_summary.txt b/projects/report/daily_time_log_summary/daily_time_log_summary.txt new file mode 100644 index 00000000000..5bf3e6d57ee --- /dev/null +++ b/projects/report/daily_time_log_summary/daily_time_log_summary.txt @@ -0,0 +1,21 @@ +[ + { + "creation": "2013-04-03 11:27:52", + "docstatus": 0, + "modified": "2013-04-03 11:48:07", + "modified_by": "Administrator", + "owner": "Administrator" + }, + { + "doctype": "Report", + "is_standard": "Yes", + "name": "__common__", + "ref_doctype": "Time Log", + "report_name": "Daily Time Log Summary", + "report_type": "Script Report" + }, + { + "doctype": "Report", + "name": "Daily Time Log Summary" + } +] \ No newline at end of file diff --git a/projects/report/time_log_summary/time_log_summary.txt b/projects/report/time_log_summary/time_log_summary.txt deleted file mode 100644 index 3925a2dd809..00000000000 --- a/projects/report/time_log_summary/time_log_summary.txt +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "creation": "2013-03-01 17:36:35", - "docstatus": 0, - "modified": "2013-03-01 18:17:13", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Report", - "is_standard": "Yes", - "json": "{\"filters\":[],\"columns\":[[\"name\",\"Time Log\"],[\"status\",\"Time Log\"],[\"from_time\",\"Time Log\"],[\"hours\",\"Time Log\"],[\"activity_type\",\"Time Log\"],[\"owner\",\"Time Log\"],[\"billable\",\"Time Log\"],[\"time_log_batch\",\"Time Log\"],[\"sales_invoice\",\"Time Log\"]],\"sort_by\":\"Time Log.name\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}", - "name": "__common__", - "ref_doctype": "Time Log", - "report_name": "Time Log Summary", - "report_type": "Report Builder" - }, - { - "doctype": "Report", - "name": "Time Log Summary" - } -] \ No newline at end of file