Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 1 | // ERPNext - web based ERP (http://erpnext.com) |
| 2 | // Copyright (C) 2012 Web Notes Technologies Pvt Ltd |
| 3 | // |
| 4 | // This program is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 17 | /* features setup "Dictionary", "Script" |
| 18 | Dictionary Format |
| 19 | 'projects': { |
| 20 | 'Sales Order': { |
| 21 | 'fields':['project_name'], |
| 22 | 'sales_order_details':['projected_qty'] |
| 23 | }, |
| 24 | 'Purchase Order': { |
| 25 | 'fields':['project_name'] |
| 26 | } |
| 27 | } |
| 28 | // ====================================================================*/ |
| 29 | pscript.feature_dict = { |
| 30 | 'fs_projects': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 31 | 'BOM': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 32 | 'Delivery Note': {'fields':['project_name']}, |
Anand Doshi | a202f00 | 2012-04-13 16:03:27 +0530 | [diff] [blame] | 33 | 'Purchase Invoice': {'entries':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 34 | 'Production Order': {'fields':['project_name']}, |
Anand Doshi | a202f00 | 2012-04-13 16:03:27 +0530 | [diff] [blame] | 35 | 'Purchase Order': {'po_details':['project_name']}, |
| 36 | 'Purchase Receipt': {'purchase_receipt_details':['project_name']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 37 | 'Sales Invoice': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 38 | 'Sales Order': {'fields':['project_name']}, |
| 39 | 'Stock Entry': {'fields':['project_name']}, |
| 40 | 'Timesheet': {'timesheet_details':['project_name']} |
| 41 | }, |
| 42 | 'fs_packing_details': { |
Anand Doshi | b2be11c | 2012-02-14 12:45:55 +0530 | [diff] [blame] | 43 | //'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']}, |
| 44 | //'Sales Order': {'fields':['packing_details']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 45 | }, |
| 46 | 'fs_discounts': { |
| 47 | 'Delivery Note': {'delivery_note_details':['adj_rate']}, |
| 48 | 'Quotation': {'quotation_details':['adj_rate']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 49 | 'Sales Invoice': {'entries':['adj_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 50 | 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} |
| 51 | }, |
| 52 | 'fs_purchase_discounts': { |
| 53 | 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, |
| 54 | 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 55 | 'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 56 | }, |
| 57 | 'fs_brands': { |
| 58 | 'Delivery Note': {'delivery_note_details':['brand']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 59 | 'Material Request': {'indent_details':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 60 | 'Item': {'fields':['brand']}, |
| 61 | 'Purchase Order': {'po_details':['brand']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 62 | 'Purchase Invoice': {'entries':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 63 | 'Quotation': {'quotation_details':['brand']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 64 | 'Sales Invoice': {'entries':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 65 | 'Sales BOM': {'fields':['new_item_brand']}, |
| 66 | 'Sales Order': {'sales_order_details':['brand']}, |
| 67 | 'Serial No': {'fields':['brand']} |
| 68 | }, |
| 69 | 'fs_after_sales_installations': { |
| 70 | 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} |
| 71 | }, |
| 72 | 'fs_item_batch_nos': { |
| 73 | 'Delivery Note': {'delivery_note_details':['batch_no']}, |
| 74 | 'Item': {'fields':['has_batch_no']}, |
| 75 | 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 76 | 'Quality Inspection': {'fields':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 77 | 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 78 | 'Sales Invoice': {'entries':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 79 | 'Stock Entry': {'mtn_details':['batch_no']}, |
| 80 | 'Stock Ledger Entry': {'fields':['batch_no']} |
| 81 | }, |
| 82 | 'fs_item_serial_nos': { |
| 83 | 'Customer Issue': {'fields':['serial_no']}, |
| 84 | 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, |
| 85 | 'Installation Note': {'installed_item_details':['serial_no']}, |
| 86 | 'Item': {'fields':['has_serial_no']}, |
Anand Doshi | 2424387 | 2012-04-10 19:14:37 +0530 | [diff] [blame] | 87 | 'Maintenance Schedule': {'item_maintenance_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 88 | 'Maintenance Visit': {'maintenance_visit_details':['serial_no']}, |
| 89 | 'Purchase Receipt': {'purchase_receipt_details':['serial_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 90 | 'Quality Inspection': {'fields':['item_serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 91 | 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 92 | 'Sales Invoice': {'entries':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 93 | 'Stock Entry': {'mtn_details':['serial_no']}, |
| 94 | 'Stock Ledger Entry': {'fields':['serial_no']} |
| 95 | }, |
Nabin Hait | 2e3579a | 2012-06-07 19:09:17 +0530 | [diff] [blame] | 96 | 'fs_item_barcode': { |
| 97 | 'Item': {'fields': ['barcode']}, |
| 98 | 'Delivery Note': {'delivery_note_details': ['barcode']}, |
| 99 | 'Sales Invoice': {'entries': ['barcode']} |
| 100 | }, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 101 | 'fs_item_group_in_details': { |
| 102 | 'Delivery Note': {'delivery_note_details':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 103 | 'Opportunity': {'enquiry_details':['item_group']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 104 | 'Material Request': {'indent_details':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 105 | 'Item': {'fields':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 106 | 'Global Defaults': {'fields':['default_item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 107 | 'Purchase Order': {'po_details':['item_group']}, |
| 108 | 'Purchase Receipt': {'purchase_receipt_details':['item_group']}, |
| 109 | 'Purchase Voucher': {'entries':['item_group']}, |
| 110 | 'Quotation': {'quotation_details':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 111 | 'Sales Invoice': {'entries':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 112 | 'Sales BOM': {'fields':['serial_no']}, |
| 113 | 'Sales Order': {'sales_order_details':['item_group']}, |
| 114 | 'Serial No': {'fields':['item_group']}, |
| 115 | 'Sales Partner': {'partner_target_details':['item_group']}, |
| 116 | 'Sales Person': {'target_details':['item_group']}, |
| 117 | 'Territory': {'target_details':['item_group']} |
| 118 | }, |
| 119 | 'fs_page_break': { |
| 120 | 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 121 | 'Material Request': {'indent_details':['page_break']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 122 | 'Purchase Order': {'po_details':['page_break']}, |
| 123 | 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, |
| 124 | 'Purchase Voucher': {'entries':['page_break']}, |
| 125 | 'Quotation': {'quotation_details':['page_break']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 126 | 'Sales Invoice': {'entries':['page_break']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 127 | 'Sales Order': {'sales_order_details':['page_break']} |
| 128 | }, |
| 129 | 'fs_exports': { |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 130 | 'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['base_ref_rate','amount','basic_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 131 | 'POS Setting': {'fields':['conversion_rate','currency']}, |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 132 | 'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'quotation_details':['base_ref_rate','amount','basic_rate']}, |
| 133 | 'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'entries':['base_ref_rate','amount','basic_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 134 | 'Sales BOM': {'fields':['currency']}, |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 135 | 'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_ref_rate','amount','basic_rate']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 136 | }, |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 137 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 138 | 'fs_imports': { |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 139 | 'Purchase Invoice': { |
| 140 | 'fields': ['conversion_rate', 'currency', 'grand_total', |
| 141 | 'in_words', 'net_total', 'other_charges_added', |
| 142 | 'other_charges_deducted'], |
| 143 | 'entries': ['purchase_ref_rate', 'amount','rate'] |
| 144 | }, |
| 145 | 'Purchase Order': { |
Nabin Hait | 3f0b314 | 2013-07-18 15:11:29 +0530 | [diff] [blame] | 146 | 'fields': ['conversion_rate','currency', 'grand_total', |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 147 | 'in_words', 'net_total', 'other_charges_added', |
| 148 | 'other_charges_deducted'], |
| 149 | 'po_details': ['purchase_ref_rate', 'amount','purchase_rate'] |
| 150 | }, |
| 151 | 'Purchase Receipt': { |
| 152 | 'fields': ['conversion_rate', 'currency','grand_total', 'in_words', |
| 153 | 'net_total', 'other_charges_added', 'other_charges_deducted'], |
| 154 | 'purchase_receipt_details': ['purchase_ref_rate','amount','purchase_rate'] |
| 155 | }, |
| 156 | 'Supplier Quotation': { |
| 157 | 'fields':['conversion_rate','currency'] |
| 158 | } |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 159 | }, |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 160 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 161 | 'fs_item_advanced': { |
| 162 | 'Item': {'fields':['item_customer_details']} |
| 163 | }, |
| 164 | 'fs_sales_extras': { |
| 165 | 'Address': {'fields':['sales_partner']}, |
| 166 | 'Contact': {'fields':['sales_partner']}, |
| 167 | 'Customer': {'fields':['sales_team']}, |
Rushabh Mehta | 7bec21c | 2013-03-14 10:09:13 +0530 | [diff] [blame] | 168 | 'Delivery Note': {'fields':['sales_team','packing_list']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 169 | 'Item': {'fields':['item_customer_details']}, |
Rushabh Mehta | 7bec21c | 2013-03-14 10:09:13 +0530 | [diff] [blame] | 170 | 'Sales Invoice': {'fields':['sales_team', 'packing_list']}, |
| 171 | 'Sales Order': {'fields':['sales_team','packing_list']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 172 | }, |
| 173 | 'fs_more_info': { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 174 | "Customer Issue": {"fields": ["more_info"]}, |
| 175 | 'Material Request': {'fields':['more_info']}, |
| 176 | 'Lead': {'fields':['more_info']}, |
| 177 | 'Opportunity': {'fields':['more_info']}, |
| 178 | 'Purchase Invoice': {'fields':['more_info']}, |
| 179 | 'Purchase Order': {'fields':['more_info']}, |
| 180 | 'Purchase Receipt': {'fields':['more_info']}, |
| 181 | 'Supplier Quotation': {'fields':['more_info']}, |
| 182 | 'Quotation': {'fields':['more_info']}, |
| 183 | 'Sales Invoice': {'fields':['more_info']}, |
| 184 | 'Sales Order': {'fields':['more_info']}, |
| 185 | 'Delivery Note': {'fields':['more_info']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 186 | }, |
| 187 | 'fs_quality': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 188 | 'Item': {'fields':['inspection_criteria','inspection_required']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 189 | 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} |
| 190 | }, |
| 191 | 'fs_manufacturing': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 192 | 'Item': {'fields':['manufacturing']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 193 | }, |
| 194 | 'fs_pos': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 195 | 'Sales Invoice': {'fields':['is_pos']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 196 | }, |
| 197 | 'fs_recurring_invoice': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 198 | 'Sales Invoice': {'fields': ['recurring_invoice']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | |
| 202 | $(document).bind('form_refresh', function() { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 203 | for(var sys_feat in sys_defaults) { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 204 | if(sys_defaults[sys_feat]=='0' |
| 205 | && (sys_feat in pscript.feature_dict)) { //"Features to hide" exists |
| 206 | |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 207 | if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) { |
| 208 | for(var fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 209 | if(fort=='fields') { |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 210 | hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 211 | } else if(cur_frm.fields_dict[fort]) { |
Anand Doshi | 60403b2 | 2013-07-25 18:53:22 +0530 | [diff] [blame] | 212 | cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort], false); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 213 | } else { |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 214 | msgprint('Grid "'+fort+'" does not exists'); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 215 | } |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 216 | } |
| 217 | } |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 218 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 219 | } |
| 220 | } |
| 221 | }) |