blob: 5abf2d9294640108c1f8fa49169cedea1b38e2c8 [file] [log] [blame]
Rushabh Mehtaad45e312013-11-20 12:59:58 +05301// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
Rushabh Mehtae67d1fb2013-08-05 14:59:54 +05302// 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 },
Rushabh Mehta865c00a2012-01-24 14:33:21 +053029 'fs_discounts': {
Nabin Haita7f757a2014-02-10 17:54:04 +053030 '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 Mehta865c00a2012-01-24 14:33:21 +053034 },
35 'fs_purchase_discounts': {
Nabin Haita7f757a2014-02-10 17:54:04 +053036 '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 Mehta865c00a2012-01-24 14:33:21 +053039 },
40 'fs_brands': {
41 'Delivery Note': {'delivery_note_details':['brand']},
Anand Doshi236cc172013-02-18 13:49:15 +053042 'Material Request': {'indent_details':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053043 'Item': {'fields':['brand']},
44 'Purchase Order': {'po_details':['brand']},
Anand Doshifedfd892012-03-30 12:29:06 +053045 'Purchase Invoice': {'entries':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053046 'Quotation': {'quotation_details':['brand']},
Anand Doshifedfd892012-03-30 12:29:06 +053047 'Sales Invoice': {'entries':['brand']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053048 '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 Doshifedfd892012-03-30 12:29:06 +053059 'Quality Inspection': {'fields':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053060 'Sales and Pruchase Return Wizard': {'return_details':['batch_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053061 'Sales Invoice': {'entries':['batch_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053062 '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 Doshi24243872012-04-10 19:14:37 +053070 'Maintenance Schedule': {'item_maintenance_detail':['serial_no'],'maintenance_schedule_detail':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053071 'Maintenance Visit': {'maintenance_visit_details':['serial_no']},
72 'Purchase Receipt': {'purchase_receipt_details':['serial_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053073 'Quality Inspection': {'fields':['item_serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053074 'Sales and Pruchase Return Wizard': {'return_details':['serial_no']},
Anand Doshifedfd892012-03-30 12:29:06 +053075 'Sales Invoice': {'entries':['serial_no']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053076 'Stock Entry': {'mtn_details':['serial_no']},
77 'Stock Ledger Entry': {'fields':['serial_no']}
78 },
Nabin Hait2e3579a2012-06-07 19:09:17 +053079 'fs_item_barcode': {
80 'Item': {'fields': ['barcode']},
81 'Delivery Note': {'delivery_note_details': ['barcode']},
82 'Sales Invoice': {'entries': ['barcode']}
83 },
Rushabh Mehta865c00a2012-01-24 14:33:21 +053084 'fs_item_group_in_details': {
85 'Delivery Note': {'delivery_note_details':['item_group']},
Anand Doshifedfd892012-03-30 12:29:06 +053086 'Opportunity': {'enquiry_details':['item_group']},
Anand Doshi236cc172013-02-18 13:49:15 +053087 'Material Request': {'indent_details':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053088 'Item': {'fields':['item_group']},
Anand Doshifedfd892012-03-30 12:29:06 +053089 'Global Defaults': {'fields':['default_item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053090 '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 Doshifedfd892012-03-30 12:29:06 +053094 'Sales Invoice': {'entries':['item_group']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +053095 '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 Doshi236cc172013-02-18 13:49:15 +0530104 'Material Request': {'indent_details':['page_break']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530105 '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 Doshifedfd892012-03-30 12:29:06 +0530109 'Sales Invoice': {'entries':['page_break']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530110 'Sales Order': {'sales_order_details':['page_break']}
111 },
112 'fs_exports': {
Nabin Hait1eb56012014-02-10 19:20:15 +0530113 'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'delivery_note_details':['base_price_list_rate','base_amount','base_rate']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530114 'POS Setting': {'fields':['conversion_rate','currency']},
Nabin Hait1eb56012014-02-10 19:20:15 +0530115 '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 Mehta865c00a2012-01-24 14:33:21 +0530117 'Sales BOM': {'fields':['currency']},
Nabin Hait1eb56012014-02-10 19:20:15 +0530118 'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'sales_order_details':['base_price_list_rate','base_amount','base_rate']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530119 },
Nabin Hait6b039142014-05-02 15:45:10 +0530120
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530121 'fs_imports': {
Nabin Hait23decac2013-01-28 16:56:07 +0530122 'Purchase Invoice': {
123 'fields': ['conversion_rate', 'currency', 'grand_total',
124 'in_words', 'net_total', 'other_charges_added',
Nabin Hait6b039142014-05-02 15:45:10 +0530125 'other_charges_deducted'],
Nabin Hait1eb56012014-02-10 19:20:15 +0530126 'entries': ['base_price_list_rate', 'base_amount','base_rate']
Nabin Hait23decac2013-01-28 16:56:07 +0530127 },
128 'Purchase Order': {
Nabin Hait3f0b3142013-07-18 15:11:29 +0530129 'fields': ['conversion_rate','currency', 'grand_total',
Nabin Hait23decac2013-01-28 16:56:07 +0530130 'in_words', 'net_total', 'other_charges_added',
131 'other_charges_deducted'],
Nabin Hait1eb56012014-02-10 19:20:15 +0530132 'po_details': ['base_price_list_rate', 'base_amount','base_rate']
Nabin Hait23decac2013-01-28 16:56:07 +0530133 },
134 'Purchase Receipt': {
135 'fields': ['conversion_rate', 'currency','grand_total', 'in_words',
136 'net_total', 'other_charges_added', 'other_charges_deducted'],
Nabin Hait1eb56012014-02-10 19:20:15 +0530137 'purchase_receipt_details': ['base_price_list_rate','base_amount','base_rate']
Nabin Hait23decac2013-01-28 16:56:07 +0530138 },
139 'Supplier Quotation': {
140 'fields':['conversion_rate','currency']
141 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530142 },
Nabin Hait6b039142014-05-02 15:45:10 +0530143
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530144 '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 Hait44175292014-08-21 16:24:49 +0530151 'Delivery Note': {'fields':['sales_team']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530152 'Item': {'fields':['item_customer_details']},
Nabin Hait44175292014-08-21 16:24:49 +0530153 'Sales Invoice': {'fields':['sales_team']},
154 'Sales Order': {'fields':['sales_team']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530155 },
156 'fs_more_info': {
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530157 "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 Mehta865c00a2012-01-24 14:33:21 +0530169 },
170 'fs_quality': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530171 'Item': {'fields':['inspection_criteria','inspection_required']},
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530172 'Purchase Receipt': {'purchase_receipt_details':['qa_no']}
173 },
174 'fs_manufacturing': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530175 'Item': {'fields':['manufacturing']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530176 },
177 'fs_pos': {
Anand Doshifedfd892012-03-30 12:29:06 +0530178 'Sales Invoice': {'fields':['is_pos']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530179 },
180 'fs_recurring_invoice': {
Nabin Haitd89a7332013-07-18 15:04:29 +0530181 'Sales Invoice': {'fields': ['recurring_invoice']}
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530182 }
183}
184
185$(document).bind('form_refresh', function() {
Nabin Haitd89a7332013-07-18 15:04:29 +0530186 for(var sys_feat in sys_defaults) {
Nabin Hait6b039142014-05-02 15:45:10 +0530187 if(sys_defaults[sys_feat]=='0'
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530188 && (sys_feat in pscript.feature_dict)) { //"Features to hide" exists
Nabin Haitd89a7332013-07-18 15:04:29 +0530189 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 Mehtab8bf40f2013-03-14 10:07:59 +0530191 if(fort=='fields') {
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530192 hide_field(pscript.feature_dict[sys_feat][cur_frm.doc.doctype][fort]);
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530193 } else if(cur_frm.fields_dict[fort]) {
Nabin Hait6b039142014-05-02 15:45:10 +0530194 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 +0530195 } else {
Pratik Vyasb52618c2014-04-14 16:25:30 +0530196 msgprint(__('Grid "')+fort+__('" does not exists'));
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530197 }
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530198 }
199 }
Rushabh Mehtab8bf40f2013-03-14 10:07:59 +0530200
Rushabh Mehta865c00a2012-01-24 14:33:21 +0530201 }
202 }
203})