2012-02-23 07:05:32 +00:00
|
|
|
# ERPNext - web based ERP (http://erpnext.com)
|
|
|
|
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2012-01-25 05:07:35 +00:00
|
|
|
# website patch
|
|
|
|
|
2012-07-19 08:10:31 +00:00
|
|
|
from __future__ import unicode_literals
|
2012-01-25 05:07:35 +00:00
|
|
|
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()
|
2012-01-25 05:07:35 +00:00
|
|
|
from webnotes.modules import reload_doc
|
2012-02-02 11:10:01 +00:00
|
|
|
from webnotes.model import delete_doc
|
2012-02-06 12:09:08 +00:00
|
|
|
|
2012-02-09 07:15:50 +00:00
|
|
|
# cleanup page
|
|
|
|
delete_doc("DocType", "Page")
|
|
|
|
reload_doc("core", "doctype", "page")
|
|
|
|
|
2012-02-06 12:09:08 +00:00
|
|
|
reload_doc('setup', 'doctype', 'item_group')
|
2012-02-02 11:10:01 +00:00
|
|
|
delete_doc('Website', 'Module Def', 'Website')
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'Module Def', 'Website')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'Role', 'Website Manager')
|
2012-02-07 09:01:49 +00:00
|
|
|
reload_doc('website', 'Role', 'Blogger')
|
2012-02-02 11:10:01 +00:00
|
|
|
|
2012-02-02 11:15:26 +00:00
|
|
|
webnotes.conn.sql("""delete from `tabModule Def Role` where parent='Website'""")
|
2012-02-02 11:10:01 +00:00
|
|
|
d = Document('Module Def Role')
|
|
|
|
d.parent = 'Website'
|
|
|
|
d.role = 'Website Manager'
|
|
|
|
d.save()
|
|
|
|
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'doctype', 'about_us_settings')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'about_us_team')
|
2012-01-27 12:30:14 +00:00
|
|
|
reload_doc('website', 'doctype', 'blog')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'contact_us_settings')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'doctype', 'product')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'product_group')
|
|
|
|
reload_doc('website', 'doctype', 'products_settings')
|
|
|
|
reload_doc('website', 'doctype', 'related_page')
|
|
|
|
reload_doc('website', 'doctype', 'style_settings')
|
|
|
|
reload_doc('website', 'doctype', 'top_bar_item')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'doctype', 'web_page')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'doctype', 'website_settings')
|
2012-01-25 05:07:35 +00:00
|
|
|
|
2012-01-27 10:27:17 +00:00
|
|
|
reload_doc('website', 'page', 'about')
|
2012-01-27 12:30:14 +00:00
|
|
|
reload_doc('website', 'page', 'blog')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'page', 'contact')
|
2012-02-01 09:17:29 +00:00
|
|
|
reload_doc('website', 'page', 'products')
|
2012-02-02 11:10:01 +00:00
|
|
|
reload_doc('website', 'page', 'unsubscribe')
|
2012-01-27 10:27:17 +00:00
|
|
|
|
2012-02-06 09:04:42 +00:00
|
|
|
create_home_page()
|
2012-02-14 07:28:47 +00:00
|
|
|
add_website_manager()
|
2012-02-06 09:04:42 +00:00
|
|
|
|
|
|
|
def create_home_page():
|
|
|
|
"""create a dummy home page"""
|
2012-02-06 12:09:08 +00:00
|
|
|
from webnotes.model.code import get_obj
|
|
|
|
if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'"""):
|
|
|
|
d = Document('Web Page')
|
|
|
|
d.title = 'Home'
|
|
|
|
d.head_section = "<h1>Your Headline</h1>"
|
|
|
|
d.main_section = "<p>Some introduction about your company</p>"
|
|
|
|
d.side_section = "<p>Links to other pages</p>"
|
|
|
|
d.save()
|
|
|
|
obj = get_obj(doc = d)
|
|
|
|
obj.validate()
|
|
|
|
obj.doc.save()
|
2012-02-06 09:04:42 +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)
|