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