address now not in dialog, added slideshows in products and groups and removed transaction history from customer / supplier / sales partner

This commit is contained in:
Rushabh Mehta 2012-12-27 14:05:02 +05:30
parent 7285a720a0
commit 5f1d57ecb7
30 changed files with 528 additions and 764 deletions

View File

@ -18,16 +18,6 @@ wn.require('app/setup/doctype/contact_control/contact_control.js');
cur_frm.cscript.onload = function(doc,dt,dn){ 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) { cur_frm.cscript.refresh = function(doc,dt,dn) {
@ -44,7 +34,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
// make lists // make lists
cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_address(doc,dt,dn);
cur_frm.cscript.make_contact(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({ cur_frm.communication_view = new wn.views.CommunicationList({
list: wn.model.get("Communication", {"supplier": doc.name}), 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, parent: cur_frm.fields_dict['address_html'].wrapper,
page_length: 2, 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.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() { 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" 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"
}, },
@ -96,93 +94,3 @@ cur_frm.cscript.make_contact = function() {
} }
cur_frm.contact_list.run(); 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);
}

View File

@ -2,9 +2,9 @@
{ {
"owner": "Administrator", "owner": "Administrator",
"docstatus": 0, "docstatus": 0,
"creation": "2012-12-03 10:31:02", "creation": "2012-12-07 15:15:23",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-12-03 17:10:41" "modified": "2012-12-27 14:02:18"
}, },
{ {
"autoname": "naming_series:", "autoname": "naming_series:",
@ -38,7 +38,6 @@
{ {
"description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts", "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Basic Info", "label": "Basic Info",
"fieldname": "basic_info", "fieldname": "basic_info",
@ -95,7 +94,6 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address Desc", "label": "Address Desc",
"options": "<em>Addresses will appear only when you save the supplier</em>", "options": "<em>Addresses will appear only when you save the supplier</em>",
@ -104,7 +102,6 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address HTML", "label": "Address HTML",
"fieldname": "address_html", "fieldname": "address_html",
@ -120,7 +117,6 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Contact Desc", "label": "Contact Desc",
"options": "<em>Contact Details will appear only when you save the supplier</em>", "options": "<em>Contact Details will appear only when you save the supplier</em>",
@ -159,7 +155,6 @@
{ {
"description": "Enter the company name under which Account Head will be created for this Supplier", "description": "Enter the company name under which Account Head will be created for this Supplier",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Company", "label": "Company",
"oldfieldname": "company", "oldfieldname": "company",
@ -174,7 +169,6 @@
{ {
"description": "This currency will get fetched in Purchase transactions of this supplier", "description": "This currency will get fetched in Purchase transactions of this supplier",
"no_copy": 1, "no_copy": 1,
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Default Currency", "label": "Default Currency",
"options": "link:Currency", "options": "link:Currency",
@ -185,7 +179,6 @@
{ {
"description": "Statutory info and other general information about your Supplier", "description": "Statutory info and other general information about your Supplier",
"oldfieldtype": "Code", "oldfieldtype": "Code",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Supplier Details", "label": "Supplier Details",
"oldfieldname": "supplier_details", "oldfieldname": "supplier_details",
@ -216,35 +209,6 @@
"fieldtype": "Data", "fieldtype": "Data",
"permlevel": 0 "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, "amend": 0,
"create": 0, "create": 0,

View File

@ -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"))

View File

@ -558,4 +558,8 @@ patch_list = [
'patch_module': 'patches.december_2012', 'patch_module': 'patches.december_2012',
'patch_file': 'rebuild_item_group_tree', 'patch_file': 'rebuild_item_group_tree',
}, },
{
'patch_module': 'patches.december_2012',
'patch_file': 'address_title',
},
] ]

View File

@ -17,17 +17,6 @@
wn.require('app/setup/doctype/contact_control/contact_control.js'); wn.require('app/setup/doctype/contact_control/contact_control.js');
cur_frm.cscript.onload = function(doc,dt,dn){ 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); cur_frm.cscript.load_defaults(doc, dt, dn);
} }
@ -55,7 +44,6 @@ cur_frm.cscript.refresh = function(doc,dt,dn) {
// make lists // make lists
cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_address(doc,dt,dn);
cur_frm.cscript.make_contact(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({ cur_frm.communication_view = new wn.views.CommunicationList({
list: wn.model.get("Communication", {"customer": doc.name}), 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, parent: cur_frm.fields_dict['address_html'].wrapper,
page_length: 2, 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.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() { 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" 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"
}, },
@ -118,84 +115,3 @@ 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.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);
}

View File

@ -2,20 +2,20 @@
{ {
"owner": "Administrator", "owner": "Administrator",
"docstatus": 0, "docstatus": 0,
"creation": "2012-12-03 10:31:05", "creation": "2012-12-07 15:15:26",
"modified_by": "Administrator", "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.", "description": "Buyer of Goods and Services.",
"allow_rename": 1,
"allow_print": 0, "allow_print": 0,
"search_fields": "customer_name,customer_group,country,territory", "search_fields": "customer_name,customer_group,country,territory",
"module": "Selling", "module": "Selling",
"doctype": "DocType",
"document_type": "Master", "document_type": "Master",
"autoname": "naming_series:", "name": "__common__"
"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", "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Basic Info", "label": "Basic Info",
"fieldname": "basic_info", "fieldname": "basic_info",
@ -89,12 +88,10 @@
"description": "Fetch lead which will be converted into customer.", "description": "Fetch lead which will be converted into customer.",
"no_copy": 1, "no_copy": 1,
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Lead Ref", "label": "Lead Ref",
"oldfieldname": "lead_name", "oldfieldname": "lead_name",
"permlevel": 0, "permlevel": 0,
"trigger": "Client",
"fieldname": "lead_name", "fieldname": "lead_name",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0, "hidden": 0,
@ -113,12 +110,10 @@
"print_hide": 0, "print_hide": 0,
"description": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>", "description": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Customer Group", "label": "Customer Group",
"oldfieldname": "customer_group", "oldfieldname": "customer_group",
"permlevel": 0, "permlevel": 0,
"trigger": "Client",
"fieldname": "customer_group", "fieldname": "customer_group",
"fieldtype": "Link", "fieldtype": "Link",
"search_index": 1, "search_index": 1,
@ -131,19 +126,16 @@
"print_hide": 1, "print_hide": 1,
"description": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>", "description": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Territory", "label": "Territory",
"oldfieldname": "territory", "oldfieldname": "territory",
"permlevel": 0, "options": "Territory",
"trigger": "Client",
"fieldname": "territory", "fieldname": "territory",
"fieldtype": "Link", "fieldtype": "Link",
"reqd": 1, "reqd": 1,
"options": "Territory" "permlevel": 0
}, },
{ {
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address & Contacts", "label": "Address & Contacts",
"fieldname": "address_contacts", "fieldname": "address_contacts",
@ -152,7 +144,6 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address Desc", "label": "Address Desc",
"options": "<em>Addresses will appear only when you save the customer</em>", "options": "<em>Addresses will appear only when you save the customer</em>",
@ -161,7 +152,6 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address HTML", "label": "Address HTML",
"fieldname": "address_html", "fieldname": "address_html",
@ -177,7 +167,6 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Contact Desc", "label": "Contact Desc",
"options": "<em>Contact Details will appear only when you save the customer</em>", "options": "<em>Contact Details will appear only when you save the customer</em>",
@ -187,7 +176,6 @@
}, },
{ {
"oldfieldtype": "HTML", "oldfieldtype": "HTML",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Contact HTML", "label": "Contact HTML",
"fieldname": "contact_html", "fieldname": "contact_html",
@ -209,7 +197,6 @@
}, },
{ {
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "More Info", "label": "More Info",
"fieldname": "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.", "description": "To create an Account Head under a different company, select the company and save customer.",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Company", "label": "Company",
"oldfieldname": "company", "oldfieldname": "company",
@ -249,7 +235,6 @@
{ {
"description": "This currency will get fetched in Sales transactions of this customer", "description": "This currency will get fetched in Sales transactions of this customer",
"no_copy": 1, "no_copy": 1,
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Default Currency", "label": "Default Currency",
"options": "link:Currency", "options": "link:Currency",
@ -260,7 +245,6 @@
{ {
"description": "Your Customer's TAX registration numbers (if applicable) or any general information", "description": "Your Customer's TAX registration numbers (if applicable) or any general information",
"oldfieldtype": "Code", "oldfieldtype": "Code",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Customer Details", "label": "Customer Details",
"oldfieldname": "customer_details", "oldfieldname": "customer_details",
@ -337,34 +321,6 @@
"fieldtype": "Table", "fieldtype": "Table",
"permlevel": 0 "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, "amend": 0,
"create": 0, "create": 0,

View File

@ -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 = '<div class="help_box">Please select a transaction type to see History</div>';
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 // get sates on country trigger
// ----------------------------- // -----------------------------
cur_frm.cscript.get_states=function(doc,dt,dn){ cur_frm.cscript.get_states=function(doc,dt,dn){

View File

@ -55,3 +55,6 @@ class DocType(DocTypeNestedSet):
self.doc.items = get_product_list_for_group(product_group = self.doc.name, limit=20) 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) self.parent_groups = get_parent_item_groups(self.doc.name)
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
get_slideshow(self)

View File

@ -4,7 +4,7 @@
"docstatus": 0, "docstatus": 0,
"creation": "2012-12-07 15:15:28", "creation": "2012-12-07 15:15:28",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-12-20 16:11:15" "modified": "2012-12-27 10:38:02"
}, },
{ {
"in_create": 1, "in_create": 1,
@ -102,6 +102,15 @@
"fieldname": "show_in_website", "fieldname": "show_in_website",
"fieldtype": "Check" "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.", "description": "HTML / Banner that will show on the top of product list.",
"depends_on": "show_in_website", "depends_on": "show_in_website",

View File

@ -17,31 +17,19 @@
wn.require('app/setup/doctype/contact_control/contact_control.js'); wn.require('app/setup/doctype/contact_control/contact_control.js');
cur_frm.cscript.onload = function(doc,dt,dn){ 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){ cur_frm.cscript.refresh = function(doc,dt,dn){
if(doc.__islocal){ if(doc.__islocal){
hide_field(['address_html', 'contact_html']); hide_field(['address_html', 'contact_html']);
//cur_frm.cscript.set_cl_msg(doc);
//cur_frm.cscript.set_hl_msg(doc);
} }
else{ else{
unhide_field(['address_html', 'contact_html']); unhide_field(['address_html', 'contact_html']);
// make lists // make lists
cur_frm.cscript.make_address(doc,dt,dn); cur_frm.cscript.make_address(doc,dt,dn);
cur_frm.cscript.make_contact(doc,dt,dn); cur_frm.cscript.make_contact(doc,dt,dn);
cur_frm.cscript.make_history(doc,dt,dn);
} }
} }
@ -52,6 +40,14 @@ cur_frm.cscript.make_address = function() {
parent: cur_frm.fields_dict['address_html'].wrapper, parent: cur_frm.fields_dict['address_html'].wrapper,
page_length: 2, 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() { 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" 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"
}, },
@ -103,4 +99,3 @@ cur_frm.cscript.make_contact = function() {
cur_frm.fields_dict['partner_target_details'].grid.get_field("item_group").get_query = function(doc, dt, dn) { 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' 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'
} }

View File

@ -2,26 +2,19 @@
{ {
"owner": "Administrator", "owner": "Administrator",
"docstatus": 0, "docstatus": 0,
"creation": "2012-07-03 13:30:54", "creation": "2012-07-12 23:29:44",
"modified_by": "Administrator", "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, "read_only": 0,
"_last_update": "1322549700",
"autoname": "field:partner_name", "autoname": "field:partner_name",
"in_create": 0,
"name": "__common__", "name": "__common__",
"colour": "White:FFF",
"doctype": "DocType", "doctype": "DocType",
"show_in_menu": 0, "module": "Setup",
"version": 1 "document_type": "Master",
"description": "A third party distributor / dealer / commission agent / affiliate / reseller who sells the companies products for a commission."
}, },
{ {
"name": "__common__", "name": "__common__",
@ -42,85 +35,9 @@
"name": "Sales Partner", "name": "Sales Partner",
"doctype": "DocType" "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", "description": "Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Sales Partner Details", "label": "Sales Partner Details",
"fieldname": "basic_info", "fieldname": "basic_info",
@ -128,27 +45,27 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"search_index": 1, "oldfieldtype": "Data",
"doctype": "DocField", "doctype": "DocField",
"label": "Sales Partner Name", "label": "Sales Partner Name",
"oldfieldname": "partner_name", "oldfieldname": "partner_name",
"fieldname": "partner_name", "fieldname": "partner_name",
"fieldtype": "Data", "fieldtype": "Data",
"oldfieldtype": "Data", "search_index": 1,
"reqd": 1, "reqd": 1,
"permlevel": 0, "permlevel": 0,
"in_filter": 1 "in_filter": 1
}, },
{ {
"search_index": 0, "oldfieldtype": "Select",
"doctype": "DocField", "doctype": "DocField",
"label": "Partner Type", "label": "Partner Type",
"oldfieldname": "partner_type", "oldfieldname": "partner_type",
"permlevel": 0, "options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller",
"fieldname": "partner_type", "fieldname": "partner_type",
"fieldtype": "Select", "fieldtype": "Select",
"oldfieldtype": "Select", "search_index": 0,
"options": "\nChannel Partner\nDistributor\nDealer\nAgent\nRetailer\nImplementation Partner\nReseller", "permlevel": 0,
"in_filter": 1 "in_filter": 1
}, },
{ {
@ -187,13 +104,12 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Address Desc", "label": "Address Desc",
"permlevel": 0, "options": "<em>Addresses will appear only when you save the customer</em>",
"fieldname": "address_desc", "fieldname": "address_desc",
"fieldtype": "HTML", "fieldtype": "HTML",
"options": "<em>Addresses will appear only when you save the customer</em>" "permlevel": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -210,13 +126,12 @@
}, },
{ {
"depends_on": "eval:doc.__islocal", "depends_on": "eval:doc.__islocal",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Contact Desc", "label": "Contact Desc",
"permlevel": 0, "options": "<em>Contact Details will appear only when you save the customer</em>",
"fieldname": "contact_desc", "fieldname": "contact_desc",
"fieldtype": "HTML", "fieldtype": "HTML",
"options": "<em>Contact Details will appear only when you save the customer</em>" "permlevel": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -238,31 +153,96 @@
"doctype": "DocField", "doctype": "DocField",
"label": "Partner Target Detail", "label": "Partner Target Detail",
"oldfieldname": "partner_target_details", "oldfieldname": "partner_target_details",
"permlevel": 0, "options": "Target Detail",
"fieldname": "partner_target_details", "fieldname": "partner_target_details",
"fieldtype": "Table", "fieldtype": "Table",
"reqd": 0, "reqd": 0,
"options": "Target Detail" "permlevel": 0
}, },
{ {
"description": "Select Budget Distribution to unevenly distribute targets across months.", "description": "Select Budget Distribution to unevenly distribute targets across months.",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField", "doctype": "DocField",
"label": "Target Distribution", "label": "Target Distribution",
"oldfieldname": "distribution_id", "oldfieldname": "distribution_id",
"permlevel": 0, "options": "Budget Distribution",
"fieldname": "distribution_id", "fieldname": "distribution_id",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Budget Distribution" "permlevel": 0
}, },
{ {
"oldfieldtype": "Small Text", "amend": 0,
"doctype": "DocField", "create": 0,
"label": "Trash Reason", "doctype": "DocPerm",
"oldfieldname": "trash_reason", "submit": 0,
"fieldname": "trash_reason", "write": 0,
"fieldtype": "Small Text", "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 "permlevel": 1
} }
] ]

View File

@ -131,7 +131,7 @@ def check_if_expired():
def get_web_script(): def get_web_script():
"""returns web startup 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(): def get_web_style():
"""returns web css""" """returns web css"""

View File

@ -205,5 +205,10 @@ class DocType:
clear_cache(self.doc.page_name) clear_cache(self.doc.page_name)
def prepare_template_args(self): 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.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)

View File

@ -4,7 +4,7 @@
"docstatus": 0, "docstatus": 0,
"creation": "2012-12-17 14:56:32", "creation": "2012-12-17 14:56:32",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-12-25 13:52:47" "modified": "2012-12-27 10:36:56"
}, },
{ {
"allow_attach": 1, "allow_attach": 1,
@ -781,6 +781,17 @@
"permlevel": 0 "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", "depends_on": "show_in_website",
"doctype": "DocField", "doctype": "DocField",
"label": "Image", "label": "Image",

View File

@ -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.customer.get_query = erpnext.utils.customer_query;
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_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();
} }

View File

@ -2,23 +2,17 @@
{ {
"owner": "Administrator", "owner": "Administrator",
"docstatus": 0, "docstatus": 0,
"creation": "2012-07-02 19:57:47", "creation": "2012-07-03 13:30:41",
"modified_by": "Administrator", "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", "search_fields": "customer, supplier, sales_partner, country, state",
"module": "Utilities", "module": "Utilities",
"_last_update": "1319016431",
"allow_trash": 1,
"in_dialog": 1,
"document_type": "Master",
"name": "__common__",
"colour": "White:FFF",
"doctype": "DocType", "doctype": "DocType",
"show_in_menu": 0, "in_dialog": 0,
"version": 1 "document_type": "Master"
}, },
{ {
"name": "__common__", "name": "__common__",
@ -39,6 +33,187 @@
"name": "Address", "name": "Address",
"doctype": "DocType" "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, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
@ -128,192 +303,5 @@
"role": "All", "role": "All",
"cancel": 0, "cancel": 0,
"permlevel": 1 "permlevel": 1
},
{
"colour": "White:FFF",
"doctype": "DocField",
"label": "Address Details",
"fieldname": "address_details",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"description": "<em>e.g. Office, Billing, Shipping</em>",
"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
} }
] ]

View File

@ -42,9 +42,5 @@ class DocType():
def prepare_template_args(self): def prepare_template_args(self):
if self.doc.slideshow: if self.doc.slideshow:
slideshow = webnotes.model_wrapper("Website Slideshow", self.doc.slideshow) from website.helpers.slideshow import get_slideshow
self.slides = slideshow.doclist.get({"doctype":"Website Slideshow Item"}) get_slideshow(self)
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

View File

@ -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

View File

@ -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"
}
]

View File

@ -4,7 +4,7 @@
"docstatus": 0, "docstatus": 0,
"creation": "2012-07-12 23:29:36", "creation": "2012-07-12 23:29:36",
"modified_by": "Administrator", "modified_by": "Administrator",
"modified": "2012-12-25 15:41:48" "modified": "2012-12-27 12:27:02"
}, },
{ {
"issingle": 1, "issingle": 1,
@ -80,6 +80,15 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "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 &lt;img /&gt; tag. Keep size as 200px x 30px", "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 &lt;img /&gt; tag. Keep size as 200px x 30px",
"doctype": "DocField", "doctype": "DocField",
@ -171,22 +180,6 @@
"hidden": 1, "hidden": 1,
"permlevel": 0 "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, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",

View File

@ -2,7 +2,10 @@
# License: GNU General Public License (v3). For more information see license.txt # License: GNU General Public License (v3). For more information see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cstr
from website.utils import build_html, url_for_website, delete_page_cache
@webnotes.whitelist(allow_guest=True) @webnotes.whitelist(allow_guest=True)
@ -26,8 +29,6 @@ def get_product_info(item_code):
@webnotes.whitelist(allow_guest=True) @webnotes.whitelist(allow_guest=True)
def get_product_list(search=None, product_group=None, start=0, limit=10): def get_product_list(search=None, product_group=None, start=0, limit=10):
from webnotes.utils import cstr
# base query # base query
query = """select name, item_name, page_name, website_image, item_group, query = """select name, item_name, page_name, website_image, item_group,
web_long_description as website_description 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] where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
def get_item_for_list_in_html(r): def get_item_for_list_in_html(r):
from website.utils import build_html
scrub_item_for_list(r) scrub_item_for_list(r)
r.template = "html/product_in_list.html" r.template = "html/product_in_list.html"
return build_html(r) return build_html(r)
@ -91,8 +91,7 @@ def scrub_item_for_list(r):
r.website_description = "No description given" r.website_description = "No description given"
if len(r.website_description.split(" ")) > 24: if len(r.website_description.split(" ")) > 24:
r.website_description = " ".join(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 = url_for_website(r.website_image)
r.website_image = "files/" + r.website_image
def get_parent_item_groups(item_group_name): def get_parent_item_groups(item_group_name):
item_group = webnotes.doc("Item Group", 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) order by lft asc""", (item_group.lft, item_group.rgt), as_dict=True)
def invalidate_cache_for(item_group): def invalidate_cache_for(item_group):
from website.utils import delete_page_cache
for i in get_parent_item_groups(item_group): for i in get_parent_item_groups(item_group):
delete_page_cache(i.page_name) delete_page_cache(i.page_name)

View File

@ -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 <http://www.gnu.org/licenses/>.
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

View File

@ -29,18 +29,15 @@
<div class="layout-side-section"> <div class="layout-side-section">
<div class="psidebar"> <div class="psidebar">
<div class="section"> <div class="section">
<p><b>Create website with static pages and blogs</b></p> <div class="section-head">Advanced</div>
<ul> <div class="section-body">
<li>"Website Settings" - to setup header and footers. <div class="section-item">
<li>"Web Page" - for static web page. <a class="section-link"
<li>"Blog" - for blog entry. title = "Javascript to append to the head section of the page."
</ul> href="#Form/Website Script">Website Script</a>
<p><b>Notes: </b></p> </div>
<ul> </div>
<li>All pages are accessible via `#` + page name appended to your url. </div>
<li>Product catalogue is updated from Item Master (set Show in Website = 'Yes', in
Sales Settings).
</ul> </div>
</div> </div>
</div> </div>
<div style="clear: both;"></div> <div style="clear: both;"></div>

View File

@ -9,7 +9,7 @@
</header> </header>
<div id="body_div"> <div id="body_div">
<div class="navbar-wrapper"> <div class="navbar-wrapper">
<div class="navbar navbar-inverse" <div class="navbar{% if top_bar_background=="Black" %} navbar-inverse{% endif %}"
style="margin-bottom: 0px;"> style="margin-bottom: 0px;">
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
@ -61,7 +61,6 @@
</div> </div>
</div> </div>
<script>$('.dropdown-toggle').dropdown()</script> <script>$('.dropdown-toggle').dropdown()</script>
<div class="content" id="page-{{ name }}" style="display: block;"> <div class="content" id="page-{{ name }}" style="display: block;">
{% block content %} {% block content %}
{% endblock %} {% endblock %}

View File

@ -9,7 +9,10 @@
<div class="layout-main" style="padding: 30px;"> <div class="layout-main" style="padding: 30px;">
{% include 'html/product_search_box.html' %} {% include 'html/product_search_box.html' %}
{% include 'html/product_breadcrumbs.html' %} {% include 'html/product_breadcrumbs.html' %}
{% if description %} {% if slideshow %}<!-- slideshow -->
{% include "html/slideshow.html" %}
{% endif %}
{% if description %}<!-- description -->
<div>{{ description or ""}}</div> <div>{{ description or ""}}</div>
{% else %} {% else %}
<h3>{{ name }}</h3> <h3>{{ name }}</h3>

View File

@ -22,19 +22,25 @@
<div class="layout-main" style="padding: 30px;"> <div class="layout-main" style="padding: 30px;">
{% include 'html/product_search_box.html' %} {% include 'html/product_search_box.html' %}
{% include 'html/product_breadcrumbs.html' %} {% include 'html/product_breadcrumbs.html' %}
<h3>{{ item_name }}</h3> <h3 itemprop="name">{{ item_name }}</h3>
<p class="help">Item Code: {{ name }}</p> <p class="help">Item Code: {{ name }}</p>
<div class="product-page-content"> <div class="product-page-content"
itemscope itemtype="http://schema.org/Product">
{% if slideshow %}
{% include "html/slideshow.html" %}
{% else %}
<div class="span6"> <div class="span6">
{% if website_image %} {% if website_image %}
<image class="item-main-image" src="{% if website_image.lower().startswith('http') %}{{ website_image}}{% else %}files/{{ website_image }}{% endif %}" /> <image itemprop="image" class="item-main-image"
src="{{ website_image }}" />
{% else %} {% else %}
<div class="img-area"> <div class="img-area">
{% include 'html/product_missing_image.html' %} {% include 'html/product_missing_image.html' %}
</div> </div>
{% endif %} {% endif %}
<br><br>
</div> </div>
{% endif %}
<br><br>
<div class="span3"> <div class="span3">
<div class="item-price hide"> <div class="item-price hide">
<p>Price:</p> <p>Price:</p>
@ -44,7 +50,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="span9"> <div class="span9">
<h3>Product Description</h3> <h3>Product Description</h3>
<div> <div itemprop="description">
{{ web_long_description or web_short_description or {{ web_long_description or web_short_description or
"[No description given]" }} "[No description given]" }}
</div> </div>

View File

@ -0,0 +1,21 @@
{% if slideshow %}
{{ slideshow_header }}
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
{% for slide in obj.slides %}
<div class="{% if slide.idx==1 %}active {% endif %}item">
<img src="{{ slide.image }}" />
<div class="carousel-caption">
<h4>{{ slide.heading }}</h4>
<p>{{ slide.description }}</p>
</div>
</div>
{% endfor %}
</div>
<a class="carousel-control left" href="#myCarousel"
data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#myCarousel"
data-slide="next">&rsaquo;</a>
</div>
<script>$(".carousel").carousel();</script>
{% endif %}

View File

@ -10,27 +10,7 @@
<div class="layout-wrapper layout-wrapper-background"> <div class="layout-wrapper layout-wrapper-background">
<div class="web-content" style="text-align: {{ text_align }};"> <div class="web-content" style="text-align: {{ text_align }};">
<div class="layout-main"> <div class="layout-main">
{% if slideshow %} {% include "html/slideshow.html" %}
{{ slideshow_header }}
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
{% for slide in obj.slides %}
<div class="{% if slide.idx==1 %}active {% endif %}item">
<img src="{{ slide.image }}" />
<div class="carousel-caption">
<h4>{{ slide.heading }}</h4>
<p>{{ slide.description }}</p>
</div>
</div>
{% endfor %}
</div>
<a class="carousel-control left" href="#myCarousel"
data-slide="prev">&lsaquo;</a>
<a class="carousel-control right" href="#myCarousel"
data-slide="next">&rsaquo;</a>
</div>
<script>$(".carousel").carousel();</script>
{% endif %}
{{ main_section }} {{ main_section }}
</div> </div>
</div> </div>

View File

@ -226,12 +226,14 @@ def get_outer_env():
}) })
settings = webnotes.doc("Website Settings", "Website Settings") settings = webnotes.doc("Website Settings", "Website Settings")
for k in ["brand_html", "copyright", "address"]: for k in ["brand_html", "copyright", "address", "top_bar_background"]:
if k in settings.fields: if k in settings.fields:
ret[k] = settings.fields[k] ret[k] = settings.fields[k]
if not ret.brand_html: if not ret.brand_html:
ret.brand_html = "ERPNext" ret.brand_html = "ERPNext"
if not ret.top_bar_background:
ret.top_bar_background = "Black"
return ret return ret
def get_home_page(): def get_home_page():
@ -251,3 +253,9 @@ def clear_cache(page_name=None):
def delete_page_cache(page_name): def delete_page_cache(page_name):
webnotes.cache().delete_value("page:" + page_name) webnotes.cache().delete_value("page:" + page_name)
def url_for_website(url):
if url and not url.lower().startswith("http"):
return "files/" + url
else:
return url