Rushabh Mehta | b21eb9a | 2013-02-28 18:42:46 +0530 | [diff] [blame^] | 1 | import webnotes |
| 2 | |
| 3 | def 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"}): |
| 8 | tl = webnotes.bean({ |
| 9 | "doctype": "Time Log", |
| 10 | "status": "Draft", |
| 11 | "from_time": ts.doc.timesheet_date + " " + tsd.act_start_time, |
| 12 | "to_time": ts.doc.timesheet_date + " " + tsd.act_end_time, |
| 13 | "activity_type": tsd.activity_type, |
| 14 | "task": tsd.task_id, |
| 15 | "project": tsd.project_name, |
| 16 | "note": ts.doc.notes, |
| 17 | "file_list": ts.doc.file_list, |
| 18 | "_user_tags": ts.doc._user_tags |
| 19 | }) |
| 20 | tl.insert() |