Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
eb92514a3c
@ -482,6 +482,9 @@ class DocType(TransactionBase):
|
||||
|
||||
|
||||
def on_submit(self):
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
purchase_controller.is_item_table_empty(self)
|
||||
|
||||
self.check_prev_docstatus()
|
||||
|
||||
# Check for Approving Authority
|
||||
@ -492,8 +495,7 @@ class DocType(TransactionBase):
|
||||
self.make_gl_entries()
|
||||
|
||||
self.update_against_document_in_jv()
|
||||
|
||||
get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1)
|
||||
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||
|
||||
|
||||
def make_gl_entries(self, is_cancel = 0):
|
||||
|
@ -280,21 +280,8 @@ cur_frm.cscript.import_ref_rate = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.calc_amount(doc, 5);
|
||||
}
|
||||
|
||||
//==================== check if item table is blank ==============================================
|
||||
var is_item_table = function(doc,cdt,cdn) {
|
||||
// Step 1 :=>Get all childrens/ rows from Detail Table
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
// Step 2 :=> If there are no rows then set validated = false, this will stop further execution of code.
|
||||
if (cl.length == 0) {
|
||||
alert("There is no item in table"); validated = false;
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Validate ====================================================================
|
||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||
// Step 1:=> check if item table is blank
|
||||
is_item_table(doc,cdt,cdn);
|
||||
// Step 2:=> Calculate Amount
|
||||
cur_frm.cscript.calc_amount(doc, 1);
|
||||
|
||||
// calculate advances if pv
|
||||
|
@ -22,14 +22,14 @@ from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import form, msgprint
|
||||
from webnotes import form, msgprint, _
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
def __init__(self, doc, doclist=None):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
@ -64,6 +64,11 @@ class DocType(TransactionBase):
|
||||
|
||||
self.msg = []
|
||||
|
||||
def is_item_table_empty(self, obj):
|
||||
if not len(obj.doclist.get({"parentfield": obj.fname})):
|
||||
msgprint(_("Hey there! You need to put at least one item in \
|
||||
the item table."), raise_exception=True)
|
||||
|
||||
|
||||
def get_default_schedule_date( self, obj):
|
||||
for d in getlist( obj.doclist, obj.fname):
|
||||
|
@ -220,10 +220,11 @@ class DocType(TransactionBase):
|
||||
|
||||
# On Submit
|
||||
def on_submit(self):
|
||||
pc_obj = get_obj(dt ='Purchase Common')
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
purchase_controller.is_item_table_empty(self)
|
||||
|
||||
# Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||
pc_obj.update_prevdoc_detail(self, is_submit = 1)
|
||||
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||
|
||||
# Step 2 :=> Update Bin
|
||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||
@ -236,7 +237,7 @@ class DocType(TransactionBase):
|
||||
"last_purchase_order", self.doc.name)
|
||||
|
||||
# Step 5 :=> Update last purchase rate
|
||||
pc_obj.update_last_purchase_rate(self, is_submit = 1)
|
||||
purchase_controller.update_last_purchase_rate(self, is_submit = 1)
|
||||
|
||||
# Step 6 :=> Set Status
|
||||
webnotes.conn.set(self.doc,'status','Submitted')
|
||||
|
@ -50,22 +50,19 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
erpnext.hide_naming_series();
|
||||
|
||||
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
||||
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
||||
if(flt(doc.per_ordered, 2) < 100) {
|
||||
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']);
|
||||
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']);
|
||||
}
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
||||
|
||||
}
|
||||
|
||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request'])
|
||||
}
|
||||
|
||||
//======================= validation ===================================
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
is_item_table(doc,cdt,cdn);
|
||||
}
|
||||
//======================= transaction date =============================
|
||||
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
||||
if(doc.__islocal){
|
||||
|
@ -178,6 +178,9 @@ class DocType:
|
||||
get_obj('Warehouse', d.warehouse).update_bin(args)
|
||||
|
||||
def on_submit(self):
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
purchase_controller.is_item_table_empty(self)
|
||||
|
||||
webnotes.conn.set(self.doc,'status','Submitted')
|
||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||
|
||||
|
@ -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,19 @@ 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;
|
||||
|
||||
if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
|
||||
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 +97,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);
|
||||
}
|
@ -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": "<em>Addresses will appear only when you save the supplier</em>",
|
||||
@ -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": "<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",
|
||||
"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,
|
||||
|
@ -36,6 +36,9 @@ class DocType(TransactionBase):
|
||||
self.doc.status = "Draft"
|
||||
|
||||
def on_submit(self):
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
purchase_controller.is_item_table_empty(self)
|
||||
|
||||
webnotes.conn.set(self.doc, "status", "Submitted")
|
||||
|
||||
def on_cancel(self):
|
||||
|
@ -21,6 +21,7 @@ from webnotes import msgprint
|
||||
feed_dict = {
|
||||
# Project
|
||||
'Project': ['[%(status)s]', '#000080'],
|
||||
'Task': ['[%(status)s] %(subject)s', '#000080'],
|
||||
|
||||
# Sales
|
||||
'Lead': ['%(lead_name)s', '#000080'],
|
||||
@ -81,8 +82,9 @@ def make_feed(feedtype, doctype, name, owner, subject, color):
|
||||
f.full_name = get_fullname(owner)
|
||||
f.save()
|
||||
|
||||
def update_feed(doc, method=None):
|
||||
def update_feed(controller, method=None):
|
||||
"adds a new feed"
|
||||
doc = controller.doc
|
||||
if method in ['on_update', 'on_submit']:
|
||||
subject, color = feed_dict.get(doc.doctype, [None, None])
|
||||
if subject:
|
||||
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-11-30 11:49:12",
|
||||
"creation": "2012-12-03 10:13:46",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-11-30 11:54:31"
|
||||
"modified": "2012-12-27 14:45:31"
|
||||
},
|
||||
{
|
||||
"autoname": "naming_series:",
|
||||
@ -51,10 +51,17 @@
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Image View",
|
||||
"options": "image",
|
||||
"fieldname": "image_view",
|
||||
"fieldtype": "Image",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Employee",
|
||||
"fieldname": "employee",
|
||||
@ -67,32 +74,28 @@
|
||||
"description": "<span class=\"sys_manager\">To setup, please go to Setup > Naming Series</span>",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Naming Series",
|
||||
"oldfieldname": "naming_series",
|
||||
"permlevel": 0,
|
||||
"options": "EMP/",
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"reqd": 0,
|
||||
"options": "EMP/"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Salutation",
|
||||
"oldfieldname": "salutation",
|
||||
"trigger": "Client",
|
||||
"options": "\nMr\nMs",
|
||||
"fieldname": "salutation",
|
||||
"fieldtype": "Select",
|
||||
"search_index": 0,
|
||||
"options": "\nMr\nMs",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Full Name",
|
||||
"oldfieldname": "employee_name",
|
||||
@ -101,6 +104,30 @@
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Image",
|
||||
"options": "attach_files:",
|
||||
"fieldname": "image",
|
||||
"fieldtype": "Select",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "System User (login) ID. If set, it will become default for all HR forms.",
|
||||
"doctype": "DocField",
|
||||
"label": "User ID",
|
||||
"options": "Profile",
|
||||
"fieldname": "user_id",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
@ -112,26 +139,8 @@
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"description": "System User (login) ID. If set, it will become default for all HR forms.",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "User ID",
|
||||
"options": "Profile",
|
||||
"fieldname": "user_id",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"width": "50%",
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Date of Joining",
|
||||
"oldfieldname": "date_of_joining",
|
||||
@ -142,11 +151,9 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Date of Birth",
|
||||
"oldfieldname": "date_of_birth",
|
||||
"trigger": "Client",
|
||||
"fieldname": "date_of_birth",
|
||||
"fieldtype": "Date",
|
||||
"search_index": 0,
|
||||
@ -194,7 +201,6 @@
|
||||
{
|
||||
"default": "Active",
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Status",
|
||||
"oldfieldname": "status",
|
||||
@ -221,7 +227,6 @@
|
||||
{
|
||||
"description": "Applicable Holiday List",
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Holiday List",
|
||||
"oldfieldname": "holiday_list",
|
||||
@ -249,7 +254,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Final Confirmation Date",
|
||||
"oldfieldname": "final_confirmation_date",
|
||||
@ -294,7 +298,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Branch",
|
||||
"oldfieldname": "branch",
|
||||
@ -307,7 +310,6 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Department",
|
||||
"oldfieldname": "department",
|
||||
@ -320,21 +322,19 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Designation",
|
||||
"oldfieldname": "designation",
|
||||
"permlevel": 0,
|
||||
"options": "Designation",
|
||||
"fieldname": "designation",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 1,
|
||||
"reqd": 0,
|
||||
"options": "Designation",
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Grade",
|
||||
"oldfieldname": "grade",
|
||||
@ -378,33 +378,29 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Select",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Salary Mode",
|
||||
"oldfieldname": "salary_mode",
|
||||
"trigger": "Client",
|
||||
"options": "\nBank\nCash\nCheque",
|
||||
"fieldname": "salary_mode",
|
||||
"fieldtype": "Select",
|
||||
"options": "\nBank\nCash\nCheque",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Bank Name",
|
||||
"oldfieldname": "bank_name",
|
||||
"permlevel": 0,
|
||||
"options": "Suggest",
|
||||
"fieldname": "bank_name",
|
||||
"fieldtype": "Data",
|
||||
"depends_on": "eval:doc.salary_mode == 'Bank'",
|
||||
"hidden": 0,
|
||||
"options": "Suggest",
|
||||
"permlevel": 0,
|
||||
"in_filter": 1
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Bank A/C No.",
|
||||
"oldfieldname": "bank_ac_no",
|
||||
@ -544,6 +540,21 @@
|
||||
"fieldtype": "Small Text",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Bio",
|
||||
"fieldname": "sb53",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"description": "Short biography for website and other publications.",
|
||||
"doctype": "DocField",
|
||||
"label": "Bio",
|
||||
"fieldname": "bio",
|
||||
"fieldtype": "Text Editor",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Personal Details",
|
||||
@ -588,10 +599,8 @@
|
||||
},
|
||||
{
|
||||
"oldfieldtype": "Button",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Salary Structure",
|
||||
"trigger": "Client",
|
||||
"fieldname": "salary_structure",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 1,
|
||||
@ -629,7 +638,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Here you can maintain family details like name and occupation of parent, spouse and children",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Family Background",
|
||||
"fieldname": "family_background",
|
||||
@ -638,7 +646,6 @@
|
||||
},
|
||||
{
|
||||
"description": "Here you can maintain height, weight, allergies, medical concerns etc",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Health Details",
|
||||
"fieldname": "health_details",
|
||||
|
13
patches/december_2012/address_title.py
Normal file
13
patches/december_2012/address_title.py
Normal file
@ -0,0 +1,13 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("utilities", "doctype", "address")
|
||||
|
||||
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"))
|
@ -558,6 +558,10 @@ patch_list = [
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'rebuild_item_group_tree',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'address_title',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'delete_form16_print_format',
|
||||
|
@ -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,19 @@ 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;
|
||||
|
||||
if(!(cur_frm.address_list.data && cur_frm.address_list.data.length)) {
|
||||
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"
|
||||
},
|
||||
@ -118,84 +119,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.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);
|
||||
}
|
@ -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": "<a href=\"#!Sales Browser/Customer Group\">To manage Customer Groups, click here</a>",
|
||||
"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": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>",
|
||||
"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": "<em>Addresses will appear only when you save the customer</em>",
|
||||
@ -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": "<em>Contact Details will appear only when you save the customer</em>",
|
||||
@ -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,
|
||||
|
@ -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
|
||||
// -----------------------------
|
||||
cur_frm.cscript.get_states=function(doc,dt,dn){
|
||||
|
@ -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)
|
||||
|
||||
|
||||
if self.doc.slideshow:
|
||||
from website.helpers.slideshow import get_slideshow
|
||||
get_slideshow(self)
|
@ -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",
|
||||
|
@ -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'
|
||||
}
|
||||
|
||||
}
|
@ -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": "<em>Addresses will appear only when you save the customer</em>",
|
||||
"fieldname": "address_desc",
|
||||
"fieldtype": "HTML",
|
||||
"options": "<em>Addresses will appear only when you save the customer</em>"
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -210,13 +126,12 @@
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.__islocal",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Contact Desc",
|
||||
"permlevel": 0,
|
||||
"options": "<em>Contact Details will appear only when you save the customer</em>",
|
||||
"fieldname": "contact_desc",
|
||||
"fieldtype": "HTML",
|
||||
"options": "<em>Contact Details will appear only when you save the customer</em>"
|
||||
"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
|
||||
}
|
||||
]
|
@ -46,10 +46,6 @@ def comment_added(doc):
|
||||
"""add comment to feed"""
|
||||
home.make_feed('Comment', doc.comment_doctype, doc.comment_docname, doc.comment_by,
|
||||
'<i>"' + doc.comment + '"</i>', '#6B24B3')
|
||||
|
||||
def doclist_all(doc, method):
|
||||
"""doclist trigger called from webnotes.model.wrapper on any event"""
|
||||
home.update_feed(doc, method)
|
||||
|
||||
def boot_session(bootinfo):
|
||||
"""boot session - send website info if guest"""
|
||||
@ -131,7 +127,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"""
|
||||
|
20
startup/observers.py
Normal file
20
startup/observers.py
Normal file
@ -0,0 +1,20 @@
|
||||
# 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/>.
|
||||
|
||||
observer_map = {
|
||||
"*:on_update": "home.update_feed",
|
||||
"*:on_submit": "home.update_feed",
|
||||
}
|
@ -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)
|
@ -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",
|
||||
|
@ -284,15 +284,17 @@ class DocType(TransactionBase):
|
||||
|
||||
# on submit
|
||||
def on_submit(self):
|
||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||
purchase_controller.is_item_table_empty(self)
|
||||
|
||||
# Check for Approving Authority
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
|
||||
|
||||
# Set status as Submitted
|
||||
webnotes.conn.set(self.doc,'status', 'Submitted')
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
|
||||
# Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||
pc_obj.update_prevdoc_detail(self, is_submit = 1)
|
||||
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||
|
||||
# Update Serial Record
|
||||
get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1)
|
||||
@ -301,7 +303,7 @@ class DocType(TransactionBase):
|
||||
self.update_stock(is_submit = 1)
|
||||
|
||||
# Update last purchase rate
|
||||
pc_obj.update_last_purchase_rate(self, 1)
|
||||
purchase_controller.update_last_purchase_rate(self, 1)
|
||||
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
@ -31,7 +31,8 @@ class DocType:
|
||||
self.doc.name = self.doc.supplier + '-' + self.doc.address_type
|
||||
elif self.doc.sales_partner:
|
||||
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
|
||||
|
||||
elif self.doc.address_title:
|
||||
self.doc.address_title = self.doc.address_title + "-" + self.doc.address_type
|
||||
|
||||
def validate(self):
|
||||
self.validate_for_whom()
|
||||
|
@ -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": "<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
|
||||
}
|
||||
]
|
@ -65,14 +65,6 @@ p, li {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.website-missing-image {
|
||||
background-color: #eee;
|
||||
padding: 40px;
|
||||
width: 32px;
|
||||
font-size: 32px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
0
website/doctype/about_us_settings/__init__.py
Normal file
0
website/doctype/about_us_settings/__init__.py
Normal file
18
website/doctype/about_us_settings/about_us_settings.py
Normal file
18
website/doctype/about_us_settings/about_us_settings.py
Normal file
@ -0,0 +1,18 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from website.utils import url_for_website
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def onload(self):
|
||||
"""load employee"""
|
||||
emp_list = []
|
||||
for d in self.doclist.get({"doctype":"About Us Team Member"}):
|
||||
emp = webnotes.doc("Employee", d.employee)
|
||||
emp.image = url_for_website(emp.image)
|
||||
emp_list.append(emp)
|
||||
self.doclist += emp_list
|
98
website/doctype/about_us_settings/about_us_settings.txt
Normal file
98
website/doctype/about_us_settings/about_us_settings.txt
Normal file
@ -0,0 +1,98 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:24:35",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 15:51:11"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
"description": "Settings for the About Us Page",
|
||||
"doctype": "DocType",
|
||||
"module": "Website",
|
||||
"document_type": "Master",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "About Us Settings",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"parent": "About Us Settings",
|
||||
"read": 1,
|
||||
"name": "__common__",
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"role": "Website Manager",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "About Us Settings",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"description": "Introduce your company to the website visitor.",
|
||||
"doctype": "DocField",
|
||||
"label": "Company Introduction",
|
||||
"fieldname": "company_introduction",
|
||||
"fieldtype": "Text Editor"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company History",
|
||||
"fieldname": "sb0",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "\"Company History\"",
|
||||
"doctype": "DocField",
|
||||
"label": "Company History Heading",
|
||||
"fieldname": "company_history_heading",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Company History",
|
||||
"fieldname": "company_history",
|
||||
"fieldtype": "Table",
|
||||
"options": "Company History"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members",
|
||||
"fieldname": "sb1",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "\"Team Members\" or \"Management\"",
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members Heading",
|
||||
"fieldname": "team_members_heading",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Team Members",
|
||||
"fieldname": "team_members",
|
||||
"fieldtype": "Table",
|
||||
"options": "About Us Team Member"
|
||||
},
|
||||
{
|
||||
"description": "More content for the bottom of the page.",
|
||||
"doctype": "DocField",
|
||||
"label": "Footer",
|
||||
"fieldname": "footer",
|
||||
"fieldtype": "Text Editor"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
0
website/doctype/about_us_team_member/__init__.py
Normal file
0
website/doctype/about_us_team_member/__init__.py
Normal 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
|
@ -0,0 +1,35 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:28:45",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 14:49:44"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"name": "__common__",
|
||||
"doctype": "DocType",
|
||||
"module": "Website"
|
||||
},
|
||||
{
|
||||
"parent": "About Us Team Member",
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"label": "Employee",
|
||||
"width": "300px",
|
||||
"parenttype": "DocType",
|
||||
"options": "Employee",
|
||||
"fieldname": "employee",
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "About Us Team Member",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField"
|
||||
}
|
||||
]
|
0
website/doctype/company_history/__init__.py
Normal file
0
website/doctype/company_history/__init__.py
Normal file
8
website/doctype/company_history/company_history.py
Normal file
8
website/doctype/company_history/company_history.py
Normal 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
|
40
website/doctype/company_history/company_history.txt
Normal file
40
website/doctype/company_history/company_history.txt
Normal file
@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:25:38",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 14:25:38"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
"name": "__common__",
|
||||
"doctype": "DocType",
|
||||
"module": "Website"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Company History",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"name": "Company History",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Year",
|
||||
"fieldname": "year",
|
||||
"fieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Highlight",
|
||||
"width": "300px",
|
||||
"fieldname": "highlight",
|
||||
"fieldtype": "Text"
|
||||
}
|
||||
]
|
@ -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)
|
||||
|
0
website/doctype/website_script/__init__.py
Normal file
0
website/doctype/website_script/__init__.py
Normal file
8
website/doctype/website_script/website_script.py
Normal file
8
website/doctype/website_script/website_script.py
Normal 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
|
51
website/doctype/website_script/website_script.txt
Normal file
51
website/doctype/website_script/website_script.txt
Normal 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"
|
||||
}
|
||||
]
|
@ -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",
|
||||
|
@ -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)
|
26
website/helpers/slideshow.py
Normal file
26
website/helpers/slideshow.py
Normal 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
|
||||
|
@ -20,27 +20,24 @@
|
||||
<br>
|
||||
<h5><a href="#Form/Product Settings">Product Settings</a></h5>
|
||||
<p class="help">Settings for Product Catalog on the website.</p>
|
||||
<br>
|
||||
<h5><a href="#Form/About Us Settings">About Us Settings</a></h5>
|
||||
<p class="help">Settings for About Us Page.</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<hr>
|
||||
<h3>Reports</h3>
|
||||
<div class="reports-list"></div>
|
||||
</div>
|
||||
<div class="layout-side-section">
|
||||
<div class="psidebar">
|
||||
<div class="section">
|
||||
<p><b>Create website with static pages and blogs</b></p>
|
||||
<ul>
|
||||
<li>"Website Settings" - to setup header and footers.
|
||||
<li>"Web Page" - for static web page.
|
||||
<li>"Blog" - for blog entry.
|
||||
</ul>
|
||||
<p><b>Notes: </b></p>
|
||||
<ul>
|
||||
<li>All pages are accessible via `#` + page name appended to your url.
|
||||
<li>Product catalogue is updated from Item Master (set Show in Website = 'Yes', in
|
||||
Sales Settings).
|
||||
</ul> </div>
|
||||
<div class="section-head">Advanced</div>
|
||||
<div class="section-body">
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Javascript to append to the head section of the page."
|
||||
href="#Form/Website Script">Website Script</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
|
@ -9,7 +9,7 @@
|
||||
</header>
|
||||
<div id="body_div">
|
||||
<div class="navbar-wrapper">
|
||||
<div class="navbar navbar-inverse"
|
||||
<div class="navbar{% if top_bar_background=="Black" %} navbar-inverse{% endif %}"
|
||||
style="margin-bottom: 0px;">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
@ -61,7 +61,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>$('.dropdown-toggle').dropdown()</script>
|
||||
|
||||
<div class="content" id="page-{{ name }}" style="display: block;">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
@ -9,7 +9,10 @@
|
||||
<div class="layout-main" style="padding: 30px;">
|
||||
{% include 'html/product_search_box.html' %}
|
||||
{% include 'html/product_breadcrumbs.html' %}
|
||||
{% if description %}
|
||||
{% if slideshow %}<!-- slideshow -->
|
||||
{% include "html/slideshow.html" %}
|
||||
{% endif %}
|
||||
{% if description %}<!-- description -->
|
||||
<div>{{ description or ""}}</div>
|
||||
{% else %}
|
||||
<h3>{{ name }}</h3>
|
||||
@ -18,7 +21,7 @@
|
||||
<div class="well well-small">
|
||||
<div class="container-fluid" style="padding-left: 0px; margin-left:-10px; line-height: 2em;">
|
||||
{% for d in sub_groups %}
|
||||
<div class="span2">
|
||||
<div class="span4">
|
||||
<a href="{{ d.page_name }}">{{ d.name }} ({{ d.count }})</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -1 +1 @@
|
||||
<div class='website-missing-image'><i class='icon-camera'></i></div>
|
||||
<div class='missing-image'><i class='icon-camera'></i></div>
|
@ -22,19 +22,25 @@
|
||||
<div class="layout-main" style="padding: 30px;">
|
||||
{% include 'html/product_search_box.html' %}
|
||||
{% include 'html/product_breadcrumbs.html' %}
|
||||
<h3>{{ item_name }}</h3>
|
||||
<h3 itemprop="name">{{ item_name }}</h3>
|
||||
<p class="help">Item Code: {{ name }}</p>
|
||||
<div class="product-page-content">
|
||||
<div class="span6">
|
||||
{% if website_image %}
|
||||
<image class="item-main-image" src="{% if website_image.lower().startswith('http') %}{{ website_image}}{% else %}files/{{ website_image }}{% endif %}" />
|
||||
<div class="product-page-content"
|
||||
itemscope itemtype="http://schema.org/Product">
|
||||
{% if slideshow %}
|
||||
{% include "html/slideshow.html" %}
|
||||
{% else %}
|
||||
<div class="img-area">
|
||||
{% include 'html/product_missing_image.html' %}
|
||||
<div class="span6">
|
||||
{% if website_image %}
|
||||
<image itemprop="image" class="item-main-image"
|
||||
src="{{ website_image }}" />
|
||||
{% else %}
|
||||
<div class="img-area">
|
||||
{% include 'html/product_missing_image.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<br><br>
|
||||
</div>
|
||||
<div class="span3">
|
||||
<div class="item-price hide">
|
||||
<p>Price:</p>
|
||||
@ -44,7 +50,7 @@
|
||||
<div class="clearfix"></div>
|
||||
<div class="span9">
|
||||
<h3>Product Description</h3>
|
||||
<div>
|
||||
<div itemprop="description">
|
||||
{{ web_long_description or web_short_description or
|
||||
"[No description given]" }}
|
||||
</div>
|
||||
|
21
website/templates/html/slideshow.html
Normal file
21
website/templates/html/slideshow.html
Normal 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">‹</a>
|
||||
<a class="carousel-control right" href="#myCarousel"
|
||||
data-slide="next">›</a>
|
||||
</div>
|
||||
<script>$(".carousel").carousel();</script>
|
||||
{% endif %}
|
@ -10,27 +10,7 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="web-content" style="text-align: {{ text_align }};">
|
||||
<div class="layout-main">
|
||||
{% 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">‹</a>
|
||||
<a class="carousel-control right" href="#myCarousel"
|
||||
data-slide="next">›</a>
|
||||
</div>
|
||||
<script>$(".carousel").carousel();</script>
|
||||
{% endif %}
|
||||
{% include "html/slideshow.html" %}
|
||||
{{ main_section }}
|
||||
</div>
|
||||
</div>
|
||||
|
40
website/templates/pages/about.html
Normal file
40
website/templates/pages/about.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% extends "html/page.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="layout-wrapper">
|
||||
<div class="layout-main">
|
||||
{% if obj.doc.company_introduction %}
|
||||
{{ obj.doc.company_introduction }}
|
||||
{% endif %}
|
||||
{% if obj.doclist.get({"doctype":"Company History"}) %}
|
||||
<h3>{{ obj.doc.company_history_heading or "Company History" }}</h3>
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
{% for d in obj.doclist.get({"doctype":"Company History"}) %}
|
||||
<tr>
|
||||
<td style="width: 30%; text-align: right"><h4>{{ d.year }}</h4></td>
|
||||
<td>{{ d.highlight }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% if obj.doclist.get({"doctype":"Employee"}) %}
|
||||
<h3>{{ obj.doc.team_members_heading or "Team Members" }}</h3>
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
{% for d in obj.doclist.get({"doctype":"Employee"}) %}
|
||||
<tr>
|
||||
<td style="text-align:right; width: 30%;">
|
||||
<img src="{{ d.image }}" style=""></td>
|
||||
<td><h4>{{ d.employee_name }}</h4>
|
||||
{{ d.bio }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{{ obj.doc.footer or "" }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -40,6 +40,10 @@ page_map = {
|
||||
})
|
||||
}
|
||||
|
||||
page_settings_map = {
|
||||
"about": "About Us Settings"
|
||||
}
|
||||
|
||||
def render(page_name):
|
||||
"""render html page"""
|
||||
try:
|
||||
@ -98,6 +102,10 @@ def update_page_name(doc, title):
|
||||
"""set page_name and check if it is unique"""
|
||||
webnotes.conn.set(doc, "page_name", page_name(title))
|
||||
|
||||
standard_pages = get_template_pages()
|
||||
if doc.page_name in standard_pages:
|
||||
webnotes.conn.sql("""Page Name cannot be one of %s""" % ', '.join(standard_pages))
|
||||
|
||||
res = webnotes.conn.sql("""\
|
||||
select count(*) from `tab%s`
|
||||
where page_name=%s and name!=%s""" % (doc.doctype, '%s', '%s'),
|
||||
@ -135,10 +143,12 @@ def prepare_args(page_name):
|
||||
page_name = get_home_page()
|
||||
|
||||
if page_name in get_template_pages():
|
||||
args = {
|
||||
args = webnotes._dict({
|
||||
'template': 'pages/%s.html' % page_name,
|
||||
'name': page_name,
|
||||
}
|
||||
})
|
||||
if page_name in page_settings_map:
|
||||
args.obj = webnotes.model_wrapper(page_settings_map[page_name]).obj
|
||||
else:
|
||||
args = get_doc_fields(page_name)
|
||||
|
||||
@ -226,12 +236,14 @@ def get_outer_env():
|
||||
})
|
||||
|
||||
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:
|
||||
ret[k] = settings.fields[k]
|
||||
|
||||
if not ret.brand_html:
|
||||
ret.brand_html = "ERPNext"
|
||||
if not ret.top_bar_background:
|
||||
ret.top_bar_background = "Black"
|
||||
return ret
|
||||
|
||||
def get_home_page():
|
||||
@ -250,4 +262,10 @@ def clear_cache(page_name=None):
|
||||
webnotes.cache().delete_keys("page:")
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user