From cc54fd46bc623996e1e57d109012e4521244cf24 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 6 Feb 2012 13:09:08 +0100 Subject: [PATCH] website fixes --- .../patches/jan_mar_2012/latest/website.py | 24 ++++++++++--------- .../setup/doctype/item_group/item_group.txt | 2 +- erpnext/website/doctype/product/product.py | 14 ++++++++++- wnf.py | 18 +++++++------- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/latest/website.py b/erpnext/patches/jan_mar_2012/latest/website.py index cd40ccbb87..9c930e2659 100644 --- a/erpnext/patches/jan_mar_2012/latest/website.py +++ b/erpnext/patches/jan_mar_2012/latest/website.py @@ -7,7 +7,8 @@ def execute(): add_website_manager() from webnotes.modules import reload_doc from webnotes.model import delete_doc - + + reload_doc('setup', 'doctype', 'item_group') delete_doc('Website', 'Module Def', 'Website') reload_doc('website', 'Module Def', 'Website') reload_doc('website', 'Role', 'Website Manager') @@ -42,16 +43,17 @@ def execute(): def create_home_page(): """create a dummy home page""" - if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'""") - d = Document('Web Page') - d.title = 'Home' - d.head_section = "

Your Headline

" - d.main_section = "

Some introduction about your company

" - d.side_section = "

Links to other pages

" - d.save() - obj = get_obj(doc = d) - obj.validate() - obj.doc.save() + 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 = "

Your Headline

" + d.main_section = "

Some introduction about your company

" + d.side_section = "

Links to other pages

" + d.save() + obj = get_obj(doc = d) + obj.validate() + obj.doc.save() def add_website_manager(): """add website manager to system manager""" diff --git a/erpnext/setup/doctype/item_group/item_group.txt b/erpnext/setup/doctype/item_group/item_group.txt index 2e0731c239..548c1733b3 100644 --- a/erpnext/setup/doctype/item_group/item_group.txt +++ b/erpnext/setup/doctype/item_group/item_group.txt @@ -236,4 +236,4 @@ 'print_hide': 1, 'report_hide': 1 } -] \ No newline at end of file +] diff --git a/erpnext/website/doctype/product/product.py b/erpnext/website/doctype/product/product.py index 935d762010..5880d34c7b 100644 --- a/erpnext/website/doctype/product/product.py +++ b/erpnext/website/doctype/product/product.py @@ -1,3 +1,5 @@ +import webnotes + class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl @@ -24,4 +26,14 @@ class DocType: website.utils.add_guest_access_to_page(p.name) self.doc.page_name = p.name - del self.doc.fields['long_description_html'] \ No newline at end of file + del self.doc.fields['long_description_html'] + self.make_item_group_active() + + + def make_item_group_active(self): + """show item group in website""" + if self.doc.published: + from webnotes.model.doc import Document + ig = Document('Item Group', webnotes.conn.get_value('Item', self.doc.item, 'item_group')) + ig.show_in_website = 1 + ig.save() diff --git a/wnf.py b/wnf.py index 368e5c88a8..355474f58c 100755 --- a/wnf.py +++ b/wnf.py @@ -68,6 +68,10 @@ def run(): from webnotes.db import Database import webnotes.modules.patch_handler + # connect + if options.db_name is not None: + webnotes.connect(options.db_name) + # build if options.build: import build.project @@ -99,19 +103,11 @@ def run(): os.system('git commit -a -m "%s"' % options.push[2]) os.system('git push %s %s' % (options.push[0], options.push[1])) - - # patch elif options.patch_list: # clear log webnotes.modules.patch_handler.log_list = [] - # connect to db - if options.db_name is not None: - webnotes.connect(options.db_name) - else: - webnotes.connect() - # run individual patches for patch in options.patch_list: webnotes.modules.patch_handler.run_single(\ @@ -129,6 +125,10 @@ def run(): elif options.run_latest: webnotes.modules.patch_handler.run_all() print '\n'.join(webnotes.modules.patch_handler.log_list) - + + # print messages + if webnotes.message_log: + print '\n'.join(webnotes.message_log) + if __name__=='__main__': run()