Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 1 | /* features setup "Dictionary", "Script" |
| 2 | Dictionary Format |
| 3 | 'projects': { |
| 4 | 'Sales Order': { |
| 5 | 'fields':['project_name'], |
| 6 | 'sales_order_details':['projected_qty'] |
| 7 | }, |
| 8 | 'Purchase Order': { |
| 9 | 'fields':['project_name'] |
| 10 | } |
| 11 | } |
| 12 | // ====================================================================*/ |
| 13 | pscript.feature_dict = { |
| 14 | 'fs_projects': { |
| 15 | 'Bill Of Materials': {'fields':['project_name']}, |
| 16 | 'Delivery Note': {'fields':['project_name']}, |
| 17 | 'Payable Voucher': {'fields':['project_name']}, |
| 18 | 'Production Order': {'fields':['project_name']}, |
| 19 | 'Purchase Order': {'fields':['project_name']}, |
| 20 | 'Purchase Receipt': {'fields':['project_name']}, |
| 21 | 'Receivable Voucher': {'fields':['project_name']}, |
| 22 | 'Sales Order': {'fields':['project_name']}, |
| 23 | 'Stock Entry': {'fields':['project_name']}, |
| 24 | 'Timesheet': {'timesheet_details':['project_name']} |
| 25 | }, |
| 26 | 'fs_packing_details': { |
Anand Doshi | b2be11c | 2012-02-14 12:45:55 +0530 | [diff] [blame] | 27 | //'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']}, |
| 28 | //'Sales Order': {'fields':['packing_details']} |
Rushabh Mehta | 865c00a | 2012-01-24 14:33:21 +0530 | [diff] [blame] | 29 | }, |
| 30 | 'fs_discounts': { |
| 31 | 'Delivery Note': {'delivery_note_details':['adj_rate']}, |
| 32 | 'Quotation': {'quotation_details':['adj_rate']}, |
| 33 | 'Receivable Voucher': {'entries':['adj_rate']}, |
| 34 | 'Sales Order': {'sales_order_details':['adj_rate','ref_rate']} |
| 35 | }, |
| 36 | 'fs_purchase_discounts': { |
| 37 | 'Purchase Order': {'po_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, |
| 38 | 'Purchase Receipt': {'purchase_receipt_details':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}, |
| 39 | 'Payable Voucher': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']} |
| 40 | }, |
| 41 | 'fs_brands': { |
| 42 | 'Delivery Note': {'delivery_note_details':['brand']}, |
| 43 | 'Indent': {'indent_details':['brand']}, |
| 44 | 'Item': {'fields':['brand']}, |
| 45 | 'Purchase Order': {'po_details':['brand']}, |
| 46 | 'Payable Voucher': {'entries':['brand']}, |
| 47 | 'Quotation': {'quotation_details':['brand']}, |
| 48 | 'Receivable Voucher': {'entries':['brand']}, |
| 49 | 'Sales BOM': {'fields':['new_item_brand']}, |
| 50 | 'Sales Order': {'sales_order_details':['brand']}, |
| 51 | 'Serial No': {'fields':['brand']} |
| 52 | }, |
| 53 | 'fs_after_sales_installations': { |
| 54 | 'Delivery Note': {'fields':['installation_status','per_installed'],'delivery_note_details':['installed_qty']} |
| 55 | }, |
| 56 | 'fs_item_batch_nos': { |
| 57 | 'Delivery Note': {'delivery_note_details':['batch_no']}, |
| 58 | 'Item': {'fields':['has_batch_no']}, |
| 59 | 'Purchase Receipt': {'purchase_receipt_details':['batch_no']}, |
| 60 | 'QA Inspection Report': {'fields':['batch_no']}, |
| 61 | 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']}, |
| 62 | 'Receivable Voucher': {'entries':['batch_no']}, |
| 63 | 'Stock Entry': {'mtn_details':['batch_no']}, |
| 64 | 'Stock Ledger Entry': {'fields':['batch_no']} |
| 65 | }, |
| 66 | 'fs_item_serial_nos': { |
| 67 | 'Customer Issue': {'fields':['serial_no']}, |
| 68 | 'Delivery Note': {'delivery_note_details':['serial_no'],'packing_details':['serial_no']}, |
| 69 | 'Installation Note': {'installed_item_details':['serial_no']}, |
| 70 | 'Item': {'fields':['has_serial_no']}, |
| 71 | 'Maintenance Schedule': {'item_maintenance_details':['serial_no'],'maintenance_schedule_details':['serial_no']}, |
| 72 | 'Maintenance Visit': {'maintenance_visit_details':['serial_no']}, |
| 73 | 'Purchase Receipt': {'purchase_receipt_details':['serial_no']}, |
| 74 | 'QA Inspection Report': {'fields':['item_serial_no']}, |
| 75 | 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']}, |
| 76 | 'Receivable Voucher': {'entries':['serial_no']}, |
| 77 | 'Stock Entry': {'mtn_details':['serial_no']}, |
| 78 | 'Stock Ledger Entry': {'fields':['serial_no']} |
| 79 | }, |
| 80 | 'fs_item_group_in_details': { |
| 81 | 'Delivery Note': {'delivery_note_details':['item_group']}, |
| 82 | 'Enquiry': {'enquiry_details':['item_group']}, |
| 83 | 'Indent': {'indent_details':['item_group']}, |
| 84 | 'Item': {'fields':['item_group']}, |
| 85 | 'Manage Account': {'fields':['default_item_group']}, |
| 86 | 'Purchase Order': {'po_details':['item_group']}, |
| 87 | 'Purchase Receipt': {'purchase_receipt_details':['item_group']}, |
| 88 | 'Purchase Voucher': {'entries':['item_group']}, |
| 89 | 'Quotation': {'quotation_details':['item_group']}, |
| 90 | 'Receivable Voucher': {'entries':['item_group']}, |
| 91 | 'Sales BOM': {'fields':['serial_no']}, |
| 92 | 'Sales Order': {'sales_order_details':['item_group']}, |
| 93 | 'Serial No': {'fields':['item_group']}, |
| 94 | 'Sales Partner': {'partner_target_details':['item_group']}, |
| 95 | 'Sales Person': {'target_details':['item_group']}, |
| 96 | 'Territory': {'target_details':['item_group']} |
| 97 | }, |
| 98 | 'fs_page_break': { |
| 99 | 'Delivery Note': {'delivery_note_details':['page_break'],'packing_details':['page_break']}, |
| 100 | 'Indent': {'indent_details':['page_break']}, |
| 101 | 'Purchase Order': {'po_details':['page_break']}, |
| 102 | 'Purchase Receipt': {'purchase_receipt_details':['page_break']}, |
| 103 | 'Purchase Voucher': {'entries':['page_break']}, |
| 104 | 'Quotation': {'quotation_details':['page_break']}, |
| 105 | 'Receivable Voucher': {'entries':['page_break']}, |
| 106 | 'Sales Order': {'sales_order_details':['page_break']} |
| 107 | }, |
| 108 | 'fs_exports': { |
| 109 | 'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']}, |
| 110 | 'POS Setting': {'fields':['conversion_rate','currency']}, |
| 111 | 'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']}, |
| 112 | 'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']}, |
| 113 | 'Item': {'ref_rate_details':['ref_currency']}, |
| 114 | 'Sales BOM': {'fields':['currency']}, |
| 115 | 'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']} |
| 116 | }, |
| 117 | 'fs_imports': { |
| 118 | 'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']}, |
| 119 | 'Purchase Order': {'fields':['Note HTML','conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'po_details':['import_amount','import_rate']}, |
| 120 | 'Purchase Receipt': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'purchase_receipt_details':['import_amount','import_rate']}, |
| 121 | 'Supplier Quotation': {'fields':['conversion_rate','currency']} |
| 122 | }, |
| 123 | 'fs_item_advanced': { |
| 124 | 'Item': {'fields':['item_customer_details']} |
| 125 | }, |
| 126 | 'fs_sales_extras': { |
| 127 | 'Address': {'fields':['sales_partner']}, |
| 128 | 'Contact': {'fields':['sales_partner']}, |
| 129 | 'Customer': {'fields':['sales_team']}, |
| 130 | 'Delivery Note': {'fields':['sales_team','Packing List']}, |
| 131 | 'Item': {'fields':['item_customer_details']}, |
| 132 | 'Receivable Voucher': {'fields':['sales_team']}, |
| 133 | 'Sales Order': {'fields':['sales_team','Packing List']} |
| 134 | }, |
| 135 | 'fs_more_info': { |
| 136 | 'Customer': {'fields':['More Info']}, |
| 137 | 'Delivery Note': {'fields':['More Info']}, |
| 138 | 'Enquiry': {'fields':['More Info']}, |
| 139 | 'Indent': {'fields':['More Info']}, |
| 140 | 'Lead': {'fields':['More Info']}, |
| 141 | 'Payable Voucher': {'fields':['More Info']}, |
| 142 | 'Purchase Order': {'fields':['More Info']}, |
| 143 | 'Purchase Receipt': {'fields':['More Info']}, |
| 144 | 'Quotation': {'fields':['More Info']}, |
| 145 | 'Receivable Voucher': {'fields':['More Info']}, |
| 146 | 'Sales Order': {'fields':['More Info']}, |
| 147 | 'Serial No': {'fields':['More Info']}, |
| 148 | 'Supplier': {'fields':['More Info']} |
| 149 | }, |
| 150 | 'fs_quality': { |
| 151 | 'Item': {'fields':['Item Inspection Criteria','inspection_required']}, |
| 152 | 'Purchase Receipt': {'purchase_receipt_details':['qa_no']} |
| 153 | }, |
| 154 | 'fs_manufacturing': { |
| 155 | 'Item': {'fields':['Manufacturing']} |
| 156 | }, |
| 157 | 'fs_pos': { |
| 158 | 'Receivable Voucher': {'fields':['is_pos']} |
| 159 | }, |
| 160 | 'fs_recurring_invoice': { |
| 161 | 'Receivable Voucher': {'fields': ['Recurring Invoice']} |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | $(document).bind('form_refresh', function() { |
| 166 | for(sys_feat in sys_defaults) |
| 167 | { |
| 168 | if(sys_defaults[sys_feat]=='0' && (sys_feat in pscript.feature_dict)) //"Features to hide" exists |
| 169 | { |
| 170 | if(cur_frm.doc.doctype in pscript.feature_dict[sys_feat]) |
| 171 | { |
| 172 | for(fort in pscript.feature_dict[sys_feat][cur_frm.doc.doctype]) |
| 173 | { |
| 174 | if(fort=='fields') |
| 175 | hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]); |
| 176 | else if(cur_frm.fields_dict[fort]) |
| 177 | { |
| 178 | for(grid_field in pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]) |
| 179 | cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort][grid_field], false); |
| 180 | } |
| 181 | else |
| 182 | msgprint('Grid "'+fort+'" does not exists'); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | }) |