blob: 348fce968c1c6ad720aeba20bbd9e4d0ac777298 [file] [log] [blame]
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +05301from __future__ import unicode_literals
2import webnotes
3
4items = [
5 {
6 "type": "Section",
7 "title": "Organization",
8 "icon": "icon-building"
9 },
10 {"doctype":"Company"},
11 {"doctype":"Fiscal Year"},
12 {"doctype":"Currency"},
13 {
14 "type": "Section",
15 "title": "Users and Permissions",
16 "icon": "icon-user"
17 },
18 {
19 "doctype":"Profile",
20 },
21 {
22 "doctype":"Role",
23 },
24 { "title": "Permission Manager",
25 "route": "permission-manager", "type": "Link", "icon": "icon-shield" },
26 { "title": "User Properties",
27 "route": "user-properties", "type": "Link", "icon": "icon-user" },
28 {
29 "type": "Section",
30 "title": "Master Data",
31 "icon": "icon-star"
32 },
33 {
34 "doctype": "Item",
35 "dependencies": [
36 {"doctype":"Item Group", "tree": "Sales Browser"},
37 {"doctype":"Warehouse"},
38 {"doctype":"UOM"},
39 {"doctype":"Brand"},
40 {"doctype":"Price List"},
Rushabh Mehta65d12922013-06-26 22:31:22 +053041 { "title": "Stock Settings",
42 "route": "Form/Stock Settings", "type": "Link", "icon": "icon-cog" },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +053043 ],
44 },
45 {
46 "doctype": "Customer",
47 "dependencies": [
48 {"doctype":"Customer Group", "tree": "Sales Browser"},
49 {"doctype":"Territory", "tree": "Sales Browser"},
50 {"doctype":"Sales Person", "tree": "Sales Browser"},
51 {"doctype":"Contact"},
52 {"doctype":"Address"},
Rushabh Mehta65d12922013-06-26 22:31:22 +053053 { "title": "Selling Settings",
54 "route": "Form/Selling Settings", "type": "Link", "icon": "icon-cog" },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +053055 ]
56 },
57 {
58 "doctype": "Supplier",
59 "dependencies": [
60 {"doctype":"Supplier Type"},
61 {"doctype":"Contact"},
62 {"doctype":"Address"},
Rushabh Mehta65d12922013-06-26 22:31:22 +053063 { "title": "Buying Settings",
64 "route": "Form/Buying Settings", "type": "Link", "icon": "icon-cog" },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +053065 ]
66 },
67 {
68 "type": "Section",
69 "title": "Accounts",
70 "icon": "icon-money"
71 },
72 {
73 "doctype": "Account",
74 "tree": "Accounts Browser",
75 "dependencies": [
76 {
77 "title": "Bank Accounts",
78 "doctype":"Account",
79 "filter": {"account_type": "Bank or Cash"}
80 },
81 {
82 "title": "Tax Accounts",
83 "doctype":"Account",
84 "filter": {"account_type": "Tax"}
85 },
86 ]
87 },
88 {
89 "doctype": "Cost Center",
90 "tree": "Accounts Browser",
91 },
92 { "doctype": "Sales Taxes and Charges Master" },
93 { "doctype": "Purchase Taxes and Charges Master" },
94 {
95 "type": "Section",
Rushabh Mehtad4204012013-07-01 17:15:23 +053096 "title": "Opening Accounts and Stock",
97 "icon": "icon-eye-open"
98 },
99 { "doctype": "Stock Reconciliation" },
100 {
101 "doctype": "Journal Voucher",
102 "title": "Opening Accounting Entries",
103 "filter": {
104 "is_opening": "Yes"
105 }
106 },
107 {
108 "type": "Section",
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530109 "title": "Human Resource",
110 "icon": "icon-group"
111 },
112 {
113 "doctype": "Employee",
114 "dependencies": [
115 { "doctype": "Employment Type" },
116 { "doctype": "Branch" },
117 { "doctype": "Department" },
118 { "doctype": "Designation" },
119 { "doctype": "Holiday List" },
120 { "doctype": "Grade" },
121 ]
122 },
123 { "doctype": "Salary Structure" },
124 { "doctype": "Leave Allocation" },
125 { "doctype": "Appraisal Template" },
126 {
127 "type": "Section",
128 "title": "Printing",
129 "icon": "icon-print"
130 },
Rushabh Mehtae6d986a2013-06-27 10:54:49 +0530131 { "doctype": "Terms and Conditions" },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530132 { "doctype": "Letter Head" },
133 { "doctype": "Print Heading" },
134 { "doctype": "Print Format", "filter": {"standard": "No"} },
135 {
136 "type": "Section",
137 "title": "Email",
138 "icon": "icon-envelope-alt"
139 },
140 {
141 "title": "Outgoing Email Settings",
142 "doctype": "Email Settings",
143 "single": 1,
144 "query": "select count(*) from tabSingles where doctype='Email Settings' and field='outgoing_mail_server'"
145 },
146 {
147 "doctype": "Support Email Settings",
148 "single": 1,
149 "query": "select count(*) from tabSingles where doctype='Email Settings' and field='support_host'"
150 },
151 {
152 "doctype": "Sales Email Settings",
153 "single": 1,
154 "query": "select count(*) from tabSingles where doctype='Sales Email Settings' and field='host'"
155 },
156 {
157 "doctype": "Jobs Email Settings",
158 "single": 1,
159 "query": "select count(*) from tabSingles where doctype='Jobs Email Settings' and field='host'"
160 },
161 {
162 "doctype": "Email Digest",
163 },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530164 {
165 "type": "Section",
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530166 "title": "Customization",
167 "icon": "icon-glass"
168 },
169 {
170 "doctype": "Customize Form",
171 "single": 1,
172 "query": "select count(distinct doc_type) from `tabProperty Setter`"
173 },
174 { "doctype": "Workflow" },
175 { "doctype": "Authorization Rule" },
176 { "doctype": "Custom Field" },
177 { "doctype": "Custom Script" },
178 {
179 "type": "Section",
180 "title": "Tools",
181 "icon": "icon-wrench"
182 },
183 { "title": "Global Settings / Default Values",
184 "doctype": "Global Defaults", "single": 1,
185 "query": """select count(*) from tabSingles where doctype='Global Defaults'
186 and field not in ('owner', 'creation', 'modified', 'modified_by')"""},
187
188 { "title": "Show / Hide Features",
189 "doctype": "Features Setup", "single": 1,
190 "query": """select count(*) from tabSingles where doctype='Features Setup'
191 and field not in ('owner', 'creation', 'modified', 'modified_by')"""},
192
193 { "title": "Enable / Disable Email Notifications",
194 "doctype": "Notification Control", "single": 1,
195 "query": """select count(*) from tabSingles where doctype='Notification Control'
196 and field in ('quotation', 'sales_order', 'sales_invoice', 'purchase_order', 'purchase_receipt', 'expense_claim', 'delivery_note')"""},
197
198 { "doctype": "File Data", "title": "Uploaded File Attachments" },
Anand Doshif7c4d1e2013-06-26 17:33:59 +0530199 {
200 "doctype": "SMS Settings",
201 "single": 1,
202 "query": "select count(*) from tabSingles where doctype='SMS Settings' and field='sms_gateway_url'"
203 },
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530204
205 { "title": "Data Import",
206 "route": "data-import-tool", "type": "Link", "icon": "icon-upload" },
207 { "title": "Bulk Rename",
208 "route": "Form/Rename Tool", "type": "Link", "icon": "icon-upload" },
209 { "title": "Update Numbering Series",
210 "route": "Form/Naming Series", "type": "Link", "icon": "icon-sort-by-order" },
211 { "title": "Show / Hide Modules",
212 "route": "modules_setup", "type": "Link", "icon": "icon-th" },
213 { "title": "Send Bulk SMS to Leads / Contacts",
214 "route": "Form/SMS Center", "type": "Link", "icon": "icon-mobile-phone" },
215 {
216 "type": "Section",
217 "title": "System Administration",
218 "icon": "icon-cog"
219 },
220 { "title": "Update ERPNext",
221 "route": "update-manager", "type": "Link", "icon": "icon-rss" },
222 { "title": "Manage 3rd Party Backups",
223 "route": "Form/Backup Manager", "type": "Link", "icon": "icon-cloud" },
224 { "title": "System Scheduler Errors",
225 "route": "Report/Scheduler Log", "type": "Link", "icon": "icon-exclamation-sign" },
226]
227
228@webnotes.whitelist(allow_roles=["System Manager"])
229def get():
230 for item in items:
231 if item.get("type")=="Section":
232 continue
233 set_count(item)
234
235 if item.get("dependencies"):
236 for d in item["dependencies"]:
237 set_count(d)
238
239 return items
240
241def set_count(item):
242 if "query" in item:
243 item["count"] = webnotes.conn.sql(item["query"])[0][0]
244 elif "filter" in item:
245 key = item["filter"].keys()[0]
246 item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where
Rushabh Mehtad4204012013-07-01 17:15:23 +0530247 %s = %s and docstatus < 2""" % (item["doctype"], key, "%s"),
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530248 item["filter"][key])[0][0]
249 elif "doctype" in item:
Rushabh Mehtad4204012013-07-01 17:15:23 +0530250 item["count"] = webnotes.conn.sql("select count(*) from `tab%s` where docstatus<2" \
Rushabh Mehta2f7e1ab2013-06-26 17:20:12 +0530251 % item["doctype"])[0][0]