This commit is contained in:
Rushabh Mehta 2013-04-03 16:38:20 +05:30
commit cc86ec8642
8 changed files with 112 additions and 36 deletions

View File

@ -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')"
]

View File

@ -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,

View File

@ -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"
},
]

View File

@ -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()
},
]
}

View File

@ -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

View File

@ -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"
}
]

View File

@ -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"
}
]