website updates and fix to sessions

This commit is contained in:
Rushabh Mehta
2012-12-19 10:14:59 +05:30
parent fff3eb4142
commit e109fa4fb8
21 changed files with 403 additions and 525 deletions

View File

@@ -17,6 +17,9 @@
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly(doc);
cur_frm.add_custom_button("Item Group Tree", function() {
wn.set_route("Sales Browser", "Item Group");
})
}
cur_frm.cscript.set_root_readonly = function(doc) {

View File

@@ -24,4 +24,21 @@ class DocType(DocTypeNestedSet):
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.nsm_parent_field = 'parent_item_group';
self.nsm_parent_field = 'parent_item_group';
def on_update(self):
if self.doc.show_in_website:
# webpage updates
from website.utils import update_page_name
page_name = self.doc.name
if webnotes.conn.get_value("Website Settings", None,
"default_product_category")==self.doc.name:
page_name = "products"
update_page_name(self.doc, self.doc.name)
def prepare_template_args(self):
self.doc.sub_groups = webnotes.conn.sql("""select name, page_name
from `tabItem Group` where parent_item_group=%s
and ifnull(show_in_website,0)=1""", self.doc.name, as_dict=1)

View File

@@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2012-12-07 15:15:28",
"modified_by": "Administrator",
"modified": "2012-12-17 15:00:01"
"modified": "2012-12-18 16:23:48"
},
{
"in_create": 1,
@@ -12,11 +12,13 @@
"module": "Setup",
"autoname": "field:item_group_name",
"document_type": "Master",
"description": "Item Classification",
"allow_attach": 1,
"issingle": 0,
"name": "__common__",
"allow_rename": 1,
"doctype": "DocType"
"description": "Item Classification",
"doctype": "DocType",
"max_attachments": 3
},
{
"name": "__common__",
@@ -49,33 +51,6 @@
"search_index": 0,
"reqd": 1
},
{
"description": "Check this if you want to show in website",
"no_copy": 0,
"search_index": 0,
"doctype": "DocField",
"label": "Show in Website",
"fieldname": "show_in_website",
"fieldtype": "Check"
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
"label": "Featured Items HTML",
"fieldname": "featured_items_html",
"fieldtype": "HTML",
"options": "<h4>Featured Items</h4>"
},
{
"description": "Items Featured on the Item Group Page",
"depends_on": "show_in_website",
"doctype": "DocField",
"label": "Featured Items",
"fieldname": "featured_items",
"fieldtype": "Table",
"hidden": 1,
"options": "Featured Item"
},
{
"doctype": "DocField",
"label": "Page Name",
@@ -112,6 +87,45 @@
"reqd": 1,
"options": "\nYes\nNo"
},
{
"doctype": "DocField",
"label": "Website Settings",
"fieldname": "sb9",
"fieldtype": "Section Break"
},
{
"description": "Check this if you want to show in website",
"no_copy": 0,
"search_index": 0,
"doctype": "DocField",
"label": "Show in Website",
"fieldname": "show_in_website",
"fieldtype": "Check"
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
"label": "Description",
"fieldname": "description",
"fieldtype": "Text Editor"
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
"label": "Featured Items",
"fieldname": "featured_items_html",
"fieldtype": "Section Break"
},
{
"description": "Items Featured on the Item Group Page",
"depends_on": "show_in_website",
"doctype": "DocField",
"label": "Featured Items",
"fieldname": "featured_items",
"fieldtype": "Table",
"hidden": 0,
"options": "Featured Item"
},
{
"print_hide": 1,
"no_copy": 1,
@@ -154,6 +168,22 @@
"options": "Item Group",
"report_hide": 1
},
{
"doctype": "DocField",
"label": "file_list",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
},
{
"print_hide": 1,
"no_copy": 1,
"doctype": "DocField",
"label": "File List",
"fieldname": "file_list",
"fieldtype": "Text",
"hidden": 1
},
{
"amend": 0,
"create": 0,