Rushabh Mehta | ad45e31 | 2013-11-20 12:59:58 +0530 | [diff] [blame] | 1 | // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors |
Rushabh Mehta | e67d1fb | 2013-08-05 14:59:54 +0530 | [diff] [blame] | 2 | // License: GNU General Public License v3. See license.txt |
Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 3 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 4 | /* features setup "Dictionary", "Script" |
| 5 | Dictionary Format |
| 6 | 'projects': { |
| 7 | 'Sales Order': { |
| 8 | 'fields':['project_name'], |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 9 | 'items':['projected_qty'] |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 10 | }, |
| 11 | 'Purchase Order': { |
| 12 | 'fields':['project_name'] |
| 13 | } |
| 14 | } |
| 15 | // ====================================================================*/ |
Anand Doshi | aff9a59 | 2015-01-29 19:49:34 +0530 | [diff] [blame] | 16 | frappe.provide("erpnext.feature_setup"); |
| 17 | erpnext.feature_setup.feature_dict = { |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 18 | 'fs_projects': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 19 | 'BOM': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 20 | 'Delivery Note': {'fields':['project_name']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 21 | 'Purchase Invoice': {'items':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 22 | 'Production Order': {'fields':['project_name']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 23 | 'Purchase Order': {'items':['project_name']}, |
| 24 | 'Purchase Receipt': {'items':['project_name']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 25 | 'Sales Invoice': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 26 | 'Sales Order': {'fields':['project_name']}, |
| 27 | 'Stock Entry': {'fields':['project_name']}, |
| 28 | 'Timesheet': {'timesheet_details':['project_name']} |
| 29 | }, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 30 | 'fs_discounts': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 31 | '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 Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 35 | }, |
| 36 | 'fs_purchase_discounts': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 37 | '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 Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 40 | }, |
| 41 | 'fs_brands': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 42 | 'Delivery Note': {'items':['brand']}, |
| 43 | 'Material Request': {'items':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 44 | 'Item': {'fields':['brand']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 45 | 'Purchase Order': {'items':['brand']}, |
| 46 | 'Purchase Invoice': {'items':['brand']}, |
| 47 | 'Quotation': {'items':['brand']}, |
| 48 | 'Sales Invoice': {'items':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 49 | 'Sales BOM': {'fields':['new_item_brand']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 50 | 'Sales Order': {'items':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 51 | 'Serial No': {'fields':['brand']} |
| 52 | }, |
| 53 | 'fs_after_sales_installations': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 54 | 'Delivery Note': {'fields':['installation_status','per_installed'],'items':['installed_qty']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 55 | }, |
| 56 | 'fs_item_batch_nos': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 57 | 'Delivery Note': {'items':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 58 | 'Item': {'fields':['has_batch_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 59 | 'Purchase Receipt': {'items':['batch_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 60 | 'Quality Inspection': {'fields':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 61 | 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 62 | 'Sales Invoice': {'items':['batch_no']}, |
| 63 | 'Stock Entry': {'items':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 64 | 'Stock Ledger Entry': {'fields':['batch_no']} |
| 65 | }, |
| 66 | 'fs_item_serial_nos': { |
| 67 | 'Customer Issue': {'fields':['serial_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 68 | 'Delivery Note': {'items':['serial_no'],'packed_items':['serial_no']}, |
| 69 | 'Installation Note': {'items':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 70 | 'Item': {'fields':['has_serial_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 71 | 'Maintenance Schedule': {'items':['serial_no'],'schedules':['serial_no']}, |
| 72 | 'Maintenance Visit': {'purposes':['serial_no']}, |
| 73 | 'Purchase Receipt': {'items':['serial_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 74 | 'Quality Inspection': {'fields':['item_serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 75 | 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 76 | 'Sales Invoice': {'items':['serial_no']}, |
| 77 | 'Stock Entry': {'items':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 78 | 'Stock Ledger Entry': {'fields':['serial_no']} |
| 79 | }, |
Nabin Hait | 2e3579a | 2012-06-07 19:09:17 +0530 | [diff] [blame] | 80 | 'fs_item_barcode': { |
| 81 | 'Item': {'fields': ['barcode']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 82 | 'Delivery Note': {'items': ['barcode']}, |
| 83 | 'Sales Invoice': {'items': ['barcode']} |
Nabin Hait | 2e3579a | 2012-06-07 19:09:17 +0530 | [diff] [blame] | 84 | }, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 85 | 'fs_item_group_in_details': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 86 | 'Delivery Note': {'items':['item_group']}, |
| 87 | 'Opportunity': {'items':['item_group']}, |
| 88 | 'Material Request': {'items':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 89 | 'Item': {'fields':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 90 | 'Global Defaults': {'fields':['default_item_group']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 91 | 'Purchase Order': {'items':['item_group']}, |
| 92 | 'Purchase Receipt': {'items':['item_group']}, |
| 93 | 'Purchase Voucher': {'items':['item_group']}, |
| 94 | 'Quotation': {'items':['item_group']}, |
| 95 | 'Sales Invoice': {'items':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 96 | 'Sales BOM': {'fields':['serial_no']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 97 | 'Sales Order': {'items':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 98 | 'Serial No': {'fields':['item_group']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 99 | 'Sales Partner': {'targets':['item_group']}, |
| 100 | 'Sales Person': {'targets':['item_group']}, |
| 101 | 'Territory': {'targets':['item_group']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 102 | }, |
| 103 | 'fs_page_break': { |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 104 | 'Delivery Note': {'items':['page_break'],'packed_items':['page_break']}, |
| 105 | 'Material Request': {'items':['page_break']}, |
| 106 | 'Purchase Order': {'items':['page_break']}, |
| 107 | 'Purchase Receipt': {'items':['page_break']}, |
| 108 | 'Purchase Voucher': {'items':['page_break']}, |
| 109 | 'Quotation': {'items':['page_break']}, |
| 110 | 'Sales Invoice': {'items':['page_break']}, |
| 111 | 'Sales Order': {'items':['page_break']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 112 | }, |
| 113 | 'fs_exports': { |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 114 | 'Delivery Note': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 115 | 'POS Setting': {'fields':['conversion_rate','currency']}, |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 116 | 'Quotation': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, |
| 117 | 'Sales Invoice': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 118 | 'Sales BOM': {'fields':['currency']}, |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 119 | 'Sales Order': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 120 | }, |
Nabin Hait | 6b03914 | 2014-05-02 15:45:10 +0530 | [diff] [blame] | 121 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 122 | 'fs_imports': { |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 123 | 'Purchase Invoice': { |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 124 | 'fields': ['conversion_rate', 'currency', 'base_grand_total', |
| 125 | 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added', |
| 126 | 'base_taxes_and_charges_deducted'], |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 127 | 'items': ['base_price_list_rate', 'base_amount','base_rate'] |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 128 | }, |
| 129 | 'Purchase Order': { |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 130 | 'fields': ['conversion_rate','currency', 'base_grand_total', |
| 131 | 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added', |
| 132 | 'base_taxes_and_charges_deducted'], |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 133 | 'items': ['base_price_list_rate', 'base_amount','base_rate'] |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 134 | }, |
| 135 | 'Purchase Receipt': { |
Nabin Hait | 5690be1 | 2015-02-12 16:09:11 +0530 | [diff] [blame^] | 136 | 'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', |
| 137 | 'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted'], |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 138 | 'items': ['base_price_list_rate','base_amount','base_rate'] |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 139 | }, |
| 140 | 'Supplier Quotation': { |
| 141 | 'fields':['conversion_rate','currency'] |
| 142 | } |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 143 | }, |
Nabin Hait | 6b03914 | 2014-05-02 15:45:10 +0530 | [diff] [blame] | 144 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 145 | 'fs_item_advanced': { |
Nabin Hait | 79f091e | 2014-12-26 11:41:15 +0530 | [diff] [blame] | 146 | 'Item': {'fields':['customer_items']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 147 | }, |
| 148 | 'fs_sales_extras': { |
| 149 | 'Address': {'fields':['sales_partner']}, |
| 150 | 'Contact': {'fields':['sales_partner']}, |
| 151 | 'Customer': {'fields':['sales_team']}, |
Nabin Hait | 4417529 | 2014-08-21 16:24:49 +0530 | [diff] [blame] | 152 | 'Delivery Note': {'fields':['sales_team']}, |
Nabin Hait | 79f091e | 2014-12-26 11:41:15 +0530 | [diff] [blame] | 153 | 'Item': {'fields':['customer_items']}, |
Nabin Hait | 4417529 | 2014-08-21 16:24:49 +0530 | [diff] [blame] | 154 | 'Sales Invoice': {'fields':['sales_team']}, |
| 155 | 'Sales Order': {'fields':['sales_team']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 156 | }, |
| 157 | 'fs_more_info': { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 158 | "Customer Issue": {"fields": ["more_info"]}, |
| 159 | 'Material Request': {'fields':['more_info']}, |
| 160 | 'Lead': {'fields':['more_info']}, |
| 161 | 'Opportunity': {'fields':['more_info']}, |
| 162 | 'Purchase Invoice': {'fields':['more_info']}, |
| 163 | 'Purchase Order': {'fields':['more_info']}, |
| 164 | 'Purchase Receipt': {'fields':['more_info']}, |
| 165 | 'Supplier Quotation': {'fields':['more_info']}, |
| 166 | 'Quotation': {'fields':['more_info']}, |
| 167 | 'Sales Invoice': {'fields':['more_info']}, |
| 168 | 'Sales Order': {'fields':['more_info']}, |
| 169 | 'Delivery Note': {'fields':['more_info']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 170 | }, |
| 171 | 'fs_quality': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 172 | 'Item': {'fields':['inspection_criteria','inspection_required']}, |
Nabin Hait | e7d1536 | 2014-12-25 16:01:55 +0530 | [diff] [blame] | 173 | 'Purchase Receipt': {'items':['qa_no']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 174 | }, |
| 175 | 'fs_manufacturing': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 176 | 'Item': {'fields':['manufacturing']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 177 | }, |
| 178 | 'fs_pos': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 179 | 'Sales Invoice': {'fields':['is_pos']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 180 | }, |
| 181 | 'fs_recurring_invoice': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 182 | 'Sales Invoice': {'fields': ['recurring_invoice']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 183 | } |
| 184 | } |
| 185 | |
| 186 | $(document).bind('form_refresh', function() { |
Anand Doshi | aff9a59 | 2015-01-29 19:49:34 +0530 | [diff] [blame] | 187 | var feature_dict = erpnext.feature_setup.feature_dict; |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 188 | for(var sys_feat in sys_defaults) { |
Nabin Hait | 6b03914 | 2014-05-02 15:45:10 +0530 | [diff] [blame] | 189 | if(sys_defaults[sys_feat]=='0' |
Anand Doshi | aff9a59 | 2015-01-29 19:49:34 +0530 | [diff] [blame] | 190 | && (sys_feat in feature_dict)) { //"Features to hide" exists |
| 191 | if(cur_frm.doc.doctype in feature_dict[sys_feat]) { |
| 192 | for(var fort in feature_dict[sys_feat][cur_frm.doc.doctype]) { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 193 | if(fort=='fields') { |
Anand Doshi | aff9a59 | 2015-01-29 19:49:34 +0530 | [diff] [blame] | 194 | hide_field(feature_dict[sys_feat][cur_frm.doc.doctype][fort]); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 195 | } else if(cur_frm.fields_dict[fort]) { |
Anand Doshi | aff9a59 | 2015-01-29 19:49:34 +0530 | [diff] [blame] | 196 | cur_frm.fields_dict[fort].grid.set_column_disp(feature_dict[sys_feat][cur_frm.doc.doctype][fort], false); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 197 | } else { |
Pratik Vyas | b52618c | 2014-04-14 16:25:30 +0530 | [diff] [blame] | 198 | msgprint(__('Grid "')+fort+__('" does not exists')); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 199 | } |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 200 | } |
| 201 | } |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 202 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 203 | } |
| 204 | } |
| 205 | }) |