started website
This commit is contained in:
parent
1061b4a7ea
commit
865c00a79a
@ -15,7 +15,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.account_type(doc, cdt, cdn);
|
||||
// hide India specific fields
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
if(cp.country == 'India')
|
||||
unhide_field(['pan_number', 'tds_applicable', 'tds_details', 'TDS']);
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
if (!doc.voucher_date) doc.voucher_date = dateutil.obj_to_str(new Date());
|
||||
|
||||
|
@ -7,7 +7,7 @@ $import(Purchase Common)
|
||||
// On Load
|
||||
// --------
|
||||
cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
|
||||
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
||||
|
@ -71,7 +71,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
// India related fields
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
if (cp.country == 'India') unhide_field(['c_form_applicable', 'c_form_no']);
|
||||
else hide_field(['c_form_applicable', 'c_form_no']);
|
||||
|
||||
|
88
erpnext/home/page/event_updates/complete_registration.js
Normal file
88
erpnext/home/page/event_updates/complete_registration.js
Normal file
@ -0,0 +1,88 @@
|
||||
// complete my company registration
|
||||
// --------------------------------
|
||||
pscript.complete_registration = function(is_complete) {
|
||||
if(is_complete == 'No'){
|
||||
var d = new Dialog(400, 200, "Please Complete Your Registration");
|
||||
if(user != 'Administrator'){
|
||||
d.no_cancel(); // Hide close image
|
||||
$('header').toggle(false);
|
||||
}
|
||||
|
||||
d.make_body([
|
||||
['Data','Company Name','Example: Your Company LLC'],
|
||||
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
|
||||
['Select','Fiscal Year Start Date'],
|
||||
['Select','Default Currency'],
|
||||
['Button','Save'],
|
||||
]);
|
||||
|
||||
// if company name is set, set the input value
|
||||
// and disable it
|
||||
if(wn.control_panel.company_name) {
|
||||
d.widgets['Company Name'].value = wn.control_panel.company_name;
|
||||
d.widgets['Company Name'].disabled = 1;
|
||||
}
|
||||
|
||||
|
||||
//d.widgets['Save'].disabled = true; // disable Save button
|
||||
pscript.make_dialog_field(d);
|
||||
|
||||
// submit details
|
||||
d.widgets['Save'].onclick = function()
|
||||
{
|
||||
d.widgets['Save'].set_working();
|
||||
|
||||
flag = pscript.validate_fields(d);
|
||||
if(flag)
|
||||
{
|
||||
var args = [
|
||||
d.widgets['Company Name'].value,
|
||||
d.widgets['Company Abbreviation'].value,
|
||||
d.widgets['Fiscal Year Start Date'].value,
|
||||
d.widgets['Default Currency'].value
|
||||
];
|
||||
|
||||
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
d.hide();
|
||||
$('header').toggle(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
// make dialog fields
|
||||
// ------------------
|
||||
pscript.make_dialog_field = function(d)
|
||||
{
|
||||
// fiscal year format
|
||||
fisc_format = d.widgets['Fiscal Year Start Date'];
|
||||
add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
|
||||
|
||||
// default currency
|
||||
currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
|
||||
currency = d.widgets['Default Currency'];
|
||||
add_sel_options(currency, currency_list);
|
||||
}
|
||||
|
||||
|
||||
// validate fields
|
||||
// ---------------
|
||||
pscript.validate_fields = function(d)
|
||||
{
|
||||
var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
|
||||
var msg = 'Please enter the following fields';
|
||||
var flag = 1;
|
||||
for(var i=0; i<lst.length; i++)
|
||||
{
|
||||
if(!d.widgets[lst[i]].value){
|
||||
flag = 0;
|
||||
msg = msg + NEWLINE + lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag) alert(msg);
|
||||
return flag;
|
||||
}
|
@ -32,7 +32,7 @@ pscript.home_make_body = function() {
|
||||
|
||||
pscript.home_set_banner = function(wrapper) {
|
||||
var wrapper = page_body.pages['Event Updates'];
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
// banner
|
||||
if(cp.client_name) {
|
||||
@ -616,6 +616,7 @@ pscript.home_make_status = function() {
|
||||
|
||||
// complete registration
|
||||
if(in_list(user_roles,'System Manager')) {
|
||||
wn.require("erpnext/home/page/event_updates/complete_registration.js");
|
||||
pscript.complete_registration(r.message.registration_complete);
|
||||
}
|
||||
|
||||
@ -627,95 +628,6 @@ pscript.home_make_status = function() {
|
||||
);
|
||||
}
|
||||
|
||||
// complete my company registration
|
||||
// --------------------------------
|
||||
pscript.complete_registration = function(is_complete) {
|
||||
if(is_complete == 'No'){
|
||||
var d = new Dialog(400, 200, "Please Complete Your Registration");
|
||||
if(user != 'Administrator'){
|
||||
d.no_cancel(); // Hide close image
|
||||
$('header').toggle(false);
|
||||
}
|
||||
|
||||
d.make_body([
|
||||
['Data','Company Name','Example: Your Company LLC'],
|
||||
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
|
||||
['Select','Fiscal Year Start Date'],
|
||||
['Select','Default Currency'],
|
||||
['Button','Save'],
|
||||
]);
|
||||
|
||||
// if company name is set, set the input value
|
||||
// and disable it
|
||||
if(locals['Control Panel']['Control Panel'].company_name) {
|
||||
d.widgets['Company Name'].value = locals['Control Panel']['Control Panel'].company_name;
|
||||
d.widgets['Company Name'].disabled = 1;
|
||||
}
|
||||
|
||||
|
||||
//d.widgets['Save'].disabled = true; // disable Save button
|
||||
pscript.make_dialog_field(d);
|
||||
|
||||
// submit details
|
||||
d.widgets['Save'].onclick = function()
|
||||
{
|
||||
d.widgets['Save'].set_working();
|
||||
|
||||
flag = pscript.validate_fields(d);
|
||||
if(flag)
|
||||
{
|
||||
var args = [
|
||||
d.widgets['Company Name'].value,
|
||||
d.widgets['Company Abbreviation'].value,
|
||||
d.widgets['Fiscal Year Start Date'].value,
|
||||
d.widgets['Default Currency'].value
|
||||
];
|
||||
|
||||
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
|
||||
sys_defaults = r.message;
|
||||
d.hide();
|
||||
$('header').toggle(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
// make dialog fields
|
||||
// ------------------
|
||||
pscript.make_dialog_field = function(d)
|
||||
{
|
||||
// fiscal year format
|
||||
fisc_format = d.widgets['Fiscal Year Start Date'];
|
||||
add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
|
||||
|
||||
// default currency
|
||||
currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
|
||||
currency = d.widgets['Default Currency'];
|
||||
add_sel_options(currency, currency_list);
|
||||
}
|
||||
|
||||
|
||||
// validate fields
|
||||
// ---------------
|
||||
pscript.validate_fields = function(d)
|
||||
{
|
||||
var lst = ['Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
|
||||
var msg = 'Please enter the following fields';
|
||||
var flag = 1;
|
||||
for(var i=0; i<lst.length; i++)
|
||||
{
|
||||
if(!d.widgets[lst[i]].value){
|
||||
flag = 0;
|
||||
msg = msg + NEWLINE + lst[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag) alert(msg);
|
||||
return flag;
|
||||
}
|
||||
|
||||
SetupWizard = function(status) {
|
||||
var me = this;
|
||||
$.extend(this, {
|
||||
|
@ -462,7 +462,7 @@ MemberProfile = function(parent, uid, member_item) {
|
||||
// delete user
|
||||
// create a confirm dialog and call server method
|
||||
this.delete_user = function() {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
var cp = wn.control_panel;
|
||||
|
||||
var d = new Dialog(400,200,'Delete User');
|
||||
d.make_body([
|
||||
|
@ -1,19 +1,24 @@
|
||||
import webnotes
|
||||
from webnotes.model.doc import Document
|
||||
from webnotes.modules import reload_doc
|
||||
|
||||
def execute():
|
||||
from webnotes.modules import reload_doc
|
||||
add_default_home_page()
|
||||
cleanup()
|
||||
reload_doc('setup','doctype','manage_account')
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.sql("drop table tabDocTrigger")
|
||||
webnotes.conn.sql("drop table if exists tabDocTrigger")
|
||||
cleanup()
|
||||
|
||||
def cleanup():
|
||||
webnotes.conn.begin()
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc("DocType", "SSO Control")
|
||||
delete_doc("DocType", "WN ERP Cient Control")
|
||||
delete_doc("DocType", "WN ERP Client Control")
|
||||
delete_doc("DocType", "DocTrigger")
|
||||
delete_doc("DocType", "Control Panel")
|
||||
reload_doc("core", "doctype", "control_panel")
|
||||
webnotes.conn.sql("""delete from tabSingles
|
||||
where field like 'startup_%' and doctype='Control Panel'""")
|
||||
|
||||
def add_default_home_page():
|
||||
if not webnotes.conn.sql("""select name from `tabDefault Home Page`
|
||||
|
@ -58,7 +58,7 @@ GanttChart.prototype.make_date = function(label,idx) {
|
||||
var w = this.make_filter(label,idx);
|
||||
var i = $a(w, 'input');
|
||||
|
||||
var user_fmt = locals['Control Panel']['Control Panel'].date_format;
|
||||
var user_fmt = wn.control_panel.date_format;
|
||||
if(!this.user_fmt)this.user_fmt = 'dd-mm-yy';
|
||||
|
||||
$(i).datepicker({
|
||||
|
@ -22,8 +22,7 @@ cur_frm.cscript.notify = function(doc, args) {
|
||||
if(user!='Administrator') {
|
||||
return user;
|
||||
} else {
|
||||
var cp = locals['Control Panel']['Control Panel'];
|
||||
return (cp.auto_email_id || 'automail@erpnext.com');
|
||||
return (wn.control_panel.auto_email_id || 'automail@erpnext.com');
|
||||
}
|
||||
})();
|
||||
if(res.send) {
|
||||
|
@ -1 +1,3 @@
|
||||
<div id="setup_div" class="layout_wrapper"></div>
|
||||
<div id="setup_div" class="layout_wrapper">
|
||||
<div style="margin: 200px auto; text-align: center; color: #888">Loading...</div>
|
||||
</div>
|
@ -1,9 +1,8 @@
|
||||
pscript.onload_Setup = function() {
|
||||
var parent = $i('setup_div');
|
||||
add_space_holder(parent);
|
||||
|
||||
var callback = function(r,rt){
|
||||
|
||||
$('#setup_div').empty();
|
||||
// header
|
||||
parent.page_head = new PageHeader(parent,'Setup');
|
||||
|
||||
@ -11,7 +10,6 @@ pscript.onload_Setup = function() {
|
||||
var setup_data = new SetupData(r.message);
|
||||
pscript.setup_make_sections(setup_data);
|
||||
|
||||
remove_space_holder();
|
||||
}
|
||||
$c_obj('Setup Wizard Control','get_country','',callback);
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
# Module Def, Setup Masters
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:35:42',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-23 17:04:53',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': '2010-11-29 12:02:02',
|
||||
'module_label': 'Setup Masters',
|
||||
'module_name': 'Setup Masters',
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, Setup Masters
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'Setup Masters'
|
||||
}
|
||||
]
|
@ -32,4 +32,22 @@ def on_login_post_session(login_manager):
|
||||
def doclist_all(doc, method):
|
||||
"""doclist trigger called from webnotes.model.doclist on any event"""
|
||||
import home
|
||||
home.update_feed(doc, method)
|
||||
home.update_feed(doc, method)
|
||||
|
||||
def boot_session(bootinfo):
|
||||
"""boot session - send website info if guest"""
|
||||
import webnotes
|
||||
import webnotes.model.doc
|
||||
|
||||
if webnotes.session['user']=='Guest':
|
||||
bootinfo['topbar'] = webnotes.model.doc.getsingle('Top Bar Settings')
|
||||
bootinfo['topbaritems'] = webnotes.conn.sql("""select label, std_page, custom_page, parent_label
|
||||
from `tabTop Bar Item`""", as_dict=1)
|
||||
else:
|
||||
bootinfo['letter_heads'] = get_letter_heads()
|
||||
|
||||
def get_letter_heads():
|
||||
"""load letter heads with startup"""
|
||||
import webnotes
|
||||
ret = webnotes.conn.sql("select name, content from `tabLetter Head` where ifnull(disabled,0)=0")
|
||||
dict(ret)
|
||||
|
187
erpnext/startup/feature_setup.js
Normal file
187
erpnext/startup/feature_setup.js
Normal file
@ -0,0 +1,187 @@
|
||||
/* features setup "Dictionary", "Script"
|
||||
Dictionary Format
|
||||
'projects': {
|
||||
'Sales Order': {
|
||||
'fields':['project_name'],
|
||||
'sales_order_details':['projected_qty']
|
||||
},
|
||||
'Purchase Order': {
|
||||
'fields':['project_name']
|
||||
}
|
||||
}
|
||||
// ====================================================================*/
|
||||
pscript.feature_dict = {
|
||||
'fs_projects': {
|
||||
'Bill Of Materials': {'fields':['project_name']},
|
||||
'Delivery Note': {'fields':['project_name']},
|
||||
'Payable Voucher': {'fields':['project_name']},
|
||||
'Production Order': {'fields':['project_name']},
|
||||
'Purchase Order': {'fields':['project_name']},
|
||||
'Purchase Receipt': {'fields':['project_name']},
|
||||
'Receivable Voucher': {'fields':['project_name']},
|
||||
'Sales Order': {'fields':['project_name']},
|
||||
'Stock Entry': {'fields':['project_name']},
|
||||
'Timesheet': {'timesheet_details':['project_name']}
|
||||
},
|
||||
'fs_packing_details': {
|
||||
'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
|
||||
'Sales Order': {'fields':['packing_details']}
|
||||
},
|
||||
'fs_discounts': {
|
||||
'Delivery Note': {'delivery_note_details':['adj_rate']},
|
||||
'Quotation': {'quotation_details':['adj_rate']},
|
||||
'Receivable Voucher': {'entries':['adj_rate']},
|
||||
'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
|
||||
},
|
||||
'fs_purchase_discounts': {
|
||||
'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
|
||||
},
|
||||
'fs_brands': {
|
||||
'Delivery Note': {'delivery_note_details':['brand']},
|
||||
'Indent': {'indent_details':['brand']},
|
||||
'Item': {'fields':['brand']},
|
||||
'Purchase Order': {'po_details':['brand']},
|
||||
'Payable Voucher': {'entries':['brand']},
|
||||
'Quotation': {'quotation_details':['brand']},
|
||||
'Receivable Voucher': {'entries':['brand']},
|
||||
'Sales BOM': {'fields':['new_item_brand']},
|
||||
'Sales Order': {'sales_order_details':['brand']},
|
||||
'Serial No': {'fields':['brand']}
|
||||
},
|
||||
'fs_after_sales_installations': {
|
||||
'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
|
||||
},
|
||||
'fs_item_batch_nos': {
|
||||
'Delivery Note': {'delivery_note_details':['batch_no']},
|
||||
'Item': {'fields':['has_batch_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
|
||||
'QA Inspection Report': {'fields':['batch_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
|
||||
'Receivable Voucher': {'entries':['batch_no']},
|
||||
'Stock Entry': {'mtn_details':['batch_no']},
|
||||
'Stock Ledger Entry': {'fields':['batch_no']}
|
||||
},
|
||||
'fs_item_serial_nos': {
|
||||
'Customer Issue': {'fields':['serial_no']},
|
||||
'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
|
||||
'Installation Note': {'installed_item_details':['serial_no']},
|
||||
'Item': {'fields':['has_serial_no']},
|
||||
'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
|
||||
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
|
||||
'QA Inspection Report': {'fields':['item_serial_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
|
||||
'Receivable Voucher': {'entries':['serial_no']},
|
||||
'Stock Entry': {'mtn_details':['serial_no']},
|
||||
'Stock Ledger Entry': {'fields':['serial_no']}
|
||||
},
|
||||
'fs_item_group_in_details': {
|
||||
'Delivery Note': {'delivery_note_details':['item_group']},
|
||||
'Enquiry': {'enquiry_details':['item_group']},
|
||||
'Indent': {'indent_details':['item_group']},
|
||||
'Item': {'fields':['item_group']},
|
||||
'Manage Account': {'fields':['default_item_group']},
|
||||
'Purchase Order': {'po_details':['item_group']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['item_group']},
|
||||
'Purchase Voucher': {'entries':['item_group']},
|
||||
'Quotation': {'quotation_details':['item_group']},
|
||||
'Receivable Voucher': {'entries':['item_group']},
|
||||
'Sales BOM': {'fields':['serial_no']},
|
||||
'Sales Order': {'sales_order_details':['item_group']},
|
||||
'Serial No': {'fields':['item_group']},
|
||||
'Sales Partner': {'partner_target_details':['item_group']},
|
||||
'Sales Person': {'target_details':['item_group']},
|
||||
'Territory': {'target_details':['item_group']}
|
||||
},
|
||||
'fs_page_break': {
|
||||
'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
|
||||
'Indent': {'indent_details':['page_break']},
|
||||
'Purchase Order': {'po_details':['page_break']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['page_break']},
|
||||
'Purchase Voucher': {'entries':['page_break']},
|
||||
'Quotation': {'quotation_details':['page_break']},
|
||||
'Receivable Voucher': {'entries':['page_break']},
|
||||
'Sales Order': {'sales_order_details':['page_break']}
|
||||
},
|
||||
'fs_exports': {
|
||||
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'POS Setting': {'fields':['conversion_rate','currency']},
|
||||
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
|
||||
'Item': {'ref_rate_details':['ref_currency']},
|
||||
'Sales BOM': {'fields':['currency']},
|
||||
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
|
||||
},
|
||||
'fs_imports': {
|
||||
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
|
||||
'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
|
||||
'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
|
||||
'Supplier Quotation': {'fields':['conversion_rate','currency']}
|
||||
},
|
||||
'fs_item_advanced': {
|
||||
'Item': {'fields':['item_customer_details']}
|
||||
},
|
||||
'fs_sales_extras': {
|
||||
'Address': {'fields':['sales_partner']},
|
||||
'Contact': {'fields':['sales_partner']},
|
||||
'Customer': {'fields':['sales_team']},
|
||||
'Delivery Note': {'fields':['sales_team','Packing List']},
|
||||
'Item': {'fields':['item_customer_details']},
|
||||
'Receivable Voucher': {'fields':['sales_team']},
|
||||
'Sales Order': {'fields':['sales_team','Packing List']}
|
||||
},
|
||||
'fs_more_info': {
|
||||
'Customer': {'fields':['More Info']},
|
||||
'Delivery Note': {'fields':['More Info']},
|
||||
'Enquiry': {'fields':['More Info']},
|
||||
'Indent': {'fields':['More Info']},
|
||||
'Lead': {'fields':['More Info']},
|
||||
'Payable Voucher': {'fields':['More Info']},
|
||||
'Purchase Order': {'fields':['More Info']},
|
||||
'Purchase Receipt': {'fields':['More Info']},
|
||||
'Quotation': {'fields':['More Info']},
|
||||
'Receivable Voucher': {'fields':['More Info']},
|
||||
'Sales Order': {'fields':['More Info']},
|
||||
'Serial No': {'fields':['More Info']},
|
||||
'Supplier': {'fields':['More Info']}
|
||||
},
|
||||
'fs_quality': {
|
||||
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
|
||||
},
|
||||
'fs_manufacturing': {
|
||||
'Item': {'fields':['Manufacturing']}
|
||||
},
|
||||
'fs_pos': {
|
||||
'Receivable Voucher': {'fields':['is_pos']}
|
||||
},
|
||||
'fs_recurring_invoice': {
|
||||
'Receivable Voucher': {'fields': ['Recurring Invoice']}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('form_refresh', function() {
|
||||
for(sys_feat in sys_defaults)
|
||||
{
|
||||
if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
|
||||
{
|
||||
if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
|
||||
{
|
||||
for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
|
||||
{
|
||||
if(fort=='fields')
|
||||
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
|
||||
else if(cur_frm.fields_dict[fort])
|
||||
{
|
||||
for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
|
||||
cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
|
||||
}
|
||||
else
|
||||
msgprint('Grid "'+fort+'" does not exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
372
erpnext/startup/modules.js
Normal file
372
erpnext/startup/modules.js
Normal file
@ -0,0 +1,372 @@
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_make_sidebar = function() {
|
||||
$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
|
||||
|
||||
var callback = function(r,rt) {
|
||||
// menu
|
||||
var ml = r.message;
|
||||
|
||||
// clear
|
||||
page_body.left_sidebar.innerHTML = '';
|
||||
|
||||
for(var m=0; m<ml.length; m++){
|
||||
if(ml[m]) {
|
||||
new SidebarItem(ml[m]);
|
||||
}
|
||||
}
|
||||
if(in_list(user_roles, 'System Manager')) {
|
||||
var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
|
||||
$(div).html('[edit]').click(pscript.startup_set_module_order)
|
||||
}
|
||||
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
|
||||
|
||||
// select current
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
}
|
||||
$c_obj('Home Control', 'get_modules', '', callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu observer
|
||||
// ====================================================================
|
||||
|
||||
cur_menu_pointer = null;
|
||||
var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
|
||||
|
||||
pscript.select_sidebar_menu = function(t, dt, dn) {
|
||||
// get menu item
|
||||
if(menu_item_map[t][dt]) {
|
||||
// select
|
||||
menu_item_map[t][dt].select();
|
||||
} else {
|
||||
// none found :-( Unselect
|
||||
if(cur_menu_pointer)
|
||||
cur_menu_pointer.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu pointer
|
||||
// ====================================================================
|
||||
|
||||
var body_background = '#e2e2e2';
|
||||
|
||||
MenuPointer = function(parent, label) {
|
||||
|
||||
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
||||
$br(this.wrapper, '3px');
|
||||
|
||||
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
|
||||
verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
|
||||
|
||||
$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
|
||||
|
||||
// triangle border (?)
|
||||
this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
|
||||
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
|
||||
borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
|
||||
|
||||
this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
|
||||
|
||||
$(this.wrapper)
|
||||
.hover(
|
||||
function() { if(!this.selected)$bg(this, '#eee'); } ,
|
||||
function() { if(!this.selected)$bg(this, body_background); }
|
||||
)
|
||||
|
||||
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
||||
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.select = function(grey) {
|
||||
$y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
|
||||
//$gr(this.wrapper, '#F84', '#F63');
|
||||
$gr(this.wrapper, '#888', '#666');
|
||||
this.selected = 1;
|
||||
|
||||
if(cur_menu_pointer && cur_menu_pointer != this)
|
||||
cur_menu_pointer.deselect();
|
||||
|
||||
cur_menu_pointer = this;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.deselect = function() {
|
||||
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
||||
$gr(this.wrapper, body_background, body_background);
|
||||
this.selected = 0;
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar Item
|
||||
// ====================================================================
|
||||
|
||||
var cur_sidebar_item = null;
|
||||
|
||||
SidebarItem = function(det) {
|
||||
var me = this;
|
||||
this.det = det;
|
||||
this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
|
||||
|
||||
this.body = $a(this.wrapper, 'div');
|
||||
this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
|
||||
|
||||
// icon
|
||||
var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
|
||||
|
||||
// pointer table
|
||||
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
|
||||
$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
|
||||
|
||||
// for page type
|
||||
if(det.module_page) {
|
||||
menu_item_map.Page[det.module_page] = this.pointer;
|
||||
}
|
||||
|
||||
// items area
|
||||
this.items_area = $a(this.wrapper, 'div');
|
||||
|
||||
this.body.onclick = function() { me.onclick(); }
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.onclick = function() {
|
||||
var me = this;
|
||||
|
||||
if(this.det.module_page) {
|
||||
// page type
|
||||
this.pointer.select();
|
||||
|
||||
$item_set_working(me.pointer.label_area);
|
||||
loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
|
||||
|
||||
} else {
|
||||
// show sub items
|
||||
this.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.collapse = function() {
|
||||
$(this.items_area).slideUp();
|
||||
this.is_open = 0;
|
||||
$fg(this.pointer.label_area, '#444')
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.toggle = function() {
|
||||
if(this.loading) return;
|
||||
|
||||
if(this.is_open) {
|
||||
this.collapse();
|
||||
} else {
|
||||
if(this.loaded) $(this.items_area).slideDown();
|
||||
else this.show_items();
|
||||
this.is_open = 1;
|
||||
$fg(this.pointer.label_area, '#000')
|
||||
//this.pointer.select(1);
|
||||
|
||||
// close existing open
|
||||
if(cur_sidebar_item && cur_sidebar_item != this) {
|
||||
cur_sidebar_item.collapse();
|
||||
}
|
||||
cur_sidebar_item = this;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_items = function() {
|
||||
this.loading = 1;
|
||||
var me = this;
|
||||
|
||||
$item_set_working(this.pointer.label_area);
|
||||
var callback = function(r,rt){
|
||||
me.loaded = 1;
|
||||
me.loading = 0;
|
||||
var smi = null;
|
||||
var has_reports = 0;
|
||||
var has_tools = 0;
|
||||
|
||||
// widget code
|
||||
$item_done_working(me.pointer.label_area);
|
||||
|
||||
if(r.message.il) {
|
||||
me.il = r.message.il;
|
||||
|
||||
// forms
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(me.il[i].doc_type == 'Forms') {
|
||||
if(in_list(profile.can_read, me.il[i].doc_name)) {
|
||||
var smi = new SidebarModuleItem(me, me.il[i]);
|
||||
|
||||
menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
|
||||
menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
|
||||
}
|
||||
}
|
||||
if(me.il[i].doc_type=='Reports') has_reports = 1;
|
||||
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
|
||||
}
|
||||
// reports
|
||||
if(has_reports) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
|
||||
}
|
||||
|
||||
// tools
|
||||
if(has_tools) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
|
||||
}
|
||||
|
||||
// custom reports
|
||||
if(r.message.custom_reports.length) {
|
||||
me.il = add_lists(r.message.il, r.message.custom_reports);
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(me.items_area).slideDown();
|
||||
|
||||
// high light
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
|
||||
}
|
||||
|
||||
$c_obj('Home Control', 'get_module_details', me.det.name, callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Show Reports
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_section = function(sec_type) {
|
||||
var me = this;
|
||||
var label = this.det.module_label + ' ' + sec_type;
|
||||
var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
|
||||
|
||||
if(page_body.pages[label]) {
|
||||
loadpage(label, null, 1);
|
||||
} else {
|
||||
// make the reports page
|
||||
var page = page_body.add_page(label);
|
||||
this.wrapper = $a(page,'div','layout_wrapper');
|
||||
|
||||
|
||||
// head
|
||||
this.head = new PageHeader(this.wrapper, label);
|
||||
|
||||
// body
|
||||
this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
|
||||
|
||||
// add a report link
|
||||
var add_link = function(det) {
|
||||
var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
|
||||
var span = $a(div, 'span', 'link_type');
|
||||
|
||||
// tag the span
|
||||
span.innerHTML = det.display_name; span.det = det;
|
||||
if(sec_type=='Reports' || sec_type=='Custom Reports') {
|
||||
// Reports
|
||||
// -------
|
||||
span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
|
||||
|
||||
} else {
|
||||
// Tools
|
||||
// -----
|
||||
|
||||
if(det.doc_type=='Pages') {
|
||||
// Page
|
||||
if(det.click_function) {
|
||||
span.onclick = function() { eval(this.det.click_function) }
|
||||
span.click_function = det.click_function;
|
||||
} else {
|
||||
span.onclick = function() { loadpage(this.det.doc_name); }
|
||||
}
|
||||
} else if(det.doc_type=='Setup Forms') {
|
||||
// Doc Browser
|
||||
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
|
||||
} else {
|
||||
// Single
|
||||
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// item list
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(type_map[me.il[i].doc_type] == sec_type) {
|
||||
add_link(me.il[i]);
|
||||
}
|
||||
}
|
||||
loadpage(label, null, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar module item
|
||||
// ====================================================================
|
||||
|
||||
SidebarModuleItem = function(si, det) {
|
||||
this.det = det;
|
||||
var me= this;
|
||||
|
||||
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
|
||||
$y(si.items_area, {marginLeft:'32px'})
|
||||
$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
|
||||
|
||||
this.pointer.wrapper.onclick = function() {
|
||||
if(me.det.doc_type=='Forms')
|
||||
loaddocbrowser(det.doc_name);
|
||||
else
|
||||
si.show_section(me.det.doc_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Drag & Drop order selection
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_set_module_order = function() {
|
||||
var update_order= function(ml) {
|
||||
mdict = {};
|
||||
for(var i=0; i<ml.length; i++) {
|
||||
mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
|
||||
}
|
||||
$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
|
||||
}
|
||||
|
||||
var callback = function(r, rt) {
|
||||
var ml = [];
|
||||
for(var i=0; i<r.message.length; i++) {
|
||||
var det = r.message[i];
|
||||
ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
|
||||
}
|
||||
new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
|
||||
'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
|
||||
}
|
||||
$c_obj('Home Control', 'get_module_order', '', callback)
|
||||
|
||||
}
|
@ -1,413 +1,39 @@
|
||||
if(user == 'Guest'){
|
||||
$dh(page_body.left_sidebar);
|
||||
}
|
||||
|
||||
var current_module;
|
||||
var is_system_manager = 0;
|
||||
var module_content_dict = {};
|
||||
var user_full_nm = {};
|
||||
|
||||
// check if session user is system manager
|
||||
if(inList(user_roles,'System Manager')) is_system_manager = 1;
|
||||
wn.provide('erpnext.startup');
|
||||
|
||||
wn.require('erpnext/startup/toolbar.js');
|
||||
erpnext.startup.set_globals = function() {
|
||||
pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
|
||||
if(inList(user_roles,'System Manager')) is_system_manager = 1;
|
||||
}
|
||||
|
||||
function startup_setup() {
|
||||
pscript.is_erpnext_saas = cint(locals['Control Panel']['Control Panel'].sync_with_gateway)
|
||||
erpnext.startup.start = function() {
|
||||
erpnext.startup.set_globals();
|
||||
|
||||
if(user == 'Guest'){
|
||||
$dh(page_body.left_sidebar);
|
||||
wn.require('erpnext/website/js/topbar.js');
|
||||
} else {
|
||||
// modules
|
||||
wn.require('erpnext/startup/modules.js');
|
||||
pscript.startup_make_sidebar();
|
||||
|
||||
if(get_url_arg('embed')) {
|
||||
// hide header, footer
|
||||
$('.topbar').css('display', 'none');
|
||||
$dh(page_body.footer);
|
||||
return;
|
||||
// setup toolbar
|
||||
wn.require('erpnext/startup/toolbar.js');
|
||||
erpnext.toolbar.setup();
|
||||
wn.require('erpnext/startup/feature_setup.js');
|
||||
}
|
||||
|
||||
$dh(page_body.banner_area);
|
||||
|
||||
// sidebar
|
||||
// -------
|
||||
pscript.startup_make_sidebar();
|
||||
|
||||
// border to the body
|
||||
// ------------------
|
||||
page_body.footer.innerHTML = '<div class="erpnext-footer">Powered by <a href="https://erpnext.com">ERPNext</a></div>';
|
||||
|
||||
// setup toolbar
|
||||
erpnext.toolbar.setup();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_make_sidebar = function() {
|
||||
$y(page_body.left_sidebar, {width:(100/6)+'%', paddingTop:'8px'});
|
||||
|
||||
var callback = function(r,rt) {
|
||||
// menu
|
||||
var ml = r.message;
|
||||
|
||||
// clear
|
||||
page_body.left_sidebar.innerHTML = '';
|
||||
|
||||
for(var m=0; m<ml.length; m++){
|
||||
if(ml[m]) {
|
||||
new SidebarItem(ml[m]);
|
||||
}
|
||||
}
|
||||
if(in_list(user_roles, 'System Manager')) {
|
||||
var div = $a(page_body.left_sidebar, 'div', 'link_type', {padding:'8px', fontSize:'11px'});
|
||||
$(div).html('[edit]').click(pscript.startup_set_module_order)
|
||||
}
|
||||
nav_obj.observers.push({notify:function(t,dt,dn) { pscript.select_sidebar_menu(t, dt, dn); }});
|
||||
|
||||
// select current
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
}
|
||||
$c_obj('Home Control', 'get_modules', '', callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu observer
|
||||
// ====================================================================
|
||||
|
||||
cur_menu_pointer = null;
|
||||
var menu_item_map = {'Form':{}, 'Page':{}, 'Report':{}, 'List':{}}
|
||||
|
||||
pscript.select_sidebar_menu = function(t, dt, dn) {
|
||||
// get menu item
|
||||
if(menu_item_map[t][dt]) {
|
||||
// select
|
||||
menu_item_map[t][dt].select();
|
||||
} else {
|
||||
// none found :-( Unselect
|
||||
if(cur_menu_pointer)
|
||||
cur_menu_pointer.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Menu pointer
|
||||
// ====================================================================
|
||||
|
||||
var body_background = '#e2e2e2';
|
||||
|
||||
MenuPointer = function(parent, label) {
|
||||
|
||||
this.wrapper = $a(parent, 'div', '', {padding:'0px', cursor:'pointer', margin:'2px 0px'});
|
||||
$br(this.wrapper, '3px');
|
||||
|
||||
this.tab = make_table($a(this.wrapper, 'div'), 1, 2, '100%', ['', '11px'], {height:'22px',
|
||||
verticalAlign:'middle', padding:'0px'}, {borderCollapse:'collapse', tableLayout:'fixed'});
|
||||
|
||||
$y($td(this.tab, 0, 0), {padding:'0px 4px', color:'#444', whiteSpace:'nowrap'});
|
||||
|
||||
// triangle border (?)
|
||||
this.tab.triangle_div = $a($td(this.tab, 0, 1), 'div','', {
|
||||
borderColor: body_background + ' ' + body_background + ' ' + body_background + ' ' + 'transparent',
|
||||
borderWidth:'11px', borderStyle:'solid', height:'0px', width:'0px', marginRight:'-11px'});
|
||||
|
||||
this.label_area = $a($td(this.tab, 0, 0), 'span', '', '', label);
|
||||
|
||||
$(this.wrapper)
|
||||
.hover(
|
||||
function() { if(!this.selected)$bg(this, '#eee'); } ,
|
||||
function() { if(!this.selected)$bg(this, body_background); }
|
||||
)
|
||||
|
||||
$y($td(this.tab, 0, 0), {borderBottom:'1px solid #ddd'});
|
||||
$('footer').html('<div class="erpnext-footer">\
|
||||
Powered by <a href="https://erpnext.com">ERPNext</a></div>');
|
||||
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.select = function(grey) {
|
||||
$y($td(this.tab, 0, 0), {color:'#fff', borderBottom:'0px solid #000'});
|
||||
//$gr(this.wrapper, '#F84', '#F63');
|
||||
$gr(this.wrapper, '#888', '#666');
|
||||
this.selected = 1;
|
||||
|
||||
if(cur_menu_pointer && cur_menu_pointer != this)
|
||||
cur_menu_pointer.deselect();
|
||||
|
||||
cur_menu_pointer = this;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
MenuPointer.prototype.deselect = function() {
|
||||
$y($td(this.tab, 0, 0), {color:'#444', borderBottom:'1px solid #ddd'});
|
||||
$gr(this.wrapper, body_background, body_background);
|
||||
this.selected = 0;
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar Item
|
||||
// ====================================================================
|
||||
|
||||
var cur_sidebar_item = null;
|
||||
|
||||
SidebarItem = function(det) {
|
||||
var me = this;
|
||||
this.det = det;
|
||||
this.wrapper = $a(page_body.left_sidebar, 'div', '', {marginRight:'12px'});
|
||||
|
||||
this.body = $a(this.wrapper, 'div');
|
||||
this.tab = make_table(this.body, 1, 2, '100%', ['24px', null], {verticalAlign:'middle'}, {tableLayout:'fixed'});
|
||||
|
||||
// icon
|
||||
var ic = $a($td(this.tab, 0, 0), 'div', 'module-icons module-icons-' + det.module_label.toLowerCase(), {marginLeft:'3px', marginBottom:'-2px'});
|
||||
|
||||
// pointer table
|
||||
this.pointer = new MenuPointer($td(this.tab, 0, 1), det.module_label);
|
||||
$y($td(this.pointer.tab, 0, 0), {fontWeight:'bold'});
|
||||
|
||||
// for page type
|
||||
if(det.module_page) {
|
||||
menu_item_map.Page[det.module_page] = this.pointer;
|
||||
}
|
||||
|
||||
// items area
|
||||
this.items_area = $a(this.wrapper, 'div');
|
||||
|
||||
this.body.onclick = function() { me.onclick(); }
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.onclick = function() {
|
||||
var me = this;
|
||||
|
||||
if(this.det.module_page) {
|
||||
// page type
|
||||
this.pointer.select();
|
||||
|
||||
$item_set_working(me.pointer.label_area);
|
||||
loadpage(this.det.module_page, function() { $item_done_working(me.pointer.label_area); });
|
||||
|
||||
} else {
|
||||
// show sub items
|
||||
this.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.collapse = function() {
|
||||
$(this.items_area).slideUp();
|
||||
this.is_open = 0;
|
||||
$fg(this.pointer.label_area, '#444')
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.toggle = function() {
|
||||
if(this.loading) return;
|
||||
|
||||
if(this.is_open) {
|
||||
this.collapse();
|
||||
} else {
|
||||
if(this.loaded) $(this.items_area).slideDown();
|
||||
else this.show_items();
|
||||
this.is_open = 1;
|
||||
$fg(this.pointer.label_area, '#000')
|
||||
//this.pointer.select(1);
|
||||
|
||||
// close existing open
|
||||
if(cur_sidebar_item && cur_sidebar_item != this) {
|
||||
cur_sidebar_item.collapse();
|
||||
}
|
||||
cur_sidebar_item = this;
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_items = function() {
|
||||
this.loading = 1;
|
||||
var me = this;
|
||||
|
||||
$item_set_working(this.pointer.label_area);
|
||||
var callback = function(r,rt){
|
||||
me.loaded = 1;
|
||||
me.loading = 0;
|
||||
var smi = null;
|
||||
var has_reports = 0;
|
||||
var has_tools = 0;
|
||||
|
||||
// widget code
|
||||
$item_done_working(me.pointer.label_area);
|
||||
|
||||
if(r.message.il) {
|
||||
me.il = r.message.il;
|
||||
|
||||
// forms
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(me.il[i].doc_type == 'Forms') {
|
||||
if(in_list(profile.can_read, me.il[i].doc_name)) {
|
||||
var smi = new SidebarModuleItem(me, me.il[i]);
|
||||
|
||||
menu_item_map['Form'][me.il[i].doc_name] = smi.pointer;
|
||||
menu_item_map['List'][me.il[i].doc_name] = smi.pointer;
|
||||
}
|
||||
}
|
||||
if(me.il[i].doc_type=='Reports') has_reports = 1;
|
||||
if(in_list(['Single DocType', 'Pages', 'Setup Forms'], me.il[i].doc_type)) has_tools = 1;
|
||||
}
|
||||
// reports
|
||||
if(has_reports) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Reports', doc_type:'Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Reports'] = smi.pointer;
|
||||
}
|
||||
|
||||
// tools
|
||||
if(has_tools) {
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Tools', doc_type:'Tools'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Tools'] = smi.pointer;
|
||||
}
|
||||
|
||||
// custom reports
|
||||
if(r.message.custom_reports.length) {
|
||||
me.il = add_lists(r.message.il, r.message.custom_reports);
|
||||
var smi = new SidebarModuleItem(me, {doc_name:'Custom Reports', doc_type:'Custom Reports'});
|
||||
|
||||
// add to menu-item mapper
|
||||
menu_item_map['Page'][me.det.module_label + ' Custom Reports'] = smi.pointer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(me.items_area).slideDown();
|
||||
|
||||
// high light
|
||||
var no = nav_obj.ol[nav_obj.ol.length-1];
|
||||
if(no && menu_item_map[decodeURIComponent(no[0])][decodeURIComponent(no[1])])
|
||||
pscript.select_sidebar_menu(decodeURIComponent(no[0]), decodeURIComponent(no[1]));
|
||||
|
||||
}
|
||||
|
||||
$c_obj('Home Control', 'get_module_details', me.det.name, callback);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Show Reports
|
||||
// ====================================================================
|
||||
|
||||
SidebarItem.prototype.show_section = function(sec_type) {
|
||||
var me = this;
|
||||
var label = this.det.module_label + ' ' + sec_type;
|
||||
var type_map = {'Reports':'Reports', 'Custom Reports':'Custom Reports', 'Pages':'Tools', 'Single DocType':'Tools', 'Setup Forms':'Tools'}
|
||||
|
||||
if(page_body.pages[label]) {
|
||||
loadpage(label, null, 1);
|
||||
} else {
|
||||
// make the reports page
|
||||
var page = page_body.add_page(label);
|
||||
this.wrapper = $a(page,'div','layout_wrapper');
|
||||
|
||||
|
||||
// head
|
||||
this.head = new PageHeader(this.wrapper, label);
|
||||
|
||||
// body
|
||||
this.body1 = $a(this.wrapper, 'div', '', {marginTop:'16px'});
|
||||
|
||||
// add a report link
|
||||
var add_link = function(det) {
|
||||
var div = $a(me.body1, 'div', '', {marginBottom:'6px'});
|
||||
var span = $a(div, 'span', 'link_type');
|
||||
|
||||
// tag the span
|
||||
span.innerHTML = det.display_name; span.det = det;
|
||||
if(sec_type=='Reports' || sec_type=='Custom Reports') {
|
||||
// Reports
|
||||
// -------
|
||||
span.onclick = function() { loadreport(this.det.doc_name, this.det.display_name); }
|
||||
|
||||
} else {
|
||||
// Tools
|
||||
// -----
|
||||
|
||||
if(det.doc_type=='Pages') {
|
||||
// Page
|
||||
if(det.click_function) {
|
||||
span.onclick = function() { eval(this.det.click_function) }
|
||||
span.click_function = det.click_function;
|
||||
} else {
|
||||
span.onclick = function() { loadpage(this.det.doc_name); }
|
||||
}
|
||||
} else if(det.doc_type=='Setup Forms') {
|
||||
// Doc Browser
|
||||
span.onclick = function() { loaddocbrowser(this.det.doc_name); }
|
||||
} else {
|
||||
// Single
|
||||
span.onclick = function() { loaddoc(this.det.doc_name, this.det.doc_name); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// item list
|
||||
for(var i=0; i<me.il.length;i++){
|
||||
if(type_map[me.il[i].doc_type] == sec_type) {
|
||||
add_link(me.il[i]);
|
||||
}
|
||||
}
|
||||
loadpage(label, null, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Sidebar module item
|
||||
// ====================================================================
|
||||
|
||||
SidebarModuleItem = function(si, det) {
|
||||
this.det = det;
|
||||
var me= this;
|
||||
|
||||
this.pointer = new MenuPointer(si.items_area, get_doctype_label(det.doc_name));
|
||||
$y(si.items_area, {marginLeft:'32px'})
|
||||
$y($td(this.pointer.tab, 0, 0), {fontSize:'11px'});
|
||||
|
||||
this.pointer.wrapper.onclick = function() {
|
||||
if(me.det.doc_type=='Forms')
|
||||
loaddocbrowser(det.doc_name);
|
||||
else
|
||||
si.show_section(me.det.doc_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
// Drag & Drop order selection
|
||||
// ====================================================================
|
||||
|
||||
pscript.startup_set_module_order = function() {
|
||||
var update_order= function(ml) {
|
||||
mdict = {};
|
||||
for(var i=0; i<ml.length; i++) {
|
||||
mdict[ml[i][3][3]] = {'module_seq':ml[i][1], 'is_hidden':(ml[i][2] ? 'No' : 'Yes')}
|
||||
}
|
||||
$c_obj('Home Control', 'set_module_order', JSON.stringify(mdict), function(r,rt) { pscript.startup_make_sidebar(); } )
|
||||
}
|
||||
|
||||
var callback = function(r, rt) {
|
||||
var ml = [];
|
||||
for(var i=0; i<r.message.length; i++) {
|
||||
var det = r.message[i];
|
||||
ml.push([det[1], det[2], (det[3]!='No' ? 0 : 1), det[0]]);
|
||||
}
|
||||
new ListSelector('Set Module Sequence', 'Select items and set the order you want them to appear'+
|
||||
'<br><b>Note:</b> <i>These changes will apply to all users!</i>', ml, update_order, 1);
|
||||
}
|
||||
$c_obj('Home Control', 'get_module_order', '', callback)
|
||||
|
||||
}
|
||||
// chart of accounts
|
||||
// ====================================================================
|
||||
show_chart_browser = function(nm, chart_type){
|
||||
@ -446,224 +72,5 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
|
||||
if(callback) this.callback = function(){ callback(); }
|
||||
}
|
||||
|
||||
|
||||
// get plural
|
||||
// ====================================================================
|
||||
|
||||
get_plural = function(str){
|
||||
if(str.charAt(str.length-1).toLowerCase() == 'y') return str.substr(0, str.length-1) + 'ies'
|
||||
else return str + 's';
|
||||
}
|
||||
|
||||
// set user fullname
|
||||
// ====================================================================
|
||||
pscript.set_user_fullname = function(ele,username,get_latest){
|
||||
|
||||
var set_it = function(){
|
||||
if(ele)
|
||||
ele.innerHTML = user_full_nm[username];
|
||||
}
|
||||
|
||||
if(get_latest){
|
||||
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
|
||||
}
|
||||
else{
|
||||
if(user_full_nm[username]){
|
||||
set_it();
|
||||
}
|
||||
|
||||
else
|
||||
$c_obj('Home Control','get_user_fullname',username, function(r,rt){ user_full_nm[username] = r.message; set_it(); });
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
startup_setup();
|
||||
|
||||
/* features setup "Dictionary", "Script"
|
||||
Dictionary Format
|
||||
'projects': {
|
||||
'Sales Order': {
|
||||
'fields':['project_name'],
|
||||
'sales_order_details':['projected_qty']
|
||||
},
|
||||
'Purchase Order': {
|
||||
'fields':['project_name']
|
||||
}
|
||||
}
|
||||
// ====================================================================*/
|
||||
pscript.feature_dict = {
|
||||
'fs_projects': {
|
||||
'Bill Of Materials': {'fields':['project_name']},
|
||||
'Delivery Note': {'fields':['project_name']},
|
||||
'Payable Voucher': {'fields':['project_name']},
|
||||
'Production Order': {'fields':['project_name']},
|
||||
'Purchase Order': {'fields':['project_name']},
|
||||
'Purchase Receipt': {'fields':['project_name']},
|
||||
'Receivable Voucher': {'fields':['project_name']},
|
||||
'Sales Order': {'fields':['project_name']},
|
||||
'Stock Entry': {'fields':['project_name']},
|
||||
'Timesheet': {'timesheet_details':['project_name']}
|
||||
},
|
||||
'fs_packing_details': {
|
||||
'Delivery Note': {'fields':['packing_details','print_packing_slip','packing_checked_by','packed_by','pack_size','shipping_mark'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
|
||||
'Sales Order': {'fields':['packing_details']}
|
||||
},
|
||||
'fs_discounts': {
|
||||
'Delivery Note': {'delivery_note_details':['adj_rate']},
|
||||
'Quotation': {'quotation_details':['adj_rate']},
|
||||
'Receivable Voucher': {'entries':['adj_rate']},
|
||||
'Sales Order': {'sales_order_details':['adj_rate','ref_rate']}
|
||||
},
|
||||
'fs_purchase_discounts': {
|
||||
'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']},
|
||||
'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
|
||||
},
|
||||
'fs_brands': {
|
||||
'Delivery Note': {'delivery_note_details':['brand']},
|
||||
'Indent': {'indent_details':['brand']},
|
||||
'Item': {'fields':['brand']},
|
||||
'Purchase Order': {'po_details':['brand']},
|
||||
'Payable Voucher': {'entries':['brand']},
|
||||
'Quotation': {'quotation_details':['brand']},
|
||||
'Receivable Voucher': {'entries':['brand']},
|
||||
'Sales BOM': {'fields':['new_item_brand']},
|
||||
'Sales Order': {'sales_order_details':['brand']},
|
||||
'Serial No': {'fields':['brand']}
|
||||
},
|
||||
'fs_after_sales_installations': {
|
||||
'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
|
||||
},
|
||||
'fs_item_batch_nos': {
|
||||
'Delivery Note': {'delivery_note_details':['batch_no']},
|
||||
'Item': {'fields':['has_batch_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['batch_no']},
|
||||
'QA Inspection Report': {'fields':['batch_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
|
||||
'Receivable Voucher': {'entries':['batch_no']},
|
||||
'Stock Entry': {'mtn_details':['batch_no']},
|
||||
'Stock Ledger Entry': {'fields':['batch_no']}
|
||||
},
|
||||
'fs_item_serial_nos': {
|
||||
'Customer Issue': {'fields':['serial_no']},
|
||||
'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']},
|
||||
'Installation Note': {'installed_item_details':['serial_no']},
|
||||
'Item': {'fields':['has_serial_no']},
|
||||
'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']},
|
||||
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
|
||||
'QA Inspection Report': {'fields':['item_serial_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
|
||||
'Receivable Voucher': {'entries':['serial_no']},
|
||||
'Stock Entry': {'mtn_details':['serial_no']},
|
||||
'Stock Ledger Entry': {'fields':['serial_no']}
|
||||
},
|
||||
'fs_item_group_in_details': {
|
||||
'Delivery Note': {'delivery_note_details':['item_group']},
|
||||
'Enquiry': {'enquiry_details':['item_group']},
|
||||
'Indent': {'indent_details':['item_group']},
|
||||
'Item': {'fields':['item_group']},
|
||||
'Manage Account': {'fields':['default_item_group']},
|
||||
'Purchase Order': {'po_details':['item_group']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['item_group']},
|
||||
'Purchase Voucher': {'entries':['item_group']},
|
||||
'Quotation': {'quotation_details':['item_group']},
|
||||
'Receivable Voucher': {'entries':['item_group']},
|
||||
'Sales BOM': {'fields':['serial_no']},
|
||||
'Sales Order': {'sales_order_details':['item_group']},
|
||||
'Serial No': {'fields':['item_group']},
|
||||
'Sales Partner': {'partner_target_details':['item_group']},
|
||||
'Sales Person': {'target_details':['item_group']},
|
||||
'Territory': {'target_details':['item_group']}
|
||||
},
|
||||
'fs_page_break': {
|
||||
'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']},
|
||||
'Indent': {'indent_details':['page_break']},
|
||||
'Purchase Order': {'po_details':['page_break']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['page_break']},
|
||||
'Purchase Voucher': {'entries':['page_break']},
|
||||
'Quotation': {'quotation_details':['page_break']},
|
||||
'Receivable Voucher': {'entries':['page_break']},
|
||||
'Sales Order': {'sales_order_details':['page_break']}
|
||||
},
|
||||
'fs_exports': {
|
||||
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'POS Setting': {'fields':['conversion_rate','currency']},
|
||||
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
|
||||
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
|
||||
'Item': {'ref_rate_details':['ref_currency']},
|
||||
'Sales BOM': {'fields':['currency']},
|
||||
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
|
||||
},
|
||||
'fs_imports': {
|
||||
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
|
||||
'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']},
|
||||
'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']},
|
||||
'Supplier Quotation': {'fields':['conversion_rate','currency']}
|
||||
},
|
||||
'fs_item_advanced': {
|
||||
'Item': {'fields':['item_customer_details']}
|
||||
},
|
||||
'fs_sales_extras': {
|
||||
'Address': {'fields':['sales_partner']},
|
||||
'Contact': {'fields':['sales_partner']},
|
||||
'Customer': {'fields':['sales_team']},
|
||||
'Delivery Note': {'fields':['sales_team','Packing List']},
|
||||
'Item': {'fields':['item_customer_details']},
|
||||
'Receivable Voucher': {'fields':['sales_team']},
|
||||
'Sales Order': {'fields':['sales_team','Packing List']}
|
||||
},
|
||||
'fs_more_info': {
|
||||
'Customer': {'fields':['More Info']},
|
||||
'Delivery Note': {'fields':['More Info']},
|
||||
'Enquiry': {'fields':['More Info']},
|
||||
'Indent': {'fields':['More Info']},
|
||||
'Lead': {'fields':['More Info']},
|
||||
'Payable Voucher': {'fields':['More Info']},
|
||||
'Purchase Order': {'fields':['More Info']},
|
||||
'Purchase Receipt': {'fields':['More Info']},
|
||||
'Quotation': {'fields':['More Info']},
|
||||
'Receivable Voucher': {'fields':['More Info']},
|
||||
'Sales Order': {'fields':['More Info']},
|
||||
'Serial No': {'fields':['More Info']},
|
||||
'Supplier': {'fields':['More Info']}
|
||||
},
|
||||
'fs_quality': {
|
||||
'Item': {'fields':['Item Inspection Criteria','inspection_required']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
|
||||
},
|
||||
'fs_manufacturing': {
|
||||
'Item': {'fields':['Manufacturing']}
|
||||
},
|
||||
'fs_pos': {
|
||||
'Receivable Voucher': {'fields':['is_pos']}
|
||||
},
|
||||
'fs_recurring_invoice': {
|
||||
'Receivable Voucher': {'fields': ['Recurring Invoice']}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).bind('form_refresh', function() {
|
||||
for(sys_feat in sys_defaults)
|
||||
{
|
||||
if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists
|
||||
{
|
||||
if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat])
|
||||
{
|
||||
for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype])
|
||||
{
|
||||
if(fort=='fields')
|
||||
hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
|
||||
else if(cur_frm.fields_dict[fort])
|
||||
{
|
||||
for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
|
||||
cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
|
||||
}
|
||||
else
|
||||
msgprint('Grid "'+fort+'" does not exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// start
|
||||
erpnext.startup.start();
|
66
erpnext/website/Module Def/Website/Website.txt
Normal file
66
erpnext/website/Module Def/Website/Website.txt
Normal file
@ -0,0 +1,66 @@
|
||||
# Module Def, Website
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-23 17:05:32',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-24 10:29:53',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'name': '__common__',
|
||||
'parent': 'Website',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Item
|
||||
{
|
||||
'display_name': 'Top Bar Settings',
|
||||
'doc_name': 'Top Bar Settings',
|
||||
'doc_type': 'Single DocType',
|
||||
'doctype': 'Module Def Item',
|
||||
'name': '__common__',
|
||||
'parent': 'Website',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'is_hidden': 'No',
|
||||
'module_label': 'Website',
|
||||
'module_name': 'Website',
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, Website
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'Website'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Website Manager'
|
||||
}
|
||||
]
|
0
erpnext/website/__init__.py
Normal file
0
erpnext/website/__init__.py
Normal file
0
erpnext/website/doctype/__init__.py
Normal file
0
erpnext/website/doctype/__init__.py
Normal file
0
erpnext/website/doctype/top_bar_item/__init__.py
Normal file
0
erpnext/website/doctype/top_bar_item/__init__.py
Normal file
74
erpnext/website/doctype/top_bar_item/top_bar_item.txt
Normal file
74
erpnext/website/doctype/top_bar_item/top_bar_item.txt
Normal file
@ -0,0 +1,74 @@
|
||||
# DocType, Top Bar Item
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-24 10:24:19',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-24 10:24:19',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Top Bar Item',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, Top Bar Item
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Top Bar Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'label',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Label'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'std_page',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Std Page',
|
||||
'options': 'Home\nAbout\nContact\nProduct\nCustomer\nBlog\nPartner\nCareer\nCustom'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'custom_page',
|
||||
'fieldtype': 'Link',
|
||||
'label': 'Custom Page',
|
||||
'options': 'Web Page'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'parent_label',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Parent Label'
|
||||
}
|
||||
]
|
@ -0,0 +1,99 @@
|
||||
# DocType, Top Bar Settings
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-01-24 10:21:41',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-24 10:45:02',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1327380941',
|
||||
'allow_attach': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Other',
|
||||
'issingle': 1,
|
||||
'max_attachments': 1,
|
||||
'module': 'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 3
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Top Bar Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Top Bar Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, Top Bar Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Top Bar Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'role': 'Website Manager'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'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',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand_html',
|
||||
'fieldtype': 'Text',
|
||||
'label': 'Brand HTML'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'top_bar_items',
|
||||
'fieldtype': 'Table',
|
||||
'label': 'Top Bar Items',
|
||||
'options': 'Top Bar Item'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'file_list',
|
||||
'fieldtype': 'Text',
|
||||
'hidden': 1,
|
||||
'label': 'File List',
|
||||
'no_copy': 1,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
46
erpnext/website/js/topbar.js
Normal file
46
erpnext/website/js/topbar.js
Normal file
@ -0,0 +1,46 @@
|
||||
wn.provide('erpnext.topbar');
|
||||
wn.require('lib/css/bootstrap/bootstrap-topbar.css');
|
||||
wn.require('lib/js/bootstrap/bootstrap-dropdown.js');
|
||||
|
||||
/*
|
||||
<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" onclick="return false;"></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-user">\
|
||||
</ul>\
|
||||
</li>\
|
||||
*/
|
||||
|
||||
erpnext.topbar.TopBar = Class.extend({
|
||||
init: function() {
|
||||
this.make();
|
||||
$('.brand').html(wn.boot.topbar.brand_html);
|
||||
this.make_items();
|
||||
},
|
||||
make: function() {
|
||||
$('header').append('<div class="topbar">\
|
||||
<div class="topbar-inner">\
|
||||
<div class="container">\
|
||||
<a class="brand">[brand]</a>\
|
||||
<ul class="nav">\
|
||||
</ul>\
|
||||
<img src="lib/images/ui/spinner.gif" id="spinner"/>\
|
||||
<ul class="nav secondary-nav">\
|
||||
<li><a href="#!Login Page">Login</a></li>\
|
||||
</ul>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>');
|
||||
},
|
||||
make_items: function() {
|
||||
var items = wn.boot.topbaritems
|
||||
for(var i=0;i<items.length;i++) {
|
||||
var item = items[i];
|
||||
if(!item.parent_label) {
|
||||
$('header .nav:first').append(repl('<li><a href="#" data-label="%(label)s">\
|
||||
%(label)s</a></li>', item))
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.topbar.topbar = new erpnext.topbar.TopBar();
|
@ -3,7 +3,7 @@
|
||||
<meta charset="utf-8">
|
||||
<title>ERPNext</title>
|
||||
<meta name="author" content="">
|
||||
<script type="text/javascript">window._version_number="136";
|
||||
<script type="text/javascript">window._version_number="168";
|
||||
|
||||
/*
|
||||
* lib/js/wn/class.js
|
||||
@ -191,6 +191,7 @@ wn.versions.check();wn.require("lib/js/lib/jquery.min.js");wn.require("lib/js/li
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<footer></footer>
|
||||
<script>wn.require('js/app.js');</script>
|
||||
<div id="dialog_back"></div>
|
||||
</body>
|
||||
|
@ -7,6 +7,7 @@ wn.app = {
|
||||
version: '2.' + window._version_number
|
||||
}
|
||||
|
||||
wn.modules_path = 'erpnext';
|
||||
wn.settings.no_history = true;
|
||||
|
||||
wn.require('lib/js/lib/jquery.min.js');
|
||||
|
@ -15,6 +15,7 @@
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<footer></footer>
|
||||
<script>wn.require('js/app.js');</script>
|
||||
<div id="dialog_back"></div>
|
||||
</body>
|
||||
|
@ -1 +1 @@
|
||||
136
|
||||
168
|
Loading…
x
Reference in New Issue
Block a user