From 047442efa20c9407c6bc8534afce317d155c6a1f Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 29 May 2013 11:07:11 +0530 Subject: [PATCH] [notes] [fix] fix in note patch --- patches/may_2013/p06_make_notes.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/patches/may_2013/p06_make_notes.py b/patches/may_2013/p06_make_notes.py index 02c3d4bb52..a83766a509 100644 --- a/patches/may_2013/p06_make_notes.py +++ b/patches/may_2013/p06_make_notes.py @@ -5,18 +5,19 @@ def execute(): webnotes.reload_doc("utilities", "doctype", "note_user") for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True): - name = question.question[:180] - if webnotes.conn.exists("Note", name): - webnotes.delete_doc("Note", name) - note = webnotes.bean({ - "doctype":"Note", - "title": name, - "content": "
".join(webnotes.conn.sql_list("""select answer from tabAnswer - where question=%s""", question.name)), - "owner": question.owner, - "creation": question.creation, - "public": 1 - }).insert() + if question.question: + name = question.question[:180] + if webnotes.conn.exists("Note", name): + webnotes.delete_doc("Note", name) + note = webnotes.bean({ + "doctype":"Note", + "title": name, + "content": "
".join(webnotes.conn.sql_list("""select answer + from tabAnswer where question=%s""", question.name)), + "owner": question.owner, + "creation": question.creation, + "public": 1 + }).insert() webnotes.delete_doc("DocType", "Question") webnotes.delete_doc("DocType", "Answer")