brotherton-erpnext/erpnext/public/js/feature_setup.js

228 lines
9.3 KiB
JavaScript
Raw Normal View History

// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
2012-02-23 07:05:32 +00:00
2012-01-24 09:03:21 +00:00
/* features setup "Dictionary", "Script"
Dictionary Format
'projects': {
'Sales Order': {
'fields':['project_name'],
'items':['projected_qty']
2012-01-24 09:03:21 +00:00
},
'Purchase Order': {
'fields':['project_name']
}
}
// ====================================================================*/
frappe.provide("erpnext.feature_setup");
erpnext.feature_setup.feature_dict = {
2012-01-24 09:03:21 +00:00
'fs_projects': {
2012-03-30 06:59:06 +00:00
'BOM': {'fields':['project_name']},
2012-01-24 09:03:21 +00:00
'Delivery Note': {'fields':['project_name']},
'Purchase Invoice': {'items':['project_name']},
2012-01-24 09:03:21 +00:00
'Production Order': {'fields':['project_name']},
'Purchase Order': {'items':['project_name']},
'Purchase Receipt': {'items':['project_name']},
2012-03-30 06:59:06 +00:00
'Sales Invoice': {'fields':['project_name']},
2012-01-24 09:03:21 +00:00
'Sales Order': {'fields':['project_name']},
'Stock Entry': {'fields':['project_name']},
'Timesheet': {'timesheet_details':['project_name']}
},
'fs_discounts': {
'Delivery Note': {'items':['discount_percentage']},
'Quotation': {'items':['discount_percentage']},
'Sales Invoice': {'items':['discount_percentage']},
'Sales Order': {'items':['discount_percentage','price_list_rate']}
2012-01-24 09:03:21 +00:00
},
'fs_purchase_discounts': {
'Purchase Order': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
'Purchase Receipt': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
'Purchase Invoice': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']}
2012-01-24 09:03:21 +00:00
},
'fs_brands': {
'Delivery Note': {'items':['brand']},
'Material Request': {'items':['brand']},
2012-01-24 09:03:21 +00:00
'Item': {'fields':['brand']},
'Purchase Order': {'items':['brand']},
'Purchase Invoice': {'items':['brand']},
'Quotation': {'items':['brand']},
'Sales Invoice': {'items':['brand']},
2012-01-24 09:03:21 +00:00
'Sales BOM': {'fields':['new_item_brand']},
'Sales Order': {'items':['brand']},
2012-01-24 09:03:21 +00:00
'Serial No': {'fields':['brand']}
},
'fs_after_sales_installations': {
'Delivery Note': {'fields':['installation_status','per_installed'],'items':['installed_qty']}
2012-01-24 09:03:21 +00:00
},
'fs_item_batch_nos': {
'Delivery Note': {'items':['batch_no']},
2012-01-24 09:03:21 +00:00
'Item': {'fields':['has_batch_no']},
'Purchase Receipt': {'items':['batch_no']},
2012-03-30 06:59:06 +00:00
'Quality Inspection': {'fields':['batch_no']},
2012-01-24 09:03:21 +00:00
'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
'Sales Invoice': {'items':['batch_no']},
'Stock Entry': {'items':['batch_no']},
2012-01-24 09:03:21 +00:00
'Stock Ledger Entry': {'fields':['batch_no']}
},
'fs_item_serial_nos': {
'Warranty Claim': {'fields':['serial_no']},
'Delivery Note': {'items':['serial_no'],'packed_items':['serial_no']},
'Installation Note': {'items':['serial_no']},
2012-01-24 09:03:21 +00:00
'Item': {'fields':['has_serial_no']},
'Maintenance Schedule': {'items':['serial_no'],'schedules':['serial_no']},
'Maintenance Visit': {'purposes':['serial_no']},
'Purchase Receipt': {'items':['serial_no']},
2012-03-30 06:59:06 +00:00
'Quality Inspection': {'fields':['item_serial_no']},
2012-01-24 09:03:21 +00:00
'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
'Sales Invoice': {'items':['serial_no']},
'Stock Entry': {'items':['serial_no']},
2012-01-24 09:03:21 +00:00
'Stock Ledger Entry': {'fields':['serial_no']}
},
2012-06-07 13:39:17 +00:00
'fs_item_barcode': {
'Item': {'fields': ['barcode']},
'Delivery Note': {'items': ['barcode']},
2015-02-25 13:30:51 +00:00
'Sales Invoice': {'items': ['barcode']},
2015-06-08 12:26:22 +00:00
'Stock Entry': {'items': ['barcode']},
'Purchase Receipt': {'items': ['barcode']}
2012-06-07 13:39:17 +00:00
},
2012-01-24 09:03:21 +00:00
'fs_item_group_in_details': {
'Delivery Note': {'items':['item_group']},
'Opportunity': {'items':['item_group']},
'Material Request': {'items':['item_group']},
2012-01-24 09:03:21 +00:00
'Item': {'fields':['item_group']},
2012-03-30 06:59:06 +00:00
'Global Defaults': {'fields':['default_item_group']},
'Purchase Order': {'items':['item_group']},
'Purchase Receipt': {'items':['item_group']},
'Purchase Voucher': {'items':['item_group']},
'Quotation': {'items':['item_group']},
'Sales Invoice': {'items':['item_group']},
2012-01-24 09:03:21 +00:00
'Sales BOM': {'fields':['serial_no']},
'Sales Order': {'items':['item_group']},
2012-01-24 09:03:21 +00:00
'Serial No': {'fields':['item_group']},
'Sales Partner': {'targets':['item_group']},
'Sales Person': {'targets':['item_group']},
'Territory': {'targets':['item_group']}
2012-01-24 09:03:21 +00:00
},
'fs_page_break': {
'Delivery Note': {'items':['page_break'],'packed_items':['page_break']},
'Material Request': {'items':['page_break']},
'Purchase Order': {'items':['page_break']},
'Purchase Receipt': {'items':['page_break']},
'Purchase Voucher': {'items':['page_break']},
'Quotation': {'items':['page_break']},
'Sales Invoice': {'items':['page_break']},
'Sales Order': {'items':['page_break']}
2012-01-24 09:03:21 +00:00
},
'fs_exports': {
'Delivery Note': {
'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
},
'POS Profile': {'fields':['conversion_rate','currency']},
'Quotation': {
'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
},
'Sales Invoice': {
'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
},
2012-01-24 09:03:21 +00:00
'Sales BOM': {'fields':['currency']},
'Sales Order': {
'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
}
2012-01-24 09:03:21 +00:00
},
2014-05-02 10:15:10 +00:00
2012-01-24 09:03:21 +00:00
'fs_imports': {
2013-01-28 11:26:07 +00:00
'Purchase Invoice': {
'fields': ['conversion_rate', 'currency', 'base_grand_total', 'base_discount_amount',
'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
2013-01-28 11:26:07 +00:00
},
'Purchase Order': {
'fields': ['conversion_rate','currency', 'base_grand_total', 'base_discount_amount',
'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
2013-01-28 11:26:07 +00:00
},
'Purchase Receipt': {
'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
'base_total_taxes_and_charges', 'base_discount_amount'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
2013-01-28 11:26:07 +00:00
},
'Supplier Quotation': {
'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
'base_total_taxes_and_charges', 'base_discount_amount'],
'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
2013-01-28 11:26:07 +00:00
}
2012-01-24 09:03:21 +00:00
},
2014-05-02 10:15:10 +00:00
2012-01-24 09:03:21 +00:00
'fs_item_advanced': {
2014-12-26 06:11:15 +00:00
'Item': {'fields':['customer_items']}
2012-01-24 09:03:21 +00:00
},
'fs_sales_extras': {
'Address': {'fields':['sales_partner']},
'Contact': {'fields':['sales_partner']},
'Customer': {'fields':['sales_team']},
2014-08-21 10:54:49 +00:00
'Delivery Note': {'fields':['sales_team']},
2014-12-26 06:11:15 +00:00
'Item': {'fields':['customer_items']},
2014-08-21 10:54:49 +00:00
'Sales Invoice': {'fields':['sales_team']},
'Sales Order': {'fields':['sales_team']}
2012-01-24 09:03:21 +00:00
},
'fs_more_info': {
"Warranty Claim": {"fields": ["more_info"]},
2013-03-14 04:37:59 +00:00
'Material Request': {'fields':['more_info']},
'Lead': {'fields':['more_info']},
'Opportunity': {'fields':['more_info']},
'Purchase Invoice': {'fields':['more_info']},
'Purchase Order': {'fields':['more_info']},
'Purchase Receipt': {'fields':['more_info']},
'Supplier Quotation': {'fields':['more_info']},
'Quotation': {'fields':['more_info']},
'Sales Invoice': {'fields':['more_info']},
'Sales Order': {'fields':['more_info']},
'Delivery Note': {'fields':['more_info']},
2012-01-24 09:03:21 +00:00
},
'fs_quality': {
2013-07-18 09:34:29 +00:00
'Item': {'fields':['inspection_criteria','inspection_required']},
'Purchase Receipt': {'items':['qa_no']}
2012-01-24 09:03:21 +00:00
},
'fs_manufacturing': {
2013-07-18 09:34:29 +00:00
'Item': {'fields':['manufacturing']}
2012-01-24 09:03:21 +00:00
},
'fs_pos': {
2012-03-30 06:59:06 +00:00
'Sales Invoice': {'fields':['is_pos']}
2012-01-24 09:03:21 +00:00
},
'fs_recurring_invoice': {
2013-07-18 09:34:29 +00:00
'Sales Invoice': {'fields': ['recurring_invoice']}
2012-01-24 09:03:21 +00:00
}
}
$(document).bind('form_refresh', function() {
var feature_dict = erpnext.feature_setup.feature_dict;
2013-07-18 09:34:29 +00:00
for(var sys_feat in sys_defaults) {
2014-05-02 10:15:10 +00:00
if(sys_defaults[sys_feat]=='0'
&& (sys_feat in feature_dict)) { //"Features to hide" exists
if(cur_frm.doc.doctype in feature_dict[sys_feat]) {
for(var fort in feature_dict[sys_feat][cur_frm.doc.doctype]) {
2013-03-14 04:37:59 +00:00
if(fort=='fields') {
hide_field(feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
2013-03-14 04:37:59 +00:00
} else if(cur_frm.fields_dict[fort]) {
cur_frm.fields_dict[fort].grid.set_column_disp(feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);
2013-03-14 04:37:59 +00:00
} else {
2014-04-14 10:55:30 +00:00
msgprint(__('Grid "')+fort+__('" does not exists'));
2013-03-14 04:37:59 +00:00
}
2012-01-24 09:03:21 +00:00
}
}
2013-03-14 04:37:59 +00:00
2012-01-24 09:03:21 +00:00
}
}
})