brotherton-erpnext/patches/march_2013/p03_rename_blog_to_blog_post.py
2013-11-20 13:00:28 +05:30

13 lines
554 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc('website', 'doctype', 'blogger')
webnotes.rename_doc("DocType", "Blog", "Blog Post", force=True)
webnotes.reload_doc('website', 'doctype', 'blog_post')
webnotes.conn.sql('''update tabBlogger set posts=(select count(*)
from `tabBlog Post` where ifnull(blogger,"")=tabBlogger.name)''')
webnotes.conn.sql("""update `tabBlog Post` set published_on=date(creation)""")