blob: 9a9d42011ca7371e6f953098ec20d6ac8787e0d3 [file] [log] [blame]
Rushabh Mehtab21eb9a2013-02-28 18:42:46 +05301import webnotes
2
3def execute():
4 # convert timesheet details to time logs
5 for name in webnotes.conn.sql_list("""select name from tabTimesheet"""):
6 ts = webnotes.bean("Timesheet", name)
7 for tsd in ts.doclist.get({"doctype":"Timesheet Detail"}):
Rushabh Mehta5423c962013-03-04 15:45:46 +05308 if not webnotes.conn.exists("Project", tsd.project_name):
9 tsd.project_name = None
10 if not webnotes.conn.exists("Task", tsd.task_id):
11 tsd.task_id = None
12
13 tl = webnotes.doc({
Rushabh Mehtab21eb9a2013-02-28 18:42:46 +053014 "doctype": "Time Log",
15 "status": "Draft",
16 "from_time": ts.doc.timesheet_date + " " + tsd.act_start_time,
17 "to_time": ts.doc.timesheet_date + " " + tsd.act_end_time,
18 "activity_type": tsd.activity_type,
19 "task": tsd.task_id,
20 "project": tsd.project_name,
21 "note": ts.doc.notes,
22 "file_list": ts.doc.file_list,
23 "_user_tags": ts.doc._user_tags
24 })
25 tl.insert()