diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js
index 47c8c34418..e684bed1bf 100644
--- a/selling/doctype/sales_order/sales_order.js
+++ b/selling/doctype/sales_order/sales_order.js
@@ -70,7 +70,6 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
} else {
hide_field(['Repair Sales Order', 'Send SMS', 'message', 'customer_mobile_no'])
}
- pscript.apply_feature_settings();
}
//customer
diff --git a/setup/doctype/features_setup/__init__.py b/setup/doctype/features_setup/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/setup/doctype/features_setup/features_setup.py b/setup/doctype/features_setup/features_setup.py
new file mode 100644
index 0000000000..3a549d9e32
--- /dev/null
+++ b/setup/doctype/features_setup/features_setup.py
@@ -0,0 +1,13 @@
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
+
+ def validate(self):
+ """
+ update settings in defaults
+ """
+ from webnotes.model import default_fields
+ from webnotes.utils import set_default
+ for key in self.doc.fields:
+ if key not in default_fields:
+ set_default(key, self.doc.fields[key])
diff --git a/setup/doctype/features_setup/features_setup.txt b/setup/doctype/features_setup/features_setup.txt
new file mode 100644
index 0000000000..491cb8d203
--- /dev/null
+++ b/setup/doctype/features_setup/features_setup.txt
@@ -0,0 +1,152 @@
+# DocType, Features Setup
+[
+
+ # These values are common in all dictionaries
+ {
+ 'creation': '2011-08-25 16:53:56',
+ 'docstatus': 0,
+ 'modified': '2011-08-29 13:16:51',
+ 'modified_by': 'Administrator',
+ 'owner': 'Administrator'
+ },
+
+ # These values are common for all DocType
+ {
+ '_last_update': '1314601410',
+ 'colour': 'White:FFF',
+ 'doctype': 'DocType',
+ 'issingle': 1,
+ 'module': 'Setup',
+ 'name': '__common__',
+ 'section_style': 'Simple',
+ 'show_in_menu': 1,
+ 'version': 6
+ },
+
+ # These values are common for all DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldtype': 'Check',
+ 'name': '__common__',
+ 'parent': 'Features Setup',
+ 'parentfield': 'fields',
+ 'parenttype': 'DocType',
+ 'permlevel': 0
+ },
+
+ # These values are common for all DocPerm
+ {
+ 'create': 1,
+ 'doctype': 'DocPerm',
+ 'name': '__common__',
+ 'parent': 'Features Setup',
+ 'parentfield': 'permissions',
+ 'parenttype': 'DocType',
+ 'permlevel': 0,
+ 'read': 1,
+ 'write': 1
+ },
+
+ # DocType, Features Setup
+ {
+ 'doctype': 'DocType',
+ 'name': 'Features Setup'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'System Manager'
+ },
+
+ # DocPerm
+ {
+ 'doctype': 'DocPerm',
+ 'role': 'Administrator'
+ },
+
+ # DocField
+ {
+ 'description': 'Available in \nBill Of Materials, Delivery Note, Payable Voucher, Production Order, Purchase Order, Purchase Receipt, Receivable Voucher, Sales Order, Stock Entry, Timesheet',
+ 'doctype': 'DocField',
+ 'fieldname': 'projects',
+ 'label': 'Projects'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Available in Delivery Note and Sales Order',
+ 'doctype': 'DocField',
+ 'fieldname': 'packing_details',
+ 'label': 'Packing Detials'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Available in Delivery Note, Quotation, Receivable Voucher, Sales Order',
+ 'doctype': 'DocField',
+ 'fieldname': 'discounts',
+ 'label': 'Discounts'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'description': 'Availble in Delivery Note, Enuiry, Indent, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Receivable Voucher, Sales BOM, Sales Order, Serial No',
+ 'doctype': 'DocField',
+ 'fieldname': 'brands',
+ 'label': 'Brands'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'after_sale_installations',
+ 'label': 'After Sale Installations'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'warehouses',
+ 'label': 'Warehouses'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_batch_nos',
+ 'label': 'Item Batch Nos'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_searial_nos',
+ 'label': 'Item Serial Nos'
+ },
+
+ # DocField
+ {
+ 'colour': 'White:FFF',
+ 'doctype': 'DocField',
+ 'fieldname': 'page_break',
+ 'label': 'Page Break'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'item_groups_in_groups',
+ 'label': 'Item Groups in Details'
+ },
+
+ # DocField
+ {
+ 'doctype': 'DocField',
+ 'fieldname': 'ref_rates',
+ 'label': 'Ref Rates'
+ }
+]
\ No newline at end of file
diff --git a/startup/startup.js b/startup/startup.js
index 5a2a816e89..13be705261 100644
--- a/startup/startup.js
+++ b/startup/startup.js
@@ -12,8 +12,8 @@ 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)
-
-
+
+
if(get_url_arg('embed')) {
// hide header, footer
$dh(page_body.banner_area);
@@ -34,7 +34,7 @@ function startup_setup() {
$td(page_body.wntoolbar.body_tab,0,0).innerHTML = 'erpnext';
$y($td(page_body.wntoolbar.body_tab,0,0), {width:'140px', color:'#FFF', paddingLeft:'8px', paddingRight:'8px', fontSize:'14px'})
$dh(page_body.banner_area);
-
+
// sidebar
// -------
pscript.startup_make_sidebar();
@@ -65,10 +65,10 @@ pscript.startup_make_sidebar = function() {
var callback = function(r,rt) {
// menu
var ml = r.message;
-
+
// clear
page_body.left_sidebar.innerHTML = '';
-
+
for(var m=0; mNote: These changes will apply to all users!', ml, update_order, 1);
}
$c_obj('Home Control', 'get_module_order', '', callback)
-
+
}
// ====================================================================
@@ -437,7 +437,7 @@ pscript.startup_setup_toolbar = function() {
// Profile
// ---------
$td(menu_tab,0,0).innerHTML = ''+user_fullname+'';
-
+
if(pscript.is_erpnext_saas){
// Help
// --------------
@@ -474,7 +474,7 @@ show_chart_browser = function(nm, chart_type){
var call_back = function(){
if(nm == 'Sales Browser'){
var sb_obj = new SalesBrowser();
- sb_obj.set_val(chart_type);
+ sb_obj.set_val(chart_type);
}
else if(nm == 'Accounts Browser')
pscript.make_chart(chart_type);
@@ -501,7 +501,7 @@ ModulePage = function(parent, module_name, module_label, help_page, callback) {
var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
btn.help_page = help_page;
}
-
+
if(callback) this.callback = function(){ callback(); }
}
@@ -517,12 +517,12 @@ get_plural = function(str){
// 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(); });
}
@@ -530,7 +530,7 @@ pscript.set_user_fullname = function(ele,username,get_latest){
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(); });
}
@@ -539,4 +539,166 @@ pscript.set_user_fullname = function(ele,username,get_latest){
// ====================================================================
startup_setup();
-$(document).bind('form_refresh', function() { })
\ No newline at end of file
+/* 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 = {
+ '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']}
+ },
+ 'packing_details': {
+ 'Delivery Note': {'fields':['packing_details','print_packing_slip'],'delivery_note_details':['no_of_packs','pack_gross_wt','pack_nett_wt','pack_no','pack_unit']},
+ 'Sales Order': {'fields':['packing_details']}
+ },
+ 'discounts': {
+ 'Delivery Note': {'delivery_note_details':['adj_rate']},
+ 'Quotation': {'quotation_details':['adj_rate']},
+ 'Receivable Voucher': {'rv_details':['adj_rate']},
+ 'Sales Order': {'sale_order_details':['adj_rate']}
+ },
+ 'brands': {
+ 'Delivery Note': {'delivery_note_details':['brand']},
+ 'Enquiry': {'enquiry_details':['brand']},
+ 'Indent': {'indent_details':['brand']},
+ 'Item': {'fields':['brand']},
+ 'Purchase Order': {'po_details':['brand']},
+ 'Purchase Receipt': {'purchase_receipt_details':['brand']},
+ 'Payable Voucher': {'pv_details':['brand']},
+ 'Quotation': {'quotation_details':['brand']},
+ 'Receivable Voucher': {'rv_details':['brand']},
+ 'Sales BOM': {'fields':['new_item_brand']},
+ 'Sales Order': {'sales_order_details':['brand']},
+ 'Serial No': {'fields':['brand']}
+ },
+ 'after_sale_installations': {
+ 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']}
+ },
+ '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': {'rv_details':['batch_no']},
+ 'Stock Entry': {'stock_entry_details':['batch_no']},
+ 'Stock Ledger Entry': {'fields':['batch_no']}
+ },
+ 'item_serial_nos': {
+ 'Customer Issue': {'fields':['serial_no']},
+ 'Delivery Note': {'delivery_note_details':['serial_no'],'delivery_note_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': {'rv_details':['serial_no']},
+ 'Stock Entry': {'stock_entry_details':['serial_no']},
+ 'Stock Ledger Entry': {'fields':['serial_no']}
+ },
+ 'item_groups_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': {'pv_details':['item_group']},
+ 'Quotation': {'quotation_details':['item_group']},
+ 'Receivable Voucher': {'rv_details':['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']}
+ },
+ 'page_break': {
+ 'Delivery Note': {'delivery_note_details':['page_break'],'delivery_note_packing_details':['page_break']},
+ 'Indent': {'indent_details':['page_break']},
+ 'Purchase Order': {'po_details':['page_break']},
+ 'Purchase Receipt': {'purchase_receipt_details':['page_break']},
+ 'Purchase Voucher': {'pv_details':['page_break']},
+ 'Quotation': {'quotation_details':['page_break']},
+ 'Receivable Voucher': {'rv_details':['page_break']},
+ 'Sales Order': {'sales_order_details':['page_break']}
+ },
+ 'multi_currency': {
+ 'Delivery Note': {'fields':['currency','conversion_rate']},
+ 'Payable Voucher': {'fields':['currency','conversion_rate']},
+ 'POS Setting': {'fields':['currency','conversion_rate']},
+ 'Purchase Order': {'fields':['currency','conversion_rate']},
+ 'Purchase Receipt': {'fields':['currency','conversion_rate']},
+ 'Quotation': {'fields':['currency','conversion_rate']},
+ 'Receivable Voucher': {'fields':['currency','conversion_rate']},
+ 'Quotation': {'fields':['currency','conversion_rate']},
+ 'Item': {'ref_rate_details':['currency']},
+ 'Sales BOM': {'fields':['currency']},
+ 'Sales Order': {'fields':['currency','conversion_rate']},
+ 'Supplier Quotation': {'fields':['currency','conversion_rate']}
+ },
+ 'exports': {
+ 'Delivery Note': {'fields':['currency','conversion_rate','Note','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate',]},
+ 'POS Setting': {'fields':['currency','conversion_rate']},
+ 'Quotation': {'fields':['currency','conversion_rate']},
+ 'Receivable Voucher': {'fields':['currency','conversion_rate']},
+ 'Quotation': {'fields':['currency','conversion_rate']},
+ 'Item': {'ref_rate_details':['currency']},
+ 'Sales BOM': {'fields':['currency']},
+ 'Sales Order': {'fields':['currency','conversion_rate']},
+ 'Supplier Quotation': {'fields':['currency','conversion_rate']}
+ },
+ 'imports': {
+ 'Payable Voucher': {'fields':['currency','conversion_rate']},
+ 'Purchase Order': {'fields':['currency','conversion_rate']},
+ 'Purchase Receipt': {'fields':['currency','conversion_rate']},
+ 'Receivable Voucher': {'fields':['currency','conversion_rate']},
+ 'Supplier Quotation': {'fields':['currency','conversion_rate']}
+ }
+
+}
+
+$(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
+ {
+ for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort])
+ if(cur_frm.fields_dict[fort])
+ cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false);
+ else
+ alert('Grid "'+fort+'" does not exists');
+ }
+ }
+ }
+ }
+ }
+})