blob: d43ffc5d5987b3a2b836bac24e9d230a55d15f73 [file] [log] [blame]
Anand Doshi885e0742015-03-03 14:55:30 +05301// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05302// License: GNU General Public License v3. See license.txt
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05303
Rushabh Mehta865c00a2012-01-24 14:33:21 +05304/* features setup "Dictionary", "Script"
5Dictionary Format
6 'projects': {
7 'Sales Order': {
8 'fields':['project_name'],
Nabin Haite7d15362014-12-25 16:01:55 +05309 'items':['projected_qty']
Rushabh Mehta865c00a2012-01-24 14:33:21 +053010 },
11 'Purchase Order': {
12 'fields':['project_name']
13 }
14 }
15// ====================================================================*/
Anand Doshiaff9a592015-01-29 19:49:34 +053016frappe.provide("erpnext.feature_setup");
17erpnext.feature_setup.feature_dict = {
Rushabh Mehta865c00a2012-01-24 14:33:21 +053018 'fs_projects': {
Anand Doshifedfd892012-03-30 12:29:06 +053019 'BOM': {'fields':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053020 'Delivery Note': {'fields':['project_name']},
Nabin Haite7d15362014-12-25 16:01:55 +053021 'Purchase Invoice': {'items':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053022 'Production Order': {'fields':['project_name']},
Nabin Haite7d15362014-12-25 16:01:55 +053023 'Purchase Order': {'items':['project_name']},
24 'Purchase Receipt': {'items':['project_name']},
Anand Doshifedfd892012-03-30 12:29:06 +053025 'Sales Invoice': {'fields':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053026 'Sales Order': {'fields':['project_name']},
27 'Stock Entry': {'fields':['project_name']},
28 'Timesheet': {'timesheet_details':['project_name']}
29 },
Rushabh Mehta865c00a2012-01-24 14:33:21 +053030 'fs_discounts': {
Nabin Haite7d15362014-12-25 16:01:55 +053031 'Delivery Note': {'items':['discount_percentage']},
32 'Quotation': {'items':['discount_percentage']},
33 'Sales Invoice': {'items':['discount_percentage']},
34 'Sales Order': {'items':['discount_percentage','price_list_rate']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +053035 },
36 'fs_purchase_discounts': {
Nabin Haite7d15362014-12-25 16:01:55 +053037 'Purchase Order': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
38 'Purchase Receipt': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']},
39 'Purchase Invoice': {'items':['base_price_list_rate', 'discount_percentage', 'price_list_rate']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +053040 },
41 'fs_brands': {
Nabin Haite7d15362014-12-25 16:01:55 +053042 'Delivery Note': {'items':['brand']},
43 'Material Request': {'items':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053044 'Item': {'fields':['brand']},
Nabin Haite7d15362014-12-25 16:01:55 +053045 'Purchase Order': {'items':['brand']},
46 'Purchase Invoice': {'items':['brand']},
47 'Quotation': {'items':['brand']},
48 'Sales Invoice': {'items':['brand']},
Neil Trini Lasradoed8cecb2015-07-07 13:59:23 +053049 'Product Bundle': {'fields':['new_item_brand']},
Nabin Haite7d15362014-12-25 16:01:55 +053050 'Sales Order': {'items':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053051 'Serial No': {'fields':['brand']}
52 },
53 'fs_after_sales_installations': {
Nabin Haite7d15362014-12-25 16:01:55 +053054 'Delivery Note': {'fields':['installation_status','per_installed'],'items':['installed_qty']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +053055 },
56 'fs_item_batch_nos': {
Nabin Haite7d15362014-12-25 16:01:55 +053057 'Delivery Note': {'items':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053058 'Item': {'fields':['has_batch_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053059 'Purchase Receipt': {'items':['batch_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053060 'Quality Inspection': {'fields':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053061 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053062 'Sales Invoice': {'items':['batch_no']},
63 'Stock Entry': {'items':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053064 'Stock Ledger Entry': {'fields':['batch_no']}
65 },
66 'fs_item_serial_nos': {
Rushabh Mehta46e03ea2015-02-17 10:45:50 +053067 'Warranty Claim': {'fields':['serial_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053068 'Delivery Note': {'items':['serial_no'],'packed_items':['serial_no']},
69 'Installation Note': {'items':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053070 'Item': {'fields':['has_serial_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053071 'Maintenance Schedule': {'items':['serial_no'],'schedules':['serial_no']},
72 'Maintenance Visit': {'purposes':['serial_no']},
73 'Purchase Receipt': {'items':['serial_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053074 'Quality Inspection': {'fields':['item_serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053075 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053076 'Sales Invoice': {'items':['serial_no']},
77 'Stock Entry': {'items':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053078 'Stock Ledger Entry': {'fields':['serial_no']}
79 },
Nabin Hait2e3579a2012-06-07 19:09:17 +053080 'fs_item_barcode': {
81 'Item': {'fields': ['barcode']},
Nabin Haite7d15362014-12-25 16:01:55 +053082 'Delivery Note': {'items': ['barcode']},
Neil Trini Lasrado43746922015-02-25 19:00:51 +053083 'Sales Invoice': {'items': ['barcode']},
Neil Trini Lasradob2f550c2015-06-08 17:56:22 +053084 'Stock Entry': {'items': ['barcode']},
85 'Purchase Receipt': {'items': ['barcode']}
Nabin Hait2e3579a2012-06-07 19:09:17 +053086 },
Rushabh Mehta865c00a2012-01-24 14:33:21 +053087 'fs_item_group_in_details': {
Nabin Haite7d15362014-12-25 16:01:55 +053088 'Delivery Note': {'items':['item_group']},
89 'Opportunity': {'items':['item_group']},
90 'Material Request': {'items':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053091 'Item': {'fields':['item_group']},
Anand Doshifedfd892012-03-30 12:29:06 +053092 'Global Defaults': {'fields':['default_item_group']},
Nabin Haite7d15362014-12-25 16:01:55 +053093 'Purchase Order': {'items':['item_group']},
94 'Purchase Receipt': {'items':['item_group']},
95 'Purchase Voucher': {'items':['item_group']},
96 'Quotation': {'items':['item_group']},
97 'Sales Invoice': {'items':['item_group']},
Neil Trini Lasradoed8cecb2015-07-07 13:59:23 +053098 'Product Bundle': {'fields':['serial_no']},
Nabin Haite7d15362014-12-25 16:01:55 +053099 'Sales Order': {'items':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530100 'Serial No': {'fields':['item_group']},
Nabin Haite7d15362014-12-25 16:01:55 +0530101 'Sales Partner': {'targets':['item_group']},
102 'Sales Person': {'targets':['item_group']},
103 'Territory': {'targets':['item_group']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530104 },
105 'fs_page_break': {
Nabin Haite7d15362014-12-25 16:01:55 +0530106 'Delivery Note': {'items':['page_break'],'packed_items':['page_break']},
107 'Material Request': {'items':['page_break']},
108 'Purchase Order': {'items':['page_break']},
109 'Purchase Receipt': {'items':['page_break']},
110 'Purchase Voucher': {'items':['page_break']},
111 'Quotation': {'items':['page_break']},
112 'Sales Invoice': {'items':['page_break']},
113 'Sales Order': {'items':['page_break']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530114 },
115 'fs_exports': {
Nabin Hait82e3e252015-02-23 16:58:30 +0530116 'Delivery Note': {
117 'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
118 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
119 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
120 },
Rushabh Mehtaa27cca92015-05-20 15:43:17 +0530121 'POS Profile': {'fields':['conversion_rate','currency']},
Nabin Hait82e3e252015-02-23 16:58:30 +0530122 'Quotation': {
123 'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
124 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
125 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
126 },
127 'Sales Invoice': {
128 'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
129 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
130 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
131 },
Neil Trini Lasradoed8cecb2015-07-07 13:59:23 +0530132 'Product Bundle': {'fields':['currency']},
Nabin Hait82e3e252015-02-23 16:58:30 +0530133 'Sales Order': {
134 'fields': ['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total',
135 'base_total', 'base_net_total', 'base_discount_amount', 'base_total_taxes_and_charges'],
136 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
137 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530138 },
Nabin Hait6b039142014-05-02 15:45:10 +0530139
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530140 'fs_imports': {
Nabin Hait23decac2013-01-28 16:56:07 +0530141 'Purchase Invoice': {
Nabin Hait82e3e252015-02-23 16:58:30 +0530142 'fields': ['conversion_rate', 'currency', 'base_grand_total', 'base_discount_amount',
143 'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
144 'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
145 'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
Nabin Hait23decac2013-01-28 16:56:07 +0530146 },
147 'Purchase Order': {
Nabin Hait82e3e252015-02-23 16:58:30 +0530148 'fields': ['conversion_rate','currency', 'base_grand_total', 'base_discount_amount',
149 'base_in_words', 'base_total', 'base_net_total', 'base_taxes_and_charges_added',
150 'base_taxes_and_charges_deducted', 'base_total_taxes_and_charges'],
151 'items': ['base_price_list_rate', 'base_amount','base_rate', 'base_net_rate', 'base_net_amount']
Nabin Hait23decac2013-01-28 16:56:07 +0530152 },
153 'Purchase Receipt': {
Nabin Hait82e3e252015-02-23 16:58:30 +0530154 'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
155 'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
156 'base_total_taxes_and_charges', 'base_discount_amount'],
157 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
Nabin Hait23decac2013-01-28 16:56:07 +0530158 },
159 'Supplier Quotation': {
Nabin Hait82e3e252015-02-23 16:58:30 +0530160 'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', 'base_total',
161 'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted',
162 'base_total_taxes_and_charges', 'base_discount_amount'],
163 'items': ['base_price_list_rate','base_amount','base_rate', 'base_net_rate', 'base_net_amount']
Nabin Hait23decac2013-01-28 16:56:07 +0530164 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530165 },
Nabin Hait6b039142014-05-02 15:45:10 +0530166
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530167 'fs_item_advanced': {
Nabin Hait79f091e2014-12-26 11:41:15 +0530168 'Item': {'fields':['customer_items']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530169 },
170 'fs_sales_extras': {
171 'Address': {'fields':['sales_partner']},
172 'Contact': {'fields':['sales_partner']},
173 'Customer': {'fields':['sales_team']},
Nabin Hait44175292014-08-21 16:24:49 +0530174 'Delivery Note': {'fields':['sales_team']},
Nabin Hait79f091e2014-12-26 11:41:15 +0530175 'Item': {'fields':['customer_items']},
Nabin Hait44175292014-08-21 16:24:49 +0530176 'Sales Invoice': {'fields':['sales_team']},
177 'Sales Order': {'fields':['sales_team']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530178 },
179 'fs_more_info': {
Rushabh Mehta46e03ea2015-02-17 10:45:50 +0530180 "Warranty Claim": {"fields": ["more_info"]},
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530181 'Material Request': {'fields':['more_info']},
182 'Lead': {'fields':['more_info']},
183 'Opportunity': {'fields':['more_info']},
184 'Purchase Invoice': {'fields':['more_info']},
185 'Purchase Order': {'fields':['more_info']},
186 'Purchase Receipt': {'fields':['more_info']},
187 'Supplier Quotation': {'fields':['more_info']},
188 'Quotation': {'fields':['more_info']},
189 'Sales Invoice': {'fields':['more_info']},
190 'Sales Order': {'fields':['more_info']},
191 'Delivery Note': {'fields':['more_info']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530192 },
193 'fs_quality': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530194 'Item': {'fields':['inspection_criteria','inspection_required']},
Nabin Haite7d15362014-12-25 16:01:55 +0530195 'Purchase Receipt': {'items':['qa_no']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530196 },
197 'fs_manufacturing': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530198 'Item': {'fields':['manufacturing']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530199 },
200 'fs_pos': {
Anand Doshifedfd892012-03-30 12:29:06 +0530201 'Sales Invoice': {'fields':['is_pos']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530202 },
203 'fs_recurring_invoice': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530204 'Sales Invoice': {'fields': ['recurring_invoice']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530205 }
206}
207
208$(document).bind('form_refresh', function() {
Anand Doshiaff9a592015-01-29 19:49:34 +0530209 var feature_dict = erpnext.feature_setup.feature_dict;
Nabin Haitd89a7332013-07-18 15:04:29 +0530210 for(var sys_feat in sys_defaults) {
Nabin Hait6b039142014-05-02 15:45:10 +0530211 if(sys_defaults[sys_feat]=='0'
Anand Doshiaff9a592015-01-29 19:49:34 +0530212 && (sys_feat in feature_dict)) { //"Features to hide" exists
213 if(cur_frm.doc.doctype in feature_dict[sys_feat]) {
214 for(var fort in feature_dict[sys_feat][cur_frm.doc.doctype]) {
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530215 if(fort=='fields') {
Anand Doshiaff9a592015-01-29 19:49:34 +0530216 hide_field(feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530217 } else if(cur_frm.fields_dict[fort]) {
Anand Doshiaff9a592015-01-29 19:49:34 +0530218 cur_frm.fields_dict[fort].grid.set_column_disp(feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530219 } else {
Pratik Vyasb52618c2014-04-14 16:25:30 +0530220 msgprint(__('Grid "')+fort+__('" does not exists'));
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530221 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530222 }
223 }
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530224
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530225 }
226 }
227})