From 5423c96bef5617c70fae4b4023327d1b7aea6f22 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 4 Mar 2013 15:45:46 +0530 Subject: [PATCH] fixed to timesheet patch --- patches/february_2013/p09_timesheets.py | 7 ++++++- patches/patch_list.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/patches/february_2013/p09_timesheets.py b/patches/february_2013/p09_timesheets.py index b61566f9b3..9a9d42011c 100644 --- a/patches/february_2013/p09_timesheets.py +++ b/patches/february_2013/p09_timesheets.py @@ -5,7 +5,12 @@ def execute(): for name in webnotes.conn.sql_list("""select name from tabTimesheet"""): ts = webnotes.bean("Timesheet", name) for tsd in ts.doclist.get({"doctype":"Timesheet Detail"}): - tl = webnotes.bean({ + if not webnotes.conn.exists("Project", tsd.project_name): + tsd.project_name = None + if not webnotes.conn.exists("Task", tsd.task_id): + tsd.task_id = None + + tl = webnotes.doc({ "doctype": "Time Log", "status": "Draft", "from_time": ts.doc.timesheet_date + " " + tsd.act_start_time, diff --git a/patches/patch_list.py b/patches/patch_list.py index d1110da323..2bd4ad8f1f 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -200,8 +200,8 @@ patch_list = [ 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Modern") # 2013-02-26', 'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Spartan") # 2013-02-26', "execute:(not webnotes.conn.exists('Role', 'Projects Manager')) and webnotes.doc({'doctype':'Role', 'role_name':'Projects Manager'}).insert()", - "execute:(not webnotes.conn.exists('UOM', 'Hour')) and webnotes.doc({'uom_name': 'Unit', 'doctype': 'UOM', 'name': 'Hour'}).insert()", "patches.february_2013.p09_remove_cancelled_warehouses", "patches.march_2013.update_po_prevdoc_doctype", "patches.february_2013.p09_timesheets", + "execute:(not webnotes.conn.exists('UOM', 'Hour')) and webnotes.doc({'uom_name': 'Hour', 'doctype': 'UOM', 'name': 'Hour'}).insert()", ] \ No newline at end of file