[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,14 +5,15 @@ 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):
if question.question:
name = question.question[:180] name = question.question[:180]
if webnotes.conn.exists("Note", name): if webnotes.conn.exists("Note", name):
webnotes.delete_doc("Note", name) webnotes.delete_doc("Note", name)
note = webnotes.bean({ note = webnotes.bean({
"doctype":"Note", "doctype":"Note",
"title": name, "title": name,
"content": "<hr>".join(webnotes.conn.sql_list("""select answer from tabAnswer "content": "<hr>".join(webnotes.conn.sql_list("""select answer
where question=%s""", question.name)), from tabAnswer where question=%s""", question.name)),
"owner": question.owner, "owner": question.owner,
"creation": question.creation, "creation": question.creation,
"public": 1 "public": 1