blob: 96dea90eadb828e0448ef677e611ae1dcc7d98d0 [file] [log] [blame]
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05301// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
2// License: GNU General Public License v3. See license.txt
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05303
Rushabh Mehta865c00a2012-01-24 14:33:21 +05304/* features setup "Dictionary", "Script"
5Dictionary 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// ====================================================================*/
16pscript.feature_dict = {
17 'fs_projects': {
Anand Doshifedfd892012-03-30 12:29:06 +053018 'BOM': {'fields':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053019 'Delivery Note': {'fields':['project_name']},
Anand Doshia202f002012-04-13 16:03:27 +053020 'Purchase Invoice': {'entries':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053021 'Production Order': {'fields':['project_name']},
Anand Doshia202f002012-04-13 16:03:27 +053022 'Purchase Order': {'po_details':['project_name']},
23 'Purchase Receipt': {'purchase_receipt_details':['project_name']},
Anand Doshifedfd892012-03-30 12:29:06 +053024 'Sales Invoice': {'fields':['project_name']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053025 'Sales Order': {'fields':['project_name']},
26 'Stock Entry': {'fields':['project_name']},
27 'Timesheet': {'timesheet_details':['project_name']}
28 },
29 'fs_packing_details': {
Anand Doshib2be11c2012-02-14 12:45:55 +053030 //'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 Mehta865c00a2012-01-24 14:33:21 +053032 },
33 'fs_discounts': {
34 'Delivery Note': {'delivery_note_details':['adj_rate']},
35 'Quotation': {'quotation_details':['adj_rate']},
Anand Doshifedfd892012-03-30 12:29:06 +053036 'Sales Invoice': {'entries':['adj_rate']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053037 '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 Doshifedfd892012-03-30 12:29:06 +053042 'Purchase Invoice': {'entries':['purchase_ref_rate', 'discount_rate', 'import_ref_rate']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +053043 },
44 'fs_brands': {
45 'Delivery Note': {'delivery_note_details':['brand']},
Anand Doshi236cc172013-02-18 13:49:15 +053046 'Material Request': {'indent_details':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053047 'Item': {'fields':['brand']},
48 'Purchase Order': {'po_details':['brand']},
Anand Doshifedfd892012-03-30 12:29:06 +053049 'Purchase Invoice': {'entries':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053050 'Quotation': {'quotation_details':['brand']},
Anand Doshifedfd892012-03-30 12:29:06 +053051 'Sales Invoice': {'entries':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053052 '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 Doshifedfd892012-03-30 12:29:06 +053063 'Quality Inspection': {'fields':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053064 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053065 'Sales Invoice': {'entries':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053066 '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 Doshi24243872012-04-10 19:14:37 +053074 'Maintenance Schedule': {'item_maintenance_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053075 'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
76 'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053077 'Quality Inspection': {'fields':['item_serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053078 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053079 'Sales Invoice': {'entries':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053080 'Stock Entry': {'mtn_details':['serial_no']},
81 'Stock Ledger Entry': {'fields':['serial_no']}
82 },
Nabin Hait2e3579a2012-06-07 19:09:17 +053083 'fs_item_barcode': {
84 'Item': {'fields': ['barcode']},
85 'Delivery Note': {'delivery_note_details': ['barcode']},
86 'Sales Invoice': {'entries': ['barcode']}
87 },
Rushabh Mehta865c00a2012-01-24 14:33:21 +053088 'fs_item_group_in_details': {
89 'Delivery Note': {'delivery_note_details':['item_group']},
Anand Doshifedfd892012-03-30 12:29:06 +053090 'Opportunity': {'enquiry_details':['item_group']},
Anand Doshi236cc172013-02-18 13:49:15 +053091 'Material Request': {'indent_details':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053092 'Item': {'fields':['item_group']},
Anand Doshifedfd892012-03-30 12:29:06 +053093 'Global Defaults': {'fields':['default_item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053094 '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 Doshifedfd892012-03-30 12:29:06 +053098 'Sales Invoice': {'entries':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053099 '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 Doshi236cc172013-02-18 13:49:15 +0530108 'Material Request': {'indent_details':['page_break']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530109 '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 Doshifedfd892012-03-30 12:29:06 +0530113 'Sales Invoice': {'entries':['page_break']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530114 'Sales Order': {'sales_order_details':['page_break']}
115 },
116 'fs_exports': {
Anand Doshi5edd5702013-08-01 17:21:53 +0530117 'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['base_ref_rate','amount','basic_rate']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530118 'POS Setting': {'fields':['conversion_rate','currency']},
Anand Doshi5edd5702013-08-01 17:21:53 +0530119 '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 Mehta865c00a2012-01-24 14:33:21 +0530121 'Sales BOM': {'fields':['currency']},
Anand Doshi5edd5702013-08-01 17:21:53 +0530122 'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_ref_rate','amount','basic_rate']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530123 },
Nabin Hait23decac2013-01-28 16:56:07 +0530124
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530125 'fs_imports': {
Nabin Hait23decac2013-01-28 16:56:07 +0530126 '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 Hait3f0b3142013-07-18 15:11:29 +0530133 'fields': ['conversion_rate','currency', 'grand_total',
Nabin Hait23decac2013-01-28 16:56:07 +0530134 '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 Mehta865c00a2012-01-24 14:33:21 +0530146 },
Nabin Hait23decac2013-01-28 16:56:07 +0530147
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530148 '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 Mehta7bec21c2013-03-14 10:09:13 +0530155 'Delivery Note': {'fields':['sales_team','packing_list']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530156 'Item': {'fields':['item_customer_details']},
Rushabh Mehta7bec21c2013-03-14 10:09:13 +0530157 'Sales Invoice': {'fields':['sales_team', 'packing_list']},
158 'Sales Order': {'fields':['sales_team','packing_list']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530159 },
160 'fs_more_info': {
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530161 "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 Mehta865c00a2012-01-24 14:33:21 +0530173 },
174 'fs_quality': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530175 'Item': {'fields':['inspection_criteria','inspection_required']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530176 'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
177 },
178 'fs_manufacturing': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530179 'Item': {'fields':['manufacturing']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530180 },
181 'fs_pos': {
Anand Doshifedfd892012-03-30 12:29:06 +0530182 'Sales Invoice': {'fields':['is_pos']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530183 },
184 'fs_recurring_invoice': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530185 'Sales Invoice': {'fields': ['recurring_invoice']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530186 }
187}
188
189$(document).bind('form_refresh', function() {
Nabin Haitd89a7332013-07-18 15:04:29 +0530190 for(var sys_feat in sys_defaults) {
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530191 if(sys_defaults[sys_feat]=='0'
192 && (sys_feat in pscript.feature_dict)) { //"Features to hide" exists
193
Nabin Haitd89a7332013-07-18 15:04:29 +0530194 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 Mehtab8bf40f2013-03-14 10:07:59 +0530196 if(fort=='fields') {
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530197 hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530198 } else if(cur_frm.fields_dict[fort]) {
Anand Doshi60403b22013-07-25 18:53:22 +0530199 cur_frm.fields_dict[fort].grid.set_column_disp(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort], false);
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530200 } else {
Bárbara Perretti79c43982013-10-07 18:56:56 -0300201 msgprint(wn._('Grid "')+fort+wn._('" does not exists'));
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530202 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530203 }
204 }
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530205
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530206 }
207 }
208})