From 5f1d57ecb7331658dff0e63e9d655f82f2b15991 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 27 Dec 2012 14:05:02 +0530 Subject: [PATCH 1/5] address now not in dialog, added slideshows in products and groups and removed transaction history from customer / supplier / sales partner --- buying/doctype/supplier/supplier.js | 110 +---- buying/doctype/supplier/supplier.txt | 40 +- patches/december_2012/address_title.py | 11 + patches/patch_list.py | 4 + selling/doctype/customer/customer.js | 104 +---- selling/doctype/customer/customer.txt | 60 +-- .../contact_control/contact_control.js | 50 --- setup/doctype/item_group/item_group.py | 5 +- setup/doctype/item_group/item_group.txt | 11 +- setup/doctype/sales_partner/sales_partner.js | 27 +- setup/doctype/sales_partner/sales_partner.txt | 204 +++++----- startup/event_handlers.py | 2 +- stock/doctype/item/item.py | 7 +- stock/doctype/item/item.txt | 13 +- utilities/doctype/address/address.js | 22 - utilities/doctype/address/address.txt | 384 +++++++++--------- website/doctype/web_page/web_page.py | 8 +- website/doctype/website_script/__init__.py | 0 .../doctype/website_script/website_script.py | 8 + .../doctype/website_script/website_script.txt | 51 +++ .../website_settings/website_settings.txt | 27 +- website/helpers/product.py | 10 +- website/helpers/slideshow.py | 26 ++ website/page/website_home/website_home.html | 21 +- website/templates/html/outer.html | 3 +- website/templates/html/product_group.html | 5 +- website/templates/html/product_page.html | 24 +- website/templates/html/slideshow.html | 21 + website/templates/html/web_page.html | 22 +- website/utils.py | 12 +- 30 files changed, 528 insertions(+), 764 deletions(-) create mode 100644 patches/december_2012/address_title.py create mode 100644 website/doctype/website_script/__init__.py create mode 100644 website/doctype/website_script/website_script.py create mode 100644 website/doctype/website_script/website_script.txt create mode 100644 website/helpers/slideshow.py create mode 100644 website/templates/html/slideshow.html diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js index e527dbee23..5b1868313c 100644 --- a/buying/doctype/supplier/supplier.js +++ b/buying/doctype/supplier/supplier.js @@ -17,17 +17,7 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - - // history doctypes and scripts - cur_frm.history_dict = { - 'Purchase Order' : 'cur_frm.cscript.make_po_list(this.body, this.doc)', - 'Purchase Receipt' : 'cur_frm.cscript.make_pr_list(this.body, this.doc)', - 'Purchase Invoice' : 'cur_frm.cscript.make_pi_list(this.body, this.doc)' - } - // make contact, history list body - //cur_frm.cscript.make_cl_body(); - cur_frm.cscript.make_hl_body(); } cur_frm.cscript.refresh = function(doc,dt,dn) { @@ -44,7 +34,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) { // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); cur_frm.communication_view = new wn.views.CommunicationList({ list: wn.model.get("Communication", {"supplier": doc.name}), @@ -60,6 +49,15 @@ cur_frm.cscript.make_address = function() { parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.supplier = cur_frm.doc.name; + address.supplier_name = cur_frm.doc.supplier_name; + address.address_title = cur_frm.doc.supplier_name; + address.address_type = "Office"; + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -95,94 +93,4 @@ cur_frm.cscript.make_contact = function() { // note: render_contact_row is defined in contact_control.js } cur_frm.contact_list.run(); -} - - -// Transaction History - -cur_frm.cscript.make_po_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Order`.status", - "`tabPurchase Order`.currency", - "ifnull(`tabPurchase Order`.grand_total_import, 0) as grand_total_import", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '20%', content: 'name'}, - {width: '30%', content: 'status', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Order', parent, ListView); -} - -cur_frm.cscript.make_pr_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Receipt`.status", - "`tabPurchase Receipt`.currency", - "ifnull(`tabPurchase Receipt`.grand_total_import, 0) as grand_total_import", - "ifnull(`tabPurchase Receipt`.per_billed, 0) as per_billed", - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '20%', content: 'name'}, - {width: '20%', content: 'status', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '10%', content: 'per_billed', type: 'bar-graph', label: 'Billed'}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Receipt', parent, ListView); -} - -cur_frm.cscript.make_pi_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tabPurchase Invoice`.currency", - "ifnull(`tabPurchase Invoice`.grand_total_import, 0) as grand_total_import", - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_import = data.currency + " " + fmt_money(data.grand_total_import); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '30%', content: 'name'}, - {width: '55%', content: 'grand_total_import', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Purchase Invoice', parent, ListView); } \ No newline at end of file diff --git a/buying/doctype/supplier/supplier.txt b/buying/doctype/supplier/supplier.txt index 318316e646..b1ab5b4fdc 100644 --- a/buying/doctype/supplier/supplier.txt +++ b/buying/doctype/supplier/supplier.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-12-03 10:31:02", + "creation": "2012-12-07 15:15:23", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "modified": "2012-12-27 14:02:18" }, { "autoname": "naming_series:", @@ -38,7 +38,6 @@ { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Basic Info", "fieldname": "basic_info", @@ -95,7 +94,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", "options": "Addresses will appear only when you save the supplier", @@ -104,7 +102,6 @@ "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address HTML", "fieldname": "address_html", @@ -120,7 +117,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", "options": "Contact Details will appear only when you save the supplier", @@ -159,7 +155,6 @@ { "description": "Enter the company name under which Account Head will be created for this Supplier", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Company", "oldfieldname": "company", @@ -174,7 +169,6 @@ { "description": "This currency will get fetched in Purchase transactions of this supplier", "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Default Currency", "options": "link:Currency", @@ -185,7 +179,6 @@ { "description": "Statutory info and other general information about your Supplier", "oldfieldtype": "Code", - "colour": "White:FFF", "doctype": "DocField", "label": "Supplier Details", "oldfieldname": "supplier_details", @@ -216,35 +209,6 @@ "fieldtype": "Data", "permlevel": 0 }, - { - "oldfieldtype": "Section Break", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Transaction History", - "fieldname": "transaction_history", - "fieldtype": "Section Break", - "depends_on": "eval:!doc.__islocal", - "permlevel": 0 - }, - { - "oldfieldtype": "HTML", - "colour": "White:FFF", - "doctype": "DocField", - "label": "History HTML", - "fieldname": "history_html", - "fieldtype": "HTML", - "depends_on": "eval:!doc.__islocal", - "permlevel": 0 - }, - { - "oldfieldtype": "Small Text", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 1 - }, { "amend": 0, "create": 0, diff --git a/patches/december_2012/address_title.py b/patches/december_2012/address_title.py new file mode 100644 index 0000000000..4467d7af20 --- /dev/null +++ b/patches/december_2012/address_title.py @@ -0,0 +1,11 @@ +import webnotes + +def execute(): + webnotes.conn.sql("""update tabAddress set address_title = customer_name where ifnull(customer_name,'')!=''""") + webnotes.conn.sql("""update tabAddress set address_title = supplier_name where ifnull(supplier_name,'')!=''""") + webnotes.conn.sql("""update tabAddress set address_title = sales_partner where ifnull(sales_partner,'')!=''""") + webnotes.reset_perms("Product Settings") + + # move code to new doctype + webnotes.conn.set_value("Website Script", None, "javascript", + webnotes.conn.get_value("Website Settings", None, "startup_code")) \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index 67daf26416..32958d7908 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -558,4 +558,8 @@ patch_list = [ 'patch_module': 'patches.december_2012', 'patch_file': 'rebuild_item_group_tree', }, + { + 'patch_module': 'patches.december_2012', + 'patch_file': 'address_title', + }, ] \ No newline at end of file diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js index 845f543467..bb3e0ce92a 100644 --- a/selling/doctype/customer/customer.js +++ b/selling/doctype/customer/customer.js @@ -17,17 +17,6 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - // history doctypes and scripts - cur_frm.history_dict = { - 'Quotation' : 'cur_frm.cscript.make_qtn_list(this.body, this.doc)', - 'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)', - 'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)', - 'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)' - } - // make address, contact, shipping, history list body - cur_frm.cscript.make_hl_body(); - //cur_frm.cscript.make_sl_body(); - cur_frm.cscript.load_defaults(doc, dt, dn); } @@ -55,7 +44,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) { // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); cur_frm.communication_view = new wn.views.CommunicationList({ list: wn.model.get("Communication", {"customer": doc.name}), @@ -71,6 +59,15 @@ cur_frm.cscript.make_address = function() { parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.customer = cur_frm.doc.name; + address.customer_name = cur_frm.doc.customer_name; + address.address_title = cur_frm.doc.customer_name; + address.address_type = "Office"; + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -117,85 +114,4 @@ cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) { } -cur_frm.fields_dict.lead_name.get_query = erpnext.utils.lead_query; - - -cur_frm.cscript.make_qtn_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Quotation'); -} - -cur_frm.cscript.make_so_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Sales Order'); -} - -cur_frm.cscript.make_dn_list = function(parent, doc) { - cur_frm.cscript.get_common_list_view(parent, doc, 'Delivery Note'); -} - -cur_frm.cscript.get_common_list_view = function(parent, doc, doctype) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "`tab" + doctype + "`.status", - "`tab" + doctype + "`.currency", - "ifnull(`tab" + doctype + "`.grand_total_export, 0) as grand_total_export", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export) - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '25%', content: 'name'}, - {width: '25%', content: 'status'}, - {width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, doctype, parent, ListView); -} - -cur_frm.cscript.make_si_list = function(parent, doc) { - var ListView = wn.views.ListView.extend({ - init: function(doclistview) { - this._super(doclistview); - this.fields = this.fields.concat([ - "ifnull(`tabSales Invoice`.outstanding_amount, 0) as outstanding_amount", - "`tabSales Invoice`.currency", - "ifnull(`tabSales Invoice`.conversion_rate, 0) as conversion_rate", - "ifnull(`tabSales Invoice`.grand_total_export, 0) as grand_total_export", - - ]); - }, - - prepare_data: function(data) { - this._super(data); - if (data.outstanding_amount) { - data.outstanding_amount = data.currency + " " + - fmt_money(flt(data.outstanding_amount)/flt(data.conversion_rate)) + - " [outstanding]"; - - } else { - data.outstanding_amount = ''; - } - data.grand_total_export = data.currency + " " + fmt_money(data.grand_total_export); - }, - - columns: [ - {width: '3%', content: 'docstatus'}, - {width: '25%', content: 'name'}, - {width: '25%', content: 'outstanding_amount', - css: {'text-align': 'right', 'color': '#777'}}, - {width: '35%', content: 'grand_total_export', css: {'text-align': 'right'}}, - {width: '12%', content:'modified', css: {'text-align': 'right'}} - ], - }); - - cur_frm.cscript.render_list(doc, 'Sales Invoice', parent, ListView); -} \ No newline at end of file +cur_frm.fields_dict.lead_name.get_query = erpnext.utils.lead_query; \ No newline at end of file diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt index 1ef77cef4e..600693d4b2 100644 --- a/selling/doctype/customer/customer.txt +++ b/selling/doctype/customer/customer.txt @@ -2,20 +2,20 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-12-03 10:31:05", + "creation": "2012-12-07 15:15:26", "modified_by": "Administrator", - "modified": "2012-12-03 17:10:41" + "modified": "2012-12-27 14:02:01" }, { + "autoname": "naming_series:", "description": "Buyer of Goods and Services.", + "allow_rename": 1, "allow_print": 0, "search_fields": "customer_name,customer_group,country,territory", "module": "Selling", + "doctype": "DocType", "document_type": "Master", - "autoname": "naming_series:", - "name": "__common__", - "allow_rename": 1, - "doctype": "DocType" + "name": "__common__" }, { "name": "__common__", @@ -39,7 +39,6 @@ { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Basic Info", "fieldname": "basic_info", @@ -89,12 +88,10 @@ "description": "Fetch lead which will be converted into customer.", "no_copy": 1, "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Lead Ref", "oldfieldname": "lead_name", "permlevel": 0, - "trigger": "Client", "fieldname": "lead_name", "fieldtype": "Link", "hidden": 0, @@ -113,12 +110,10 @@ "print_hide": 0, "description": "To manage Customer Groups, click here", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Group", "oldfieldname": "customer_group", "permlevel": 0, - "trigger": "Client", "fieldname": "customer_group", "fieldtype": "Link", "search_index": 1, @@ -131,19 +126,16 @@ "print_hide": 1, "description": "To manage Territory, click here", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Territory", "oldfieldname": "territory", - "permlevel": 0, - "trigger": "Client", + "options": "Territory", "fieldname": "territory", "fieldtype": "Link", "reqd": 1, - "options": "Territory" + "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address & Contacts", "fieldname": "address_contacts", @@ -152,7 +144,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", "options": "Addresses will appear only when you save the customer", @@ -161,7 +152,6 @@ "permlevel": 0 }, { - "colour": "White:FFF", "doctype": "DocField", "label": "Address HTML", "fieldname": "address_html", @@ -177,7 +167,6 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", "options": "Contact Details will appear only when you save the customer", @@ -187,7 +176,6 @@ }, { "oldfieldtype": "HTML", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact HTML", "fieldname": "contact_html", @@ -209,7 +197,6 @@ }, { "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "More Info", "fieldname": "more_info", @@ -226,7 +213,6 @@ { "description": "To create an Account Head under a different company, select the company and save customer.", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Company", "oldfieldname": "company", @@ -249,7 +235,6 @@ { "description": "This currency will get fetched in Sales transactions of this customer", "no_copy": 1, - "colour": "White:FFF", "doctype": "DocField", "label": "Default Currency", "options": "link:Currency", @@ -260,7 +245,6 @@ { "description": "Your Customer's TAX registration numbers (if applicable) or any general information", "oldfieldtype": "Code", - "colour": "White:FFF", "doctype": "DocField", "label": "Customer Details", "oldfieldname": "customer_details", @@ -337,34 +321,6 @@ "fieldtype": "Table", "permlevel": 0 }, - { - "depends_on": "eval:!doc.__islocal", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Transaction History", - "fieldname": "transaction_history", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "depends_on": "eval:!doc.__islocal", - "colour": "White:FFF", - "doctype": "DocField", - "label": "History HTML", - "fieldname": "history_html", - "fieldtype": "HTML", - "permlevel": 0 - }, - { - "oldfieldtype": "Small Text", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 1 - }, { "amend": 0, "create": 0, diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js index fd08062a0e..79e9de70da 100755 --- a/setup/doctype/contact_control/contact_control.js +++ b/setup/doctype/contact_control/contact_control.js @@ -2,56 +2,6 @@ // ========================= -// make history list body -// ----------------------- -cur_frm.cscript.make_hl_body = function(){ - cur_frm.fields_dict['history_html'].wrapper.innerHTML = ''; - cur_frm.history_html = $a(cur_frm.fields_dict['history_html'].wrapper,'div'); - $(cur_frm.history_html).css({ - 'min-height': '320px', - }); -} - -// make history -// ------------- -cur_frm.cscript.make_history = function(doc,dt,dn){ - cur_frm.history_html.innerHTML = ''; - cur_frm.cscript.make_history_list(cur_frm.history_html,doc); -} - -// make history list -// ------------------ -cur_frm.cscript.make_history_list = function(parent,doc){ - - var sel = $a(parent,'select'); - - var ls = ['Select Transaction..']; - for(d in cur_frm.history_dict){ - ls.push(d); - } - - add_sel_options(sel,ls,'Select..'); - - var body = $a(parent,'div'); - body.innerHTML = '
Please select a transaction type to see History
'; - - sel.body = body; - sel.doc = doc; - - sel.onchange = function(){ - for(d in cur_frm.history_dict){ - if(sel_val(this) == d){ - this.body.innerHTML = ''; - eval(cur_frm.history_dict[d]); - return; - } - else{ - // pass - } - } - } -} - // get sates on country trigger // ----------------------------- cur_frm.cscript.get_states=function(doc,dt,dn){ diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py index b2a0843af4..3f3cb1a539 100644 --- a/setup/doctype/item_group/item_group.py +++ b/setup/doctype/item_group/item_group.py @@ -54,4 +54,7 @@ class DocType(DocTypeNestedSet): self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20) self.parent_groups = get_parent_item_groups(self.doc.name) - \ No newline at end of file + + if self.doc.slideshow: + from website.helpers.slideshow import get_slideshow + get_slideshow(self) \ No newline at end of file diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt index 72b83aaaf7..2b95965092 100644 --- a/setup/doctype/item_group/item_group.txt +++ b/setup/doctype/item_group/item_group.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-12-07 15:15:28", "modified_by": "Administrator", - "modified": "2012-12-20 16:11:15" + "modified": "2012-12-27 10:38:02" }, { "in_create": 1, @@ -102,6 +102,15 @@ "fieldname": "show_in_website", "fieldtype": "Check" }, + { + "description": "Show this slideshow at the top of the page", + "depends_on": "show_in_website", + "doctype": "DocField", + "label": "Slideshow", + "fieldname": "slideshow", + "fieldtype": "Link", + "options": "Website Slideshow" + }, { "description": "HTML / Banner that will show on the top of product list.", "depends_on": "show_in_website", diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js index a0f138c5a4..c5f0dba7dd 100644 --- a/setup/doctype/sales_partner/sales_partner.js +++ b/setup/doctype/sales_partner/sales_partner.js @@ -17,31 +17,19 @@ wn.require('app/setup/doctype/contact_control/contact_control.js'); cur_frm.cscript.onload = function(doc,dt,dn){ - // history doctypes and scripts - cur_frm.history_dict = { - 'Sales Order' : 'cur_frm.cscript.make_so_list(this.body, this.doc)', - 'Delivery Note' : 'cur_frm.cscript.make_dn_list(this.body, this.doc)', - 'Sales Invoice' : 'cur_frm.cscript.make_si_list(this.body, this.doc)' - } - - // make contact, history list body - //cur_frm.cscript.make_cl_body(); - cur_frm.cscript.make_hl_body(); + } cur_frm.cscript.refresh = function(doc,dt,dn){ if(doc.__islocal){ hide_field(['address_html', 'contact_html']); - //cur_frm.cscript.set_cl_msg(doc); - //cur_frm.cscript.set_hl_msg(doc); } else{ unhide_field(['address_html', 'contact_html']); // make lists cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn); - cur_frm.cscript.make_history(doc,dt,dn); } } @@ -51,7 +39,15 @@ cur_frm.cscript.make_address = function() { cur_frm.address_list = new wn.ui.Listing({ parent: cur_frm.fields_dict['address_html'].wrapper, page_length: 2, - new_doctype: "Address", + new_doctype: "Address", + custom_new_doc: function(doctype) { + var address = wn.model.make_new_doc_and_get_name('Address'); + address = locals['Address'][address]; + address.sales_partner = cur_frm.doc.name; + address.address_title = cur_frm.doc.name; + address.address_type = "Office"; + wn.set_route("Form", "Address", address.name); + }, get_query: function() { return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc" }, @@ -102,5 +98,4 @@ cur_frm.cscript.make_contact = function() { cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) { return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.is_group="No" AND `tabItem Group`.docstatus != 2 AND `tabItem Group`.%(key)s LIKE "%s" LIMIT 50' -} - +} \ No newline at end of file diff --git a/setup/doctype/sales_partner/sales_partner.txt b/setup/doctype/sales_partner/sales_partner.txt index adeb1b7830..a0cfd16ddc 100644 --- a/setup/doctype/sales_partner/sales_partner.txt +++ b/setup/doctype/sales_partner/sales_partner.txt @@ -2,26 +2,19 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-03 13:30:54", + "creation": "2012-07-12 23:29:44", "modified_by": "Administrator", - "modified": "2012-07-12 11:22:15" + "modified": "2012-12-27 14:03:00" }, { - "section_style": "Tabbed", - "description": "A **Sales Partner** is a third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission. This is useful if you make the end sale to the **Customer**, involving your **Sales Partner**.\n\nIf you sell to your **Sales Partner** who in-turn sells it to the **Customer**, then you must make a **Customer** instead.", - "module": "Setup", - "server_code_error": " ", - "allow_trash": 1, - "document_type": "Master", - "in_create": 0, "read_only": 0, - "_last_update": "1322549700", "autoname": "field:partner_name", + "in_create": 0, "name": "__common__", - "colour": "White:FFF", "doctype": "DocType", - "show_in_menu": 0, - "version": 1 + "module": "Setup", + "document_type": "Master", + "description": "A third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission." }, { "name": "__common__", @@ -42,85 +35,9 @@ "name": "Sales Partner", "doctype": "DocType" }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Manager", - "cancel": 0, - "permlevel": 1 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Manager", - "cancel": 0, - "permlevel": 0 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales User", - "cancel": 0, - "permlevel": 1 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales User", - "cancel": 0, - "permlevel": 0 - }, - { - "amend": 0, - "create": 1, - "doctype": "DocPerm", - "submit": 0, - "write": 1, - "role": "Sales Master Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "amend": 0, - "create": 0, - "doctype": "DocPerm", - "submit": 0, - "write": 0, - "role": "Sales Master Manager", - "cancel": 0, - "permlevel": 1 - }, - { - "create": 1, - "doctype": "DocPerm", - "write": 1, - "role": "System Manager", - "cancel": 1, - "permlevel": 0 - }, - { - "create": 0, - "doctype": "DocPerm", - "write": 0, - "role": "System Manager", - "permlevel": 1 - }, { "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "oldfieldtype": "Section Break", - "colour": "White:FFF", "doctype": "DocField", "label": "Sales Partner Details", "fieldname": "basic_info", @@ -128,27 +45,27 @@ "permlevel": 0 }, { - "search_index": 1, + "oldfieldtype": "Data", "doctype": "DocField", "label": "Sales Partner Name", "oldfieldname": "partner_name", "fieldname": "partner_name", "fieldtype": "Data", - "oldfieldtype": "Data", + "search_index": 1, "reqd": 1, "permlevel": 0, "in_filter": 1 }, { - "search_index": 0, + "oldfieldtype": "Select", "doctype": "DocField", "label": "Partner Type", "oldfieldname": "partner_type", - "permlevel": 0, + "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller", "fieldname": "partner_type", "fieldtype": "Select", - "oldfieldtype": "Select", - "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller", + "search_index": 0, + "permlevel": 0, "in_filter": 1 }, { @@ -187,13 +104,12 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Address Desc", - "permlevel": 0, + "options": "Addresses will appear only when you save the customer", "fieldname": "address_desc", "fieldtype": "HTML", - "options": "Addresses will appear only when you save the customer" + "permlevel": 0 }, { "doctype": "DocField", @@ -210,13 +126,12 @@ }, { "depends_on": "eval:doc.__islocal", - "colour": "White:FFF", "doctype": "DocField", "label": "Contact Desc", - "permlevel": 0, + "options": "Contact Details will appear only when you save the customer", "fieldname": "contact_desc", "fieldtype": "HTML", - "options": "Contact Details will appear only when you save the customer" + "permlevel": 0 }, { "doctype": "DocField", @@ -238,31 +153,96 @@ "doctype": "DocField", "label": "Partner Target Detail", "oldfieldname": "partner_target_details", - "permlevel": 0, + "options": "Target Detail", "fieldname": "partner_target_details", "fieldtype": "Table", "reqd": 0, - "options": "Target Detail" + "permlevel": 0 }, { "description": "Select Budget Distribution to unevenly distribute targets across months.", "oldfieldtype": "Link", - "colour": "White:FFF", "doctype": "DocField", "label": "Target Distribution", "oldfieldname": "distribution_id", - "permlevel": 0, + "options": "Budget Distribution", "fieldname": "distribution_id", "fieldtype": "Link", - "options": "Budget Distribution" + "permlevel": 0 }, { - "oldfieldtype": "Small Text", - "doctype": "DocField", - "label": "Trash Reason", - "oldfieldname": "trash_reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Manager", + "cancel": 0, + "permlevel": 1 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Manager", + "cancel": 0, + "permlevel": 0 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales User", + "cancel": 0, + "permlevel": 1 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales User", + "cancel": 0, + "permlevel": 0 + }, + { + "amend": 0, + "create": 1, + "doctype": "DocPerm", + "submit": 0, + "write": 1, + "role": "Sales Master Manager", + "cancel": 1, + "permlevel": 0 + }, + { + "amend": 0, + "create": 0, + "doctype": "DocPerm", + "submit": 0, + "write": 0, + "role": "Sales Master Manager", + "cancel": 0, + "permlevel": 1 + }, + { + "create": 1, + "doctype": "DocPerm", + "write": 1, + "role": "System Manager", + "cancel": 1, + "permlevel": 0 + }, + { + "create": 0, + "doctype": "DocPerm", + "write": 0, + "role": "System Manager", "permlevel": 1 } ] \ No newline at end of file diff --git a/startup/event_handlers.py b/startup/event_handlers.py index 4808298368..70a66e9e3b 100644 --- a/startup/event_handlers.py +++ b/startup/event_handlers.py @@ -131,7 +131,7 @@ def check_if_expired(): def get_web_script(): """returns web startup script""" - return webnotes.conn.get_value('Website Settings', None, 'startup_code') or '' + return webnotes.conn.get_value('Website Script', None, 'javascript') or '' def get_web_style(): """returns web css""" diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 7db903d9a3..5b00643843 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -205,5 +205,10 @@ class DocType: clear_cache(self.doc.page_name) def prepare_template_args(self): - from website.helpers.product import get_parent_item_groups + from website.helpers.product import get_parent_item_groups, url_for_website self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}] + self.doc.website_image = url_for_website(self.doc.website_image) + + if self.doc.slideshow: + from website.helpers.slideshow import get_slideshow + get_slideshow(self) \ No newline at end of file diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt index cdc3ae5de5..d1fc4fcb93 100644 --- a/stock/doctype/item/item.txt +++ b/stock/doctype/item/item.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-12-17 14:56:32", "modified_by": "Administrator", - "modified": "2012-12-25 13:52:47" + "modified": "2012-12-27 10:36:56" }, { "allow_attach": 1, @@ -781,6 +781,17 @@ "permlevel": 0 }, { + "description": "Show a slideshow at the top of the page", + "depends_on": "show_in_website", + "doctype": "DocField", + "label": "Slideshow", + "options": "Website Slideshow", + "fieldname": "slideshow", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "description": "Item Image (if not slideshow)", "depends_on": "show_in_website", "doctype": "DocField", "label": "Image", diff --git a/utilities/doctype/address/address.js b/utilities/doctype/address/address.js index 147f768210..a11dd05b6d 100644 --- a/utilities/doctype/address/address.js +++ b/utilities/doctype/address/address.js @@ -20,26 +20,4 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query; - - var route = wn.get_route(); - if(route[1]=='Supplier') { - var supplier = wn.container.page.frm.doc; - doc.supplier = supplier.name; - doc.supplier_name = supplier.supplier_name; - doc.address_type = 'Office'; - } else if(route[1]=='Customer') { - var customer = wn.container.page.frm.doc; - doc.customer = customer.name; - doc.customer_name = customer.customer_name; - doc.address_type = 'Office'; - } else if(route[1]=='Sales Partner') { - var sp = wn.container.page.frm.doc; - doc.sales_partner = sp.name; - doc.address_type = 'Office'; - } -} - -cur_frm.cscript.hide_dialog = function() { - if(cur_frm.address_list) - cur_frm.address_list.run(); } \ No newline at end of file diff --git a/utilities/doctype/address/address.txt b/utilities/doctype/address/address.txt index 4a3fe7fa1d..f77f3975b9 100644 --- a/utilities/doctype/address/address.txt +++ b/utilities/doctype/address/address.txt @@ -2,23 +2,17 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-07-02 19:57:47", + "creation": "2012-07-03 13:30:41", "modified_by": "Administrator", - "modified": "2012-07-02 20:24:15" + "modified": "2012-12-27 11:31:37" }, { - "section_style": "Simple", + "name": "__common__", "search_fields": "customer, supplier, sales_partner, country, state", "module": "Utilities", - "_last_update": "1319016431", - "allow_trash": 1, - "in_dialog": 1, - "document_type": "Master", - "name": "__common__", - "colour": "White:FFF", "doctype": "DocType", - "show_in_menu": 0, - "version": 1 + "in_dialog": 0, + "document_type": "Master" }, { "name": "__common__", @@ -39,6 +33,187 @@ "name": "Address", "doctype": "DocType" }, + { + "doctype": "DocField", + "label": "Address Details", + "fieldname": "address_details", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "description": "e.g. Office, Billing, Shipping", + "doctype": "DocField", + "label": "Address Type", + "fieldname": "address_type", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "description": "Name of person or organization that this address belongs to.", + "doctype": "DocField", + "label": "Address Title", + "fieldname": "address_title", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Address Line1", + "fieldname": "address_line1", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Address Line2", + "fieldname": "address_line2", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "City/Town", + "fieldname": "city", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "Pincode", + "fieldname": "pincode", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 1, + "doctype": "DocField", + "label": "Country", + "options": "link:Country", + "fieldname": "country", + "fieldtype": "Select", + "reqd": 1, + "permlevel": 0, + "in_filter": 1 + }, + { + "search_index": 0, + "doctype": "DocField", + "label": "State", + "options": "Suggest", + "fieldname": "state", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "print_hide": 0, + "doctype": "DocField", + "width": "50%", + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Phone", + "fieldname": "phone", + "fieldtype": "Data", + "reqd": 1, + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Email Id", + "fieldname": "email_id", + "fieldtype": "Data", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Fax", + "fieldname": "fax", + "fieldtype": "Data", + "permlevel": 0, + "in_filter": 1 + }, + { + "description": "Check to make primary address", + "default": "0", + "doctype": "DocField", + "label": "Is Primary Address", + "fieldname": "is_primary_address", + "fieldtype": "Check", + "permlevel": 0 + }, + { + "description": "Check to make Shipping Address", + "default": "0", + "doctype": "DocField", + "label": "Is Shipping Address", + "fieldname": "is_shipping_address", + "fieldtype": "Check", + "permlevel": 0 + }, + { + "doctype": "DocField", + "label": "Linked With", + "fieldname": "linked_with", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "doctype": "DocField", + "label": "Customer", + "options": "Customer", + "fieldname": "customer", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.supplier && !doc.sales_partner", + "doctype": "DocField", + "label": "Customer Name", + "fieldname": "customer_name", + "fieldtype": "Data", + "permlevel": 1, + "in_filter": 1 + }, + { + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "doctype": "DocField", + "label": "Supplier", + "options": "Supplier", + "fieldname": "supplier", + "fieldtype": "Link", + "permlevel": 0 + }, + { + "depends_on": "eval:!doc.customer && !doc.sales_partner", + "doctype": "DocField", + "label": "Supplier Name", + "fieldname": "supplier_name", + "fieldtype": "Data", + "search_index": 0, + "permlevel": 1, + "in_filter": 1 + }, + { + "depends_on": "eval:!doc.customer && !doc.supplier", + "doctype": "DocField", + "label": "Sales Partner", + "options": "Sales Partner", + "fieldname": "sales_partner", + "fieldtype": "Link", + "permlevel": 0 + }, { "create": 1, "doctype": "DocPerm", @@ -128,192 +303,5 @@ "role": "All", "cancel": 0, "permlevel": 1 - }, - { - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Details", - "fieldname": "address_details", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "description": "e.g. Office, Billing, Shipping", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Type", - "fieldname": "address_type", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "colour": "White:FFF", - "doctype": "DocField", - "label": "Address Line1", - "fieldname": "address_line1", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Address Line2", - "fieldname": "address_line2", - "fieldtype": "Data", - "permlevel": 0 - }, - { - "search_index": 1, - "colour": "White:FFF", - "doctype": "DocField", - "label": "City/Town", - "fieldname": "city", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 1, - "doctype": "DocField", - "label": "Pincode", - "fieldname": "pincode", - "fieldtype": "Data", - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 1, - "colour": "White:FFF", - "doctype": "DocField", - "label": "Country", - "trigger": "Client", - "fieldname": "country", - "fieldtype": "Select", - "reqd": 1, - "options": "link:Country", - "permlevel": 0, - "in_filter": 1 - }, - { - "search_index": 0, - "colour": "White:FFF", - "doctype": "DocField", - "label": "State", - "permlevel": 0, - "fieldname": "state", - "fieldtype": "Data", - "options": "Suggest", - "in_filter": 1 - }, - { - "print_hide": 0, - "doctype": "DocField", - "width": "50%", - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Phone", - "fieldname": "phone", - "fieldtype": "Data", - "reqd": 1, - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Email Id", - "fieldname": "email_id", - "fieldtype": "Data", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Fax", - "fieldname": "fax", - "fieldtype": "Data", - "permlevel": 0, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Customer", - "permlevel": 0, - "fieldname": "customer", - "fieldtype": "Link", - "options": "Customer" - }, - { - "depends_on": "eval:!doc.supplier && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Customer Name", - "fieldname": "customer_name", - "fieldtype": "Data", - "permlevel": 1, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Supplier", - "permlevel": 0, - "fieldname": "supplier", - "fieldtype": "Link", - "options": "Supplier" - }, - { - "search_index": 0, - "colour": "White:FFF", - "doctype": "DocField", - "label": "Supplier Name", - "fieldname": "supplier_name", - "fieldtype": "Data", - "depends_on": "eval:!doc.customer && !doc.sales_partner", - "permlevel": 1, - "in_filter": 1 - }, - { - "depends_on": "eval:!doc.customer && !doc.supplier", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Sales Partner", - "permlevel": 0, - "fieldname": "sales_partner", - "fieldtype": "Link", - "options": "Sales Partner" - }, - { - "description": "Check to make primary address", - "default": "0", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Is Primary Address", - "fieldname": "is_primary_address", - "fieldtype": "Check", - "permlevel": 0 - }, - { - "description": "Check to make Shipping Address", - "default": "0", - "colour": "White:FFF", - "doctype": "DocField", - "label": "Is Shipping Address", - "fieldname": "is_shipping_address", - "fieldtype": "Check", - "permlevel": 0 - }, - { - "doctype": "DocField", - "label": "Trash Reason", - "fieldname": "trash_reason", - "fieldtype": "Small Text", - "permlevel": 0 } ] \ No newline at end of file diff --git a/website/doctype/web_page/web_page.py b/website/doctype/web_page/web_page.py index 324893dcc6..d90274409d 100644 --- a/website/doctype/web_page/web_page.py +++ b/website/doctype/web_page/web_page.py @@ -42,9 +42,5 @@ class DocType(): def prepare_template_args(self): if self.doc.slideshow: - slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow) - self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) - self.doc.slideshow_header = slideshow.doc.header or "" - for s in self.slides: - if s.image and not s.image.lower().startswith("http"): - s.image = "files/" + s.image + from website.helpers.slideshow import get_slideshow + get_slideshow(self) diff --git a/website/doctype/website_script/__init__.py b/website/doctype/website_script/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/website/doctype/website_script/website_script.py b/website/doctype/website_script/website_script.py new file mode 100644 index 0000000000..928aa9ff9f --- /dev/null +++ b/website/doctype/website_script/website_script.py @@ -0,0 +1,8 @@ +# For license information, please see license.txt + +from __future__ import unicode_literals +import webnotes + +class DocType: + def __init__(self, d, dl): + self.doc, self.doclist = d, dl \ No newline at end of file diff --git a/website/doctype/website_script/website_script.txt b/website/doctype/website_script/website_script.txt new file mode 100644 index 0000000000..cf22537bf8 --- /dev/null +++ b/website/doctype/website_script/website_script.txt @@ -0,0 +1,51 @@ +[ + { + "owner": "Administrator", + "docstatus": 0, + "creation": "2012-12-27 11:51:24", + "modified_by": "Administrator", + "modified": "2012-12-27 12:25:04" + }, + { + "issingle": 1, + "description": "Script to attach to all web pages.", + "doctype": "DocType", + "module": "Website", + "document_type": "Other", + "name": "__common__" + }, + { + "parent": "Website Script", + "doctype": "DocField", + "name": "__common__", + "label": "Javascript", + "parenttype": "DocType", + "options": "Javascript", + "fieldname": "javascript", + "fieldtype": "Code", + "permlevel": 0, + "parentfield": "fields" + }, + { + "parent": "Website Script", + "read": 1, + "name": "__common__", + "create": 1, + "doctype": "DocPerm", + "write": 1, + "parenttype": "DocType", + "role": "Website Manager", + "permlevel": 0, + "parentfield": "permissions" + }, + { + "name": "Website Script", + "doctype": "DocType" + }, + { + "doctype": "DocField" + }, + { + "doctype": "DocPerm" + } +] \ No newline at end of file diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt index 4ef8addde5..78e9336488 100644 --- a/website/doctype/website_settings/website_settings.txt +++ b/website/doctype/website_settings/website_settings.txt @@ -4,7 +4,7 @@ "docstatus": 0, "creation": "2012-07-12 23:29:36", "modified_by": "Administrator", - "modified": "2012-12-25 15:41:48" + "modified": "2012-12-27 12:27:02" }, { "issingle": 1, @@ -80,6 +80,15 @@ "fieldtype": "Section Break", "permlevel": 0 }, + { + "description": "Background shade of the top menu bar", + "doctype": "DocField", + "label": "Top Bar Background", + "options": "Black\nWhite", + "fieldname": "top_bar_background", + "fieldtype": "Select", + "permlevel": 0 + }, { "description": "Brand is what appears on the top-right of the toolbar. If it is an image, make sure it\nhas a transparent background and use the <img /> tag. Keep size as 200px x 30px", "doctype": "DocField", @@ -171,22 +180,6 @@ "hidden": 1, "permlevel": 0 }, - { - "doctype": "DocField", - "label": "Startup", - "fieldname": "analytics", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "description": "Bind events on startup and page change", - "doctype": "DocField", - "label": "Startup Code", - "options": "Javascript", - "fieldname": "startup_code", - "fieldtype": "Code", - "permlevel": 0 - }, { "create": 1, "doctype": "DocPerm", diff --git a/website/helpers/product.py b/website/helpers/product.py index 0497124c17..1e8257a7a7 100644 --- a/website/helpers/product.py +++ b/website/helpers/product.py @@ -2,7 +2,10 @@ # License: GNU General Public License (v3). For more information see license.txt from __future__ import unicode_literals + import webnotes +from webnotes.utils import cstr +from website.utils import build_html, url_for_website, delete_page_cache @webnotes.whitelist(allow_guest=True) @@ -26,8 +29,6 @@ def get_product_info(item_code): @webnotes.whitelist(allow_guest=True) def get_product_list(search=None, product_group=None, start=0, limit=10): - from webnotes.utils import cstr - # base query query = """select name, item_name, page_name, website_image, item_group, web_long_description as website_description @@ -81,7 +82,6 @@ def get_group_item_count(item_group): where item_group in (%s))) """ % (child_groups, child_groups))[0][0] def get_item_for_list_in_html(r): - from website.utils import build_html scrub_item_for_list(r) r.template = "html/product_in_list.html" return build_html(r) @@ -91,8 +91,7 @@ def scrub_item_for_list(r): r.website_description = "No description given" if len(r.website_description.split(" ")) > 24: r.website_description = " ".join(r.website_description.split(" ")[:24]) + "..." - if r.website_image and not r.website_image.lower().startswith("http"): - r.website_image = "files/" + r.website_image + r.website_image = url_for_website(r.website_image) def get_parent_item_groups(item_group_name): item_group = webnotes.doc("Item Group", item_group_name) @@ -102,6 +101,5 @@ def get_parent_item_groups(item_group_name): order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True) def invalidate_cache_for(item_group): - from website.utils import delete_page_cache for i in get_parent_item_groups(item_group): delete_page_cache(i.page_name) \ No newline at end of file diff --git a/website/helpers/slideshow.py b/website/helpers/slideshow.py new file mode 100644 index 0000000000..2c2ae4ba05 --- /dev/null +++ b/website/helpers/slideshow.py @@ -0,0 +1,26 @@ +# 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 . + +import webnotes + +def get_slideshow(obj): + slideshow = webnotes.model_wrapper("Website Slideshow", obj.doc.slideshow) + obj.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) + obj.doc.slideshow_header = slideshow.doc.header or "" + for s in obj.slides: + if s.image and not s.image.lower().startswith("http"): + s.image = "files/" + s.image + \ No newline at end of file diff --git a/website/page/website_home/website_home.html b/website/page/website_home/website_home.html index 8c986cc697..b32995b9b3 100644 --- a/website/page/website_home/website_home.html +++ b/website/page/website_home/website_home.html @@ -29,18 +29,15 @@
-

Create website with static pages and blogs

-
    -
  • "Website Settings" - to setup header and footers. -
  • "Web Page" - for static web page. -
  • "Blog" - for blog entry. -
-

Notes:

-
    -
  • All pages are accessible via `#` + page name appended to your url. -
  • Product catalogue is updated from Item Master (set Show in Website = 'Yes', in - Sales Settings). -
+
Advanced
+
+ +
+
diff --git a/website/templates/html/outer.html b/website/templates/html/outer.html index aef91a9d55..322ce60489 100644 --- a/website/templates/html/outer.html +++ b/website/templates/html/outer.html @@ -9,7 +9,7 @@