[column addition][daily time log summary] time log id, activity type and task subject column added

This commit is contained in:
Nabin Hait 2013-04-05 12:12:39 +05:30
parent 93b4e4d90c
commit 86a8d01ce9

View File

@ -7,10 +7,12 @@ def execute(filters=None):
elif filters.get("to_date"):
filters["to_date"] = filters.get("to_date") + "24:00:00"
columns = ["Employee::150", "From Datetime::120", "To Datetime::120", "Hours::70", "Task::150",
"Project:Link/Project:120", "Status::70"]
columns = ["Time Log:Link/Time Log:120", "Employee::150", "From Datetime::140",
"To Datetime::140", "Hours::70", "Activity Type::120", "Task:Link/Task:150",
"Task Subject::180", "Project:Link/Project:120", "Status::70"]
profile_map = get_profile_map()
task_map = get_task_map()
conditions = build_conditions(filters)
time_logs = webnotes.conn.sql("""select * from `tabTime Log`
@ -25,8 +27,8 @@ def execute(filters=None):
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])
data.append([tl.name, profile_map[tl.owner], tl.from_time, tl.to_time, tl.hours,
tl.activity_type, tl.task, task_map.get(tl.task), tl.project, tl.status])
return columns, data
@ -40,6 +42,14 @@ def get_profile_map():
return profile_map
def get_task_map():
tasks = webnotes.conn.sql("""select name, subject from tabTask""", as_dict=1)
task_map = {}
for t in tasks:
task_map.setdefault(t.name, []).append(t.subject)
return task_map
def build_conditions(filters):
conditions = ""
if filters.get("from_date"):