[knowledge base] removed and added patch to move to notes

This commit is contained in:
Rushabh Mehta 2013-05-24 16:33:21 +05:30
parent 9c5f4fe165
commit b4a2949c37

View File

@ -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": "<hr>".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")