From b4a2949c37b7279d28e107ce65a4255fcc31d9aa Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 24 May 2013 16:33:21 +0530 Subject: [PATCH] [knowledge base] removed and added patch to move to notes --- patches/may_2013/p06_make_notes.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 patches/may_2013/p06_make_notes.py diff --git a/patches/may_2013/p06_make_notes.py b/patches/may_2013/p06_make_notes.py new file mode 100644 index 0000000000..e1ea656238 --- /dev/null +++ b/patches/may_2013/p06_make_notes.py @@ -0,0 +1,20 @@ +import webnotes + +def execute(): + webnotes.reload_doc("utilities", "doctype", "note") + 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() + + webnotes.delete_doc("DocType", "Question") + webnotes.delete_doc("DocType", "Answer")