mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 22:18:27 +00:00
moved directory structure
This commit is contained in:
205
startup/js/feature_setup.js
Normal file
205
startup/js/feature_setup.js
Normal file
@@ -0,0 +1,205 @@
|
||||
// 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/>.
|
||||
|
||||
/* 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': {
|
||||
'BOM': {'fields':['project_name']},
|
||||
'Delivery Note': {'fields':['project_name']},
|
||||
'Purchase Invoice': {'entries':['project_name']},
|
||||
'Production Order': {'fields':['project_name']},
|
||||
'Purchase Order': {'po_details':['project_name']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['project_name']},
|
||||
'Sales Invoice': {'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']},
|
||||
'Sales Invoice': {'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']},
|
||||
'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
|
||||
},
|
||||
'fs_brands': {
|
||||
'Delivery Note': {'delivery_note_details':['brand']},
|
||||
'Purchase Request': {'indent_details':['brand']},
|
||||
'Item': {'fields':['brand']},
|
||||
'Purchase Order': {'po_details':['brand']},
|
||||
'Purchase Invoice': {'entries':['brand']},
|
||||
'Quotation': {'quotation_details':['brand']},
|
||||
'Sales Invoice': {'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']},
|
||||
'Quality Inspection': {'fields':['batch_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
|
||||
'Sales Invoice': {'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_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']},
|
||||
'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
|
||||
'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
|
||||
'Quality Inspection': {'fields':['item_serial_no']},
|
||||
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
|
||||
'Sales Invoice': {'entries':['serial_no']},
|
||||
'Stock Entry': {'mtn_details':['serial_no']},
|
||||
'Stock Ledger Entry': {'fields':['serial_no']}
|
||||
},
|
||||
'fs_item_barcode': {
|
||||
'Item': {'fields': ['barcode']},
|
||||
'Delivery Note': {'delivery_note_details': ['barcode']},
|
||||
'Sales Invoice': {'entries': ['barcode']}
|
||||
},
|
||||
'fs_item_group_in_details': {
|
||||
'Delivery Note': {'delivery_note_details':['item_group']},
|
||||
'Opportunity': {'enquiry_details':['item_group']},
|
||||
'Purchase Request': {'indent_details':['item_group']},
|
||||
'Item': {'fields':['item_group']},
|
||||
'Global Defaults': {'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']},
|
||||
'Sales Invoice': {'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']},
|
||||
'Purchase Request': {'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']},
|
||||
'Sales Invoice': {'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','amount','basic_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','amount','basic_rate']},
|
||||
'Sales Invoice': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','amount','basic_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','amount','basic_rate']}
|
||||
},
|
||||
'fs_imports': {
|
||||
'Purchase Invoice': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['purchase_ref_rate', 'amount','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':['purchase_ref_rate', 'amount','purchase_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':['purchase_ref_rate','amount','purchase_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']},
|
||||
'Sales Invoice': {'fields':['sales_team']},
|
||||
'Sales Order': {'fields':['sales_team','Packing List']}
|
||||
},
|
||||
'fs_more_info': {
|
||||
'Delivery Note': {'fields':['More Info']},
|
||||
'Opportunity': {'fields':['More Info']},
|
||||
'Purchase Request': {'fields':['More Info']},
|
||||
'Lead': {'fields':['More Info']},
|
||||
'Purchase Invoice': {'fields':['More Info']},
|
||||
'Purchase Order': {'fields':['More Info']},
|
||||
'Purchase Receipt': {'fields':['More Info']},
|
||||
'Quotation': {'fields':['More Info']},
|
||||
'Sales Invoice': {'fields':['More Info']},
|
||||
'Sales Order': {'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': {
|
||||
'Sales Invoice': {'fields':['is_pos']}
|
||||
},
|
||||
'fs_recurring_invoice': {
|
||||
'Sales Invoice': {'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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
118
startup/js/modules.js
Normal file
118
startup/js/modules.js
Normal file
@@ -0,0 +1,118 @@
|
||||
// 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/>.
|
||||
|
||||
wn.provide('erpnext.module_page');
|
||||
|
||||
erpnext.module_page.setup_page = function(module, wrapper) {
|
||||
erpnext.module_page.hide_links(wrapper);
|
||||
erpnext.module_page.make_list(module, wrapper);
|
||||
$(wrapper).find("a[title]").tooltip({
|
||||
delay: { show: 500, hide: 100 }
|
||||
});
|
||||
}
|
||||
|
||||
// hide list links where the user does
|
||||
// not have read permissions
|
||||
|
||||
erpnext.module_page.hide_links = function(wrapper) {
|
||||
// lists
|
||||
$(wrapper).find('[href*="List/"]').each(function() {
|
||||
var href = $(this).attr('href');
|
||||
var dt = href.split('/')[1];
|
||||
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
|
||||
var txt = $(this).text();
|
||||
$(this).parent().css('color', '#999').html(txt);
|
||||
}
|
||||
});
|
||||
|
||||
// reports
|
||||
$(wrapper).find('[data-doctype]').each(function() {
|
||||
var dt = $(this).attr('data-doctype');
|
||||
if(wn.boot.profile.all_read.indexOf(dt)==-1) {
|
||||
var txt = $(this).text();
|
||||
$(this).parent().css('color', '#999').html(txt);
|
||||
}
|
||||
});
|
||||
|
||||
// single (forms)
|
||||
$(wrapper).find('[href*="Form/"]').each(function() {
|
||||
var href = $(this).attr('href');
|
||||
var dt = href.split('/')[1];
|
||||
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
|
||||
var txt = $(this).text();
|
||||
$(this).parent().css('color', '#999').html(txt);
|
||||
}
|
||||
});
|
||||
|
||||
// pages
|
||||
$(wrapper).find('[data-role]').each(function() {
|
||||
if(!has_common(user_roles, [$(this).attr("data-role"), "System Manager"])) {
|
||||
var html = $(this).html();
|
||||
$(this).parent().css('color', '#999');
|
||||
$(this).replaceWith(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// make list of reports
|
||||
|
||||
erpnext.module_page.make_list = function(module, wrapper) {
|
||||
// make project listing
|
||||
var $w = $(wrapper).find('.reports-list');
|
||||
var $parent1 = $('<div style="width: 45%; float: left; margin-right: 4.5%"></div>').appendTo($w);
|
||||
var $parent2 = $('<div style="width: 45%; float: left;"></div>').appendTo($w);
|
||||
|
||||
wrapper.list1 = new wn.ui.Listing({
|
||||
parent: $parent1,
|
||||
method: 'utilities.get_sc_list',
|
||||
render_row: function(row, data) {
|
||||
if(!data.parent_doc_type) data.parent_doc_type = data.doc_type;
|
||||
$(row).html(repl('<a href="#!Report/%(doc_type)s/%(criteria_name)s" \
|
||||
data-doctype="%(parent_doc_type)s">\
|
||||
%(criteria_name)s</a>', data))
|
||||
},
|
||||
args: { module: module },
|
||||
no_refresh: true,
|
||||
callback: function(r) {
|
||||
erpnext.module_page.hide_links($parent1)
|
||||
}
|
||||
});
|
||||
wrapper.list1.run();
|
||||
|
||||
wrapper.list2 = new wn.ui.Listing({
|
||||
parent: $parent2,
|
||||
method: 'utilities.get_report_list',
|
||||
render_row: function(row, data) {
|
||||
$(row).html(repl('<a href="#!Report2/%(ref_doctype)s/%(name)s" \
|
||||
data-doctype="%(ref_doctype)s">\
|
||||
%(name)s</a>', data))
|
||||
},
|
||||
args: { module: module },
|
||||
no_refresh: true,
|
||||
callback: function(r) {
|
||||
erpnext.module_page.hide_links($parent2)
|
||||
}
|
||||
});
|
||||
wrapper.list2.run();
|
||||
|
||||
// show link to all reports
|
||||
$parent1.find('.list-toolbar-wrapper')
|
||||
.prepend("<div class=\"show-all-reports\">\
|
||||
<a href=\"#List/Search Criteria\"> [ List Of All Reports ]</a></div>");
|
||||
$parent2.find('.list-toolbar-wrapper')
|
||||
.prepend("<div class=\"show-all-reports\">\
|
||||
<a href=\"#List/Report\"> [ List Of All Reports (New) ]</a></div>");
|
||||
}
|
||||
109
startup/js/toolbar.js
Normal file
109
startup/js/toolbar.js
Normal file
@@ -0,0 +1,109 @@
|
||||
// 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/>.
|
||||
|
||||
/* toolbar settings */
|
||||
wn.provide('erpnext.toolbar');
|
||||
|
||||
erpnext.toolbar.setup = function() {
|
||||
// modules
|
||||
erpnext.toolbar.add_modules();
|
||||
|
||||
// profile
|
||||
$('#toolbar-user').append('<li><a href="#!profile-settings">Profile Settings</a></li>');
|
||||
|
||||
$('.navbar .pull-right').append('\
|
||||
<li><a href="#!messages" title="Unread Messages"><span class="navbar-new-comments"></span></a></li>');
|
||||
|
||||
// help
|
||||
$('.navbar .pull-right').prepend('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
||||
onclick="return false;">Help<b class="caret"></b></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-help">\
|
||||
</ul></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="https://erpnext.com/manual" target="_blank">\
|
||||
Documentation</a></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="http://groups.google.com/group/erpnext-user-forum" target="_blank">\
|
||||
Forum</a></li>')
|
||||
|
||||
$('#toolbar-help').append('<li><a href="http://www.providesupport.com?messenger=iwebnotes" target="_blank">\
|
||||
Live Chat (Office Hours)</a></li>')
|
||||
|
||||
erpnext.toolbar.set_new_comments();
|
||||
}
|
||||
|
||||
erpnext.toolbar.add_modules = function() {
|
||||
$('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"\
|
||||
onclick="return false;">Modules<b class="caret"></b></a>\
|
||||
<ul class="dropdown-menu modules">\
|
||||
</ul>\
|
||||
</li>').prependTo('.navbar .nav:first');
|
||||
|
||||
// if no modules list then show all
|
||||
if(wn.boot.modules_list && typeof(wn.boot.modules_list) == 'string') {
|
||||
wn.boot.modules_list = JSON.parse(wn.boot.modules_list);
|
||||
}
|
||||
else
|
||||
wn.boot.modules_list = keys(erpnext.modules).sort();
|
||||
|
||||
// add to dropdown
|
||||
for(var i in wn.boot.modules_list) {
|
||||
var m = wn.boot.modules_list[i]
|
||||
|
||||
if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1) {
|
||||
args = {
|
||||
module: m,
|
||||
module_page: erpnext.modules[m],
|
||||
module_label: m=='HR' ? 'Human Resources' : m
|
||||
}
|
||||
|
||||
$('.navbar .modules').append(repl('<li><a href="#!%(module_page)s" \
|
||||
data-module="%(module)s">%(module_label)s</a></li>', args));
|
||||
}
|
||||
}
|
||||
|
||||
// dasboard for accounts system manager
|
||||
if(user_roles.indexOf("Accounts Manager")!=-1) {
|
||||
$('.navbar .modules').append('<li><a href="#!dashboard" \
|
||||
data-module="Dashboard">Dashboard</a></li>');
|
||||
}
|
||||
|
||||
// setup for system manager
|
||||
if(user_roles.indexOf("System Manager")!=-1) {
|
||||
$('.navbar .modules').append('<li class="divider"></li>\
|
||||
<li><a href="#!Setup" data-module="Setup">Setup</a></li>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
erpnext.toolbar.set_new_comments = function(new_comments) {
|
||||
var navbar_nc = $('.navbar-new-comments');
|
||||
if(new_comments && new_comments.length>0) {
|
||||
navbar_nc.text(new_comments.length);
|
||||
navbar_nc.addClass('navbar-new-comments-true')
|
||||
$.each(new_comments, function(i, v) {
|
||||
var msg = 'New Message: ' + (v[1].length<=100 ? v[1] : (v[1].substr(0, 100) + "..."));
|
||||
var id = v[0].replace('/', '-');
|
||||
if(!$('#' + id)[0]) { show_alert(msg, id); }
|
||||
})
|
||||
} else {
|
||||
navbar_nc.removeClass('navbar-new-comments-true');
|
||||
navbar_nc.text(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user