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