mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +00:00
[demo] New ERPNext Demo
This commit is contained in:
@@ -4,6 +4,14 @@
|
||||
// update parent select
|
||||
|
||||
$.extend(cur_frm.cscript, {
|
||||
refresh: function(doc) {
|
||||
cur_frm.add_custom_button("Auto Build Website", function() {
|
||||
cur_frm.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "make_website"
|
||||
})
|
||||
}, 'icon-magic')
|
||||
},
|
||||
onload_post_render: function(doc) {
|
||||
this.set_parent_label_options();
|
||||
},
|
||||
|
||||
@@ -13,6 +13,26 @@ class DocType:
|
||||
self.set_home_page()
|
||||
self.validate_top_bar_items()
|
||||
self.validate_footer_items()
|
||||
|
||||
def make_website(self):
|
||||
# set item pages
|
||||
for name in webnotes.conn.sql_list("""select name from tabItem where
|
||||
ifnull(show_in_website, 0)=0 and is_sales_item ='Yes' """):
|
||||
webnotes.msgprint("Setting 'Show in Website' for:" + name)
|
||||
item = webnotes.bean("Item", name)
|
||||
item.doc.show_in_website = 1
|
||||
item.doc.website_warehouse = item.doc.default_warehouse
|
||||
item.doc.website_image = item.doc.image
|
||||
item.save()
|
||||
|
||||
# set item group pages
|
||||
for name in webnotes.conn.sql_list("""select name from `tabItem Group` where
|
||||
ifnull(show_in_website, 0)=0 and exists (select name from tabItem where
|
||||
ifnull(show_in_website, 0)=1)"""):
|
||||
webnotes.msgprint("Setting 'Show in Website' for:" + name)
|
||||
item_group = webnotes.bean("Item Group", name)
|
||||
item_group.doc.show_in_website = 1
|
||||
item_group.save()
|
||||
|
||||
def validate_top_bar_items(self):
|
||||
"""validate url in top bar items"""
|
||||
|
||||
Reference in New Issue
Block a user