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'], |
| 9 | 'sales_order_details':['projected_qty'] |
| 10 | }, |
| 11 | 'Purchase Order': { |
| 12 | 'fields':['project_name'] |
| 13 | } |
| 14 | } |
| 15 | // ====================================================================*/ |
| 16 | pscript.feature_dict = { |
| 17 | 'fs_projects': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 18 | 'BOM': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 19 | 'Delivery Note': {'fields':['project_name']}, |
Anand Doshi | a202f00 | 2012-04-13 16:03:27 +0530 | [diff] [blame] | 20 | 'Purchase Invoice': {'entries':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 21 | 'Production Order': {'fields':['project_name']}, |
Anand Doshi | a202f00 | 2012-04-13 16:03:27 +0530 | [diff] [blame] | 22 | 'Purchase Order': {'po_details':['project_name']}, |
| 23 | 'Purchase Receipt': {'purchase_receipt_details':['project_name']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 24 | 'Sales Invoice': {'fields':['project_name']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 25 | 'Sales Order': {'fields':['project_name']}, |
| 26 | 'Stock Entry': {'fields':['project_name']}, |
| 27 | 'Timesheet': {'timesheet_details':['project_name']} |
| 28 | }, |
| 29 | 'fs_packing_details': { |
Anand Doshi | b2be11c | 2012-02-14 12:45:55 +0530 | [diff] [blame] | 30 | //'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']}, |
| 31 | //'Sales Order': {'fields':['packing_details']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 32 | }, |
| 33 | 'fs_discounts': { |
| 34 | 'Delivery Note': {'delivery_note_details':['adj_rate']}, |
| 35 | 'Quotation': {'quotation_details':['adj_rate']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 36 | 'Sales Invoice': {'entries':['adj_rate']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 37 | 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} |
| 38 | }, |
| 39 | 'fs_purchase_discounts': { |
| 40 | 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, |
| 41 | '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] | 42 | 'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 43 | }, |
| 44 | 'fs_brands': { |
| 45 | 'Delivery Note': {'delivery_note_details':['brand']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 46 | 'Material Request': {'indent_details':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 47 | 'Item': {'fields':['brand']}, |
| 48 | 'Purchase Order': {'po_details':['brand']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 49 | 'Purchase Invoice': {'entries':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 50 | 'Quotation': {'quotation_details':['brand']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 51 | 'Sales Invoice': {'entries':['brand']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 52 | 'Sales BOM': {'fields':['new_item_brand']}, |
| 53 | 'Sales Order': {'sales_order_details':['brand']}, |
| 54 | 'Serial No': {'fields':['brand']} |
| 55 | }, |
| 56 | 'fs_after_sales_installations': { |
| 57 | 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} |
| 58 | }, |
| 59 | 'fs_item_batch_nos': { |
| 60 | 'Delivery Note': {'delivery_note_details':['batch_no']}, |
| 61 | 'Item': {'fields':['has_batch_no']}, |
| 62 | 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 63 | 'Quality Inspection': {'fields':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 64 | 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 65 | 'Sales Invoice': {'entries':['batch_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 66 | 'Stock Entry': {'mtn_details':['batch_no']}, |
| 67 | 'Stock Ledger Entry': {'fields':['batch_no']} |
| 68 | }, |
| 69 | 'fs_item_serial_nos': { |
| 70 | 'Customer Issue': {'fields':['serial_no']}, |
| 71 | 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, |
| 72 | 'Installation Note': {'installed_item_details':['serial_no']}, |
| 73 | 'Item': {'fields':['has_serial_no']}, |
Anand Doshi | 2424387 | 2012-04-10 19:14:37 +0530 | [diff] [blame] | 74 | 'Maintenance Schedule': {'item_maintenance_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 75 | 'Maintenance Visit': {'maintenance_visit_details':['serial_no']}, |
| 76 | 'Purchase Receipt': {'purchase_receipt_details':['serial_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 77 | 'Quality Inspection': {'fields':['item_serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 78 | 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 79 | 'Sales Invoice': {'entries':['serial_no']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 80 | 'Stock Entry': {'mtn_details':['serial_no']}, |
| 81 | 'Stock Ledger Entry': {'fields':['serial_no']} |
| 82 | }, |
Nabin Hait | 2e3579a | 2012-06-07 19:09:17 +0530 | [diff] [blame] | 83 | 'fs_item_barcode': { |
| 84 | 'Item': {'fields': ['barcode']}, |
| 85 | 'Delivery Note': {'delivery_note_details': ['barcode']}, |
| 86 | 'Sales Invoice': {'entries': ['barcode']} |
| 87 | }, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 88 | 'fs_item_group_in_details': { |
| 89 | 'Delivery Note': {'delivery_note_details':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 90 | 'Opportunity': {'enquiry_details':['item_group']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 91 | 'Material Request': {'indent_details':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 92 | 'Item': {'fields':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 93 | 'Global Defaults': {'fields':['default_item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 94 | 'Purchase Order': {'po_details':['item_group']}, |
| 95 | 'Purchase Receipt': {'purchase_receipt_details':['item_group']}, |
| 96 | 'Purchase Voucher': {'entries':['item_group']}, |
| 97 | 'Quotation': {'quotation_details':['item_group']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 98 | 'Sales Invoice': {'entries':['item_group']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 99 | 'Sales BOM': {'fields':['serial_no']}, |
| 100 | 'Sales Order': {'sales_order_details':['item_group']}, |
| 101 | 'Serial No': {'fields':['item_group']}, |
| 102 | 'Sales Partner': {'partner_target_details':['item_group']}, |
| 103 | 'Sales Person': {'target_details':['item_group']}, |
| 104 | 'Territory': {'target_details':['item_group']} |
| 105 | }, |
| 106 | 'fs_page_break': { |
| 107 | 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, |
Anand Doshi | 236cc17 | 2013-02-18 13:49:15 +0530 | [diff] [blame] | 108 | 'Material Request': {'indent_details':['page_break']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 109 | 'Purchase Order': {'po_details':['page_break']}, |
| 110 | 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, |
| 111 | 'Purchase Voucher': {'entries':['page_break']}, |
| 112 | 'Quotation': {'quotation_details':['page_break']}, |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 113 | 'Sales Invoice': {'entries':['page_break']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 114 | 'Sales Order': {'sales_order_details':['page_break']} |
| 115 | }, |
| 116 | 'fs_exports': { |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 117 | '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] | 118 | 'POS Setting': {'fields':['conversion_rate','currency']}, |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 119 | 'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'quotation_details':['base_ref_rate','amount','basic_rate']}, |
| 120 | '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] | 121 | 'Sales BOM': {'fields':['currency']}, |
Anand Doshi | 5edd570 | 2013-08-01 17:21:53 +0530 | [diff] [blame] | 122 | '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] | 123 | }, |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 124 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 125 | 'fs_imports': { |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 126 | 'Purchase Invoice': { |
| 127 | 'fields': ['conversion_rate', 'currency', 'grand_total', |
| 128 | 'in_words', 'net_total', 'other_charges_added', |
| 129 | 'other_charges_deducted'], |
| 130 | 'entries': ['purchase_ref_rate', 'amount','rate'] |
| 131 | }, |
| 132 | 'Purchase Order': { |
Nabin Hait | 3f0b314 | 2013-07-18 15:11:29 +0530 | [diff] [blame] | 133 | 'fields': ['conversion_rate','currency', 'grand_total', |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 134 | 'in_words', 'net_total', 'other_charges_added', |
| 135 | 'other_charges_deducted'], |
| 136 | 'po_details': ['purchase_ref_rate', 'amount','purchase_rate'] |
| 137 | }, |
| 138 | 'Purchase Receipt': { |
| 139 | 'fields': ['conversion_rate', 'currency','grand_total', 'in_words', |
| 140 | 'net_total', 'other_charges_added', 'other_charges_deducted'], |
| 141 | 'purchase_receipt_details': ['purchase_ref_rate','amount','purchase_rate'] |
| 142 | }, |
| 143 | 'Supplier Quotation': { |
| 144 | 'fields':['conversion_rate','currency'] |
| 145 | } |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 146 | }, |
Nabin Hait | 23decac | 2013-01-28 16:56:07 +0530 | [diff] [blame] | 147 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 148 | 'fs_item_advanced': { |
| 149 | 'Item': {'fields':['item_customer_details']} |
| 150 | }, |
| 151 | 'fs_sales_extras': { |
| 152 | 'Address': {'fields':['sales_partner']}, |
| 153 | 'Contact': {'fields':['sales_partner']}, |
| 154 | 'Customer': {'fields':['sales_team']}, |
Rushabh Mehta | 7bec21c | 2013-03-14 10:09:13 +0530 | [diff] [blame] | 155 | 'Delivery Note': {'fields':['sales_team','packing_list']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 156 | 'Item': {'fields':['item_customer_details']}, |
Rushabh Mehta | 7bec21c | 2013-03-14 10:09:13 +0530 | [diff] [blame] | 157 | 'Sales Invoice': {'fields':['sales_team', 'packing_list']}, |
| 158 | 'Sales Order': {'fields':['sales_team','packing_list']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 159 | }, |
| 160 | 'fs_more_info': { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 161 | "Customer Issue": {"fields": ["more_info"]}, |
| 162 | 'Material Request': {'fields':['more_info']}, |
| 163 | 'Lead': {'fields':['more_info']}, |
| 164 | 'Opportunity': {'fields':['more_info']}, |
| 165 | 'Purchase Invoice': {'fields':['more_info']}, |
| 166 | 'Purchase Order': {'fields':['more_info']}, |
| 167 | 'Purchase Receipt': {'fields':['more_info']}, |
| 168 | 'Supplier Quotation': {'fields':['more_info']}, |
| 169 | 'Quotation': {'fields':['more_info']}, |
| 170 | 'Sales Invoice': {'fields':['more_info']}, |
| 171 | 'Sales Order': {'fields':['more_info']}, |
| 172 | 'Delivery Note': {'fields':['more_info']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 173 | }, |
| 174 | 'fs_quality': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 175 | 'Item': {'fields':['inspection_criteria','inspection_required']}, |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 176 | 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} |
| 177 | }, |
| 178 | 'fs_manufacturing': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 179 | 'Item': {'fields':['manufacturing']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 180 | }, |
| 181 | 'fs_pos': { |
Anand Doshi | fedfd89 | 2012-03-30 12:29:06 +0530 | [diff] [blame] | 182 | 'Sales Invoice': {'fields':['is_pos']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 183 | }, |
| 184 | 'fs_recurring_invoice': { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 185 | 'Sales Invoice': {'fields': ['recurring_invoice']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
| 189 | $(document).bind('form_refresh', function() { |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 190 | for(var sys_feat in sys_defaults) { |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 191 | if(sys_defaults[sys_feat]=='0' |
| 192 | && (sys_feat in pscript.feature_dict)) { //"Features to hide" exists |
| 193 | |
Nabin Hait | d89a733 | 2013-07-18 15:04:29 +0530 | [diff] [blame] | 194 | if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) { |
| 195 | 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] | 196 | if(fort=='fields') { |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 197 | hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 198 | } else if(cur_frm.fields_dict[fort]) { |
Anand Doshi | 60403b2 | 2013-07-25 18:53:22 +0530 | [diff] [blame] | 199 | 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] | 200 | } else { |
Bárbara Perretti | 79c4398 | 2013-10-07 18:56:56 -0300 | [diff] [blame] | 201 | msgprint(wn._('Grid "')+fort+wn._('" does not exists')); |
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 | } |
Rushabh Mehta | b8bf40f | 2013-03-14 10:07:59 +0530 | [diff] [blame] | 205 | |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 206 | } |
| 207 | } |
| 208 | }) |