[notes] [fix] fix in note patch

This commit is contained in:
Anand Doshi 2013-05-29 11:07:11 +05:30
parent d0b007235d
commit 047442efa2

View File

@ -5,18 +5,19 @@ def execute():
webnotes.reload_doc("utilities", "doctype", "note_user") webnotes.reload_doc("utilities", "doctype", "note_user")
for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True): for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
name = question.question[:180] if question.question:
if webnotes.conn.exists("Note", name): name = question.question[:180]
webnotes.delete_doc("Note", name) if webnotes.conn.exists("Note", name):
note = webnotes.bean({ webnotes.delete_doc("Note", name)
"doctype":"Note", note = webnotes.bean({
"title": name, "doctype":"Note",
"content": "<hr>".join(webnotes.conn.sql_list("""select answer from tabAnswer "title": name,
where question=%s""", question.name)), "content": "<hr>".join(webnotes.conn.sql_list("""select answer
"owner": question.owner, from tabAnswer where question=%s""", question.name)),
"creation": question.creation, "owner": question.owner,
"public": 1 "creation": question.creation,
}).insert() "public": 1
}).insert()
webnotes.delete_doc("DocType", "Question") webnotes.delete_doc("DocType", "Question")
webnotes.delete_doc("DocType", "Answer") webnotes.delete_doc("DocType", "Answer")