brotherton-erpnext/erpnext/patches/jan_mar_2012/website.py

50 lines
1.7 KiB
Python
Raw Normal View History

2012-01-25 05:07:35 +00:00
# website patch
import webnotes
2012-01-27 06:47:09 +00:00
from webnotes.model.doc import Document
2012-01-25 05:07:35 +00:00
def execute():
2012-01-27 06:47:09 +00:00
add_website_manager()
cleanup_file_data()
2012-01-25 05:07:35 +00:00
update_patch_log()
from webnotes.modules import reload_doc
reload_doc('website', 'Role', 'Website Manager')
2012-01-27 10:27:17 +00:00
reload_doc('website', 'Module Def', 'Website')
reload_doc('website', 'doctype', 'website_settings')
reload_doc('website', 'doctype', 'style_settings')
2012-01-25 05:07:35 +00:00
reload_doc('website', 'doctype', 'top_bar_item')
2012-01-27 10:27:17 +00:00
reload_doc('website', 'doctype', 'contact_us_settings')
reload_doc('website', 'doctype', 'about_us_settings')
2012-02-01 09:17:29 +00:00
reload_doc('website', 'doctype', 'products_settings')
2012-01-27 12:30:14 +00:00
reload_doc('website', 'doctype', 'blog')
reload_doc('website', 'doctype', 'blog_subscriber')
2012-02-01 09:17:29 +00:00
reload_doc('website', 'doctype', 'product')
reload_doc('website', 'doctype', 'web_page')
2012-01-25 05:07:35 +00:00
2012-01-27 10:27:17 +00:00
reload_doc('website', 'page', 'contact')
reload_doc('website', 'page', 'about')
2012-01-27 12:30:14 +00:00
reload_doc('website', 'page', 'blog')
reload_doc('website', 'page', 'unsubscribe')
2012-02-01 09:17:29 +00:00
reload_doc('website', 'page', 'products')
2012-01-27 10:27:17 +00:00
2012-01-27 06:47:09 +00:00
def add_website_manager():
"""add website manager to system manager"""
for i in webnotes.conn.sql("""select distinct parent from tabUserRole
where role='System Manager'"""):
if not webnotes.conn.sql("""select parent from tabUserRole
where role='Website Manager' and parent=%s""", i[0]):
d = Document('UserRole')
d.parent = i[0]
d.role = 'Website Manager'
d.save(1)
2012-01-25 09:36:28 +00:00
def cleanup_file_data():
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tabFile Data` drop column blob_content""")
webnotes.conn.begin()
2012-01-25 05:07:35 +00:00
def update_patch_log():
webnotes.conn.commit()
webnotes.conn.sql("""alter table __PatchLog engine=InnoDB""")
webnotes.conn.begin()