mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 14:08:29 +00:00
[setup] new page + minor fixes
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
.setup-column {
|
||||
float: left;
|
||||
width: 45%;
|
||||
margin-right: 5%;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
@@ -1,228 +1,180 @@
|
||||
// ERPNext: Copyright 2013 Web Notes Technologies Pvt Ltd
|
||||
// GNU General Public License. See "license.txt"
|
||||
wn.pages['Setup'].onload = function(wrapper) {
|
||||
if(msg_dialog && msg_dialog.display) msg_dialog.hide();
|
||||
wn.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: 'Setup',
|
||||
single_column: true
|
||||
});
|
||||
|
||||
wn.module_page["Setup"] = [
|
||||
{
|
||||
title: wn._("Organization"),
|
||||
icon: "icon-building",
|
||||
items: [
|
||||
{
|
||||
"label":wn._("Company"),
|
||||
"doctype":"Company",
|
||||
"description":wn._("List of companies (not customers / suppliers)")
|
||||
},
|
||||
{
|
||||
"doctype":"Fiscal Year",
|
||||
"label": wn._("Fiscal Year"),
|
||||
"description":wn._("Financial Years for books of accounts")
|
||||
},
|
||||
{
|
||||
"doctype":"Currency",
|
||||
"label": wn._("Currency"),
|
||||
"description": wn._("Enable / disable currencies.")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Users"),
|
||||
icon: "icon-group",
|
||||
right: true,
|
||||
items: [
|
||||
{
|
||||
"doctype":"Profile",
|
||||
"label": wn._("Profile"),
|
||||
"description": wn._("Add/remove users, set roles, passwords etc")
|
||||
},
|
||||
{
|
||||
"page":"permission-manager",
|
||||
label: wn._("Permission Manager"),
|
||||
"description": wn._("Set permissions on transactions / masters")
|
||||
},
|
||||
{
|
||||
"page":"user-properties",
|
||||
label: wn._("User Properties"),
|
||||
"description":wn._("Set default values for users (also used for permissions).")
|
||||
},
|
||||
{
|
||||
"doctype":"Workflow",
|
||||
label:wn._("Workflow"),
|
||||
"description":wn._("Set workflow rules.")
|
||||
},
|
||||
{
|
||||
"doctype":"Authorization Rule",
|
||||
label:wn._("Authorization Rule"),
|
||||
"description":wn._("Restrict submission rights based on amount")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Data"),
|
||||
icon: "icon-table",
|
||||
items: [
|
||||
{
|
||||
"page":"data-import-tool",
|
||||
label: wn._("Data Import"),
|
||||
"description":wn._("Import data from spreadsheet (csv) files")
|
||||
},
|
||||
{
|
||||
"route":"Form/Global Defaults",
|
||||
doctype: "Global Defaults",
|
||||
label: wn._("Global Defaults"),
|
||||
"description":wn._("Set default values for entry"),
|
||||
},
|
||||
{
|
||||
"route":"Form/Naming Series/Naming Series",
|
||||
doctype: "Naming Series",
|
||||
label: wn._("Manage Numbering Series"),
|
||||
"description":wn._("Set multiple numbering series for transactions")
|
||||
},
|
||||
{
|
||||
"route":"Form/Rename Tool",
|
||||
doctype: "Rename Tool",
|
||||
label: wn._("Rename Tool"),
|
||||
"description":wn._("Rename multiple items in one go")
|
||||
},
|
||||
{
|
||||
"route":"List/File Data",
|
||||
doctype: "File Data",
|
||||
label: wn._("File Manager"),
|
||||
"description":wn._("List, delete uploaded files.")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Branding and Printing"),
|
||||
icon: "icon-print",
|
||||
right: true,
|
||||
items: [
|
||||
{
|
||||
"doctype":"Letter Head",
|
||||
label:wn._("Letter Head"),
|
||||
"description":wn._("Letter heads for print")
|
||||
},
|
||||
{
|
||||
"doctype":"Print Format",
|
||||
label:wn._("Print Format"),
|
||||
"description":wn._("HTML print formats for quotes, invoices etc")
|
||||
},
|
||||
{
|
||||
"doctype":"Print Heading",
|
||||
label:wn._("Print Heading"),
|
||||
"description":wn._("Add headers for standard print formats")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Email Settings"),
|
||||
icon: "icon-envelope",
|
||||
items: [
|
||||
{
|
||||
"route":"Form/Email Settings/Email Settings",
|
||||
doctype:"Email Settings",
|
||||
label: wn._("Email Settings"),
|
||||
"description":wn._("Out going mail server and support ticket mailbox")
|
||||
},
|
||||
{
|
||||
"route":"Form/Sales Email Settings",
|
||||
doctype:"Sales Email Settings",
|
||||
label: wn._("Sales Email Settings"),
|
||||
"description":wn._("Extract Leads from sales email id e.g. sales@example.com")
|
||||
},
|
||||
{
|
||||
"route":"Form/Jobs Email Settings",
|
||||
doctype:"Jobs Email Settings",
|
||||
label: wn._("Jobs Email Settings"),
|
||||
"description":wn._("Extract Job Applicant from jobs email id e.g. jobs@example.com")
|
||||
},
|
||||
{
|
||||
"route":"Form/Notification Control/Notification Control",
|
||||
doctype:"Notification Control",
|
||||
label: wn._("Notification Control"),
|
||||
"description":wn._("Prompt email sending to customers and suppliers"),
|
||||
},
|
||||
{
|
||||
"doctype":"Email Digest",
|
||||
label: wn._("Email Digest"),
|
||||
"description":wn._("Daily, weekly, monthly email Digests")
|
||||
},
|
||||
{
|
||||
"route":"Form/SMS Settings/SMS Settings",
|
||||
doctype:"SMS Settings",
|
||||
label: wn._("SMS Settings"),
|
||||
"description":wn._("Setup outgoing SMS via your bulk SMS provider")
|
||||
},
|
||||
{
|
||||
"route":"Form/SMS Center/SMS Center",
|
||||
doctype:"SMS Center",
|
||||
label: wn._("SMS Center"),
|
||||
"description":wn._("Send bulk SMS to leads, customers, contacts")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Customize"),
|
||||
icon: "icon-wrench",
|
||||
items: [
|
||||
{
|
||||
"route":"Form/Customize Form/Customize Form",
|
||||
doctype:"Customize Form",
|
||||
label: wn._("Customize Form"),
|
||||
"description":wn._("Change entry properties (hide fields, make mandatory etc)")
|
||||
},
|
||||
{
|
||||
"doctype":"Custom Field",
|
||||
label: wn._("Custom Field"),
|
||||
"description":wn._("Add fields to forms")
|
||||
},
|
||||
{
|
||||
"doctype":"Custom Script",
|
||||
label: wn._("Custom Script"),
|
||||
"description":wn._("Add custom code to forms")
|
||||
},
|
||||
{
|
||||
"route":"Form/Features Setup/Features Setup",
|
||||
"description":wn._("Simplify entry forms by disabling features"),
|
||||
doctype:"Features Setup",
|
||||
label: wn._("Features Setup"),
|
||||
},
|
||||
{
|
||||
"page":"modules_setup",
|
||||
label: wn._("Show / Hide Modules"),
|
||||
"description":wn._("Show, hide modules")
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Administration"),
|
||||
icon: "icon-rocket",
|
||||
right: true,
|
||||
items: [
|
||||
{
|
||||
"page":"update-manager",
|
||||
label: wn._("Update This Application"),
|
||||
"description":wn._("Apply latest updates and patches to this app")
|
||||
},
|
||||
{
|
||||
"route":"Form/Backup Manager",
|
||||
doctype:"Backup Manager",
|
||||
label: wn._("Backup Manager"),
|
||||
"description":wn._("Sync backups with remote tools like Dropbox etc.")
|
||||
},
|
||||
{
|
||||
"route":"List/Scheduler Log",
|
||||
doctype:"Scheduler Log",
|
||||
label: wn._("Scheduler Error Log"),
|
||||
"description":wn._("Get a list of errors encountered by the Scheduler")
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
wrapper.appframe.add_module_icon("Setup");
|
||||
|
||||
var body = $(wrapper).find(".layout-main"),
|
||||
total = 0,
|
||||
completed = 0;
|
||||
|
||||
pscript['onload_Setup'] = function(wrapper) {
|
||||
wn.views.moduleview.make(wrapper, "Setup");
|
||||
if(wn.boot.expires_on) {
|
||||
$(wrapper).find(".main-section")
|
||||
.prepend("<div class='alert'>Your ERPNext account will expire on "
|
||||
+ wn.datetime.global_date_format(wn.boot.expires_on) + "</div>");
|
||||
body.html('<div class="progress progress-striped active">\
|
||||
<div class="progress-bar" style="width: 100%;"></div></div>')
|
||||
|
||||
wn.call({
|
||||
method: "setup.page.setup.setup.get",
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
body.empty();
|
||||
if(wn.boot.expires_on) {
|
||||
$(body).prepend("<div class='text-muted' style='text-align:right'>Account expires on "
|
||||
+ wn.datetime.global_date_format(wn.boot.expires_on) + "</div>");
|
||||
}
|
||||
|
||||
$completed = $('<h4>Setup Completed <span class="completed-percent"></span><h4>\
|
||||
<div class="progress"><div class="progress-bar"></div></div>')
|
||||
.appendTo(body);
|
||||
|
||||
$.each(r.message, function(i, item) {
|
||||
render_item(item)
|
||||
});
|
||||
|
||||
var completed_percent = cint(flt(completed) / total * 100) + "%";
|
||||
$completed
|
||||
.find(".progress-bar")
|
||||
.css({"width": completed_percent});
|
||||
$(body)
|
||||
.find(".completed-percent")
|
||||
.html("(" + completed_percent + ")");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var render_item = function(item, dependency) {
|
||||
if(item.type==="Section") {
|
||||
$("<h3>")
|
||||
.css({"margin": "20px 0px 15px 0px"})
|
||||
.html('<i class="'+item.icon+'"></i> ' + item.title).appendTo(body);
|
||||
return;
|
||||
}
|
||||
var row = $('<div class="row">')
|
||||
.css({
|
||||
"margin-bottom": "7px",
|
||||
"padding-bottom": "7px",
|
||||
"border-bottom": "1px solid #eee"
|
||||
})
|
||||
.appendTo(body);
|
||||
|
||||
$('<div class="col col-lg-1"></div>').appendTo(row);
|
||||
|
||||
if(item.type==="Link") {
|
||||
var col = $('<div class="col col-lg-5"><b><a href="#'
|
||||
+item.route+'"><i class="'+item.icon+'"></i> '
|
||||
+item.title+'</a></b></div>').appendTo(row);
|
||||
|
||||
} else {
|
||||
var col = $('<div class="col col-lg-5">\
|
||||
<span class="badge">'+ item.count +'</span>'+
|
||||
' <b>' + (item.title || item.doctype) + '</b>'
|
||||
+'</div>')
|
||||
.appendTo(row);
|
||||
|
||||
if(dependency)
|
||||
col.addClass("col-offset-1");
|
||||
else
|
||||
$('<div class="col col-lg-1"></div>').appendTo(row);
|
||||
|
||||
col.find(".badge")
|
||||
.css({
|
||||
"background-color": (item.count ? "green" : "orange"),
|
||||
"display": "inline-block",
|
||||
"min-width": "40px"
|
||||
});
|
||||
|
||||
total += 1;
|
||||
if(item.count)
|
||||
completed += 1;
|
||||
}
|
||||
|
||||
if(item.doctype) {
|
||||
col.find(".badge")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.css({"cursor": "pointer"})
|
||||
.click(function() {
|
||||
wn.set_route("List", $(this).attr("data-doctype"))
|
||||
})
|
||||
}
|
||||
|
||||
// tree
|
||||
$links = $('<div class="col col-lg-5">').appendTo(row);
|
||||
|
||||
if(item.tree) {
|
||||
$('<a class="view-link"><i class="icon-sitemap"></i> Browse</a>\
|
||||
<span class="text-muted">|</span> \
|
||||
<a class="import-link"><i class="icon-upload"></i> Import</a>')
|
||||
.appendTo($links)
|
||||
|
||||
$links.find(".view-link")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.click(function() {
|
||||
wn.set_route(item.tree, item.doctype);
|
||||
})
|
||||
} else if(item.single) {
|
||||
$('<a class="view-link"><i class="icon-edit"></i> Edit</a>')
|
||||
.appendTo($links)
|
||||
|
||||
$links.find(".view-link")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.click(function() {
|
||||
wn.set_route("Form", $(this).attr("data-doctype"));
|
||||
})
|
||||
} else if(item.type !== "Link"){
|
||||
$('<a class="new-link"><i class="icon-plus"></i> New</a> \
|
||||
<span class="text-muted">|</span> \
|
||||
<a class="view-link"><i class="icon-list"></i> View</a> \
|
||||
<span class="text-muted">|</span> \
|
||||
<a class="import-link"><i class="icon-upload"></i> Import</a>')
|
||||
.appendTo($links)
|
||||
|
||||
$links.find(".view-link")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.click(function() {
|
||||
if($(this).attr("data-filter")) {
|
||||
wn.route_options = JSON.parse($(this).attr("data-filter"));
|
||||
}
|
||||
wn.set_route("List", $(this).attr("data-doctype"));
|
||||
})
|
||||
|
||||
if(item.filter)
|
||||
$links.find(".view-link").attr("data-filter", JSON.stringify(item.filter))
|
||||
|
||||
if(wn.model.can_create(item.doctype)) {
|
||||
$links.find(".new-link")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.click(function() {
|
||||
new_doc($(this).attr("data-doctype"))
|
||||
})
|
||||
} else {
|
||||
$links.find(".new-link").remove();
|
||||
$links.find(".text-muted:first").remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$links.find(".import-link")
|
||||
.attr("data-doctype", item.doctype)
|
||||
.click(function() {
|
||||
wn.route_options = {doctype:$(this).attr("data-doctype")}
|
||||
wn.set_route("data-import-tool");
|
||||
})
|
||||
|
||||
if(item.links) {
|
||||
$.each(item.links, function(i, link) {
|
||||
var newlinks = $('<span class="text-muted"> |</span> \
|
||||
<a class="import-link" href="#'+link.route
|
||||
+'"><i class="'+link.icon+'"></i> '+link.title+'</a>')
|
||||
.appendTo($links)
|
||||
})
|
||||
}
|
||||
|
||||
if(item.dependencies) {
|
||||
$.each(item.dependencies, function(i, d) {
|
||||
render_item(d, true);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
244
setup/page/setup/setup.py
Normal file
244
setup/page/setup/setup.py
Normal file
@@ -0,0 +1,244 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
items = [
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Organization",
|
||||
"icon": "icon-building"
|
||||
},
|
||||
{"doctype":"Company"},
|
||||
{"doctype":"Fiscal Year"},
|
||||
{"doctype":"Currency"},
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Users and Permissions",
|
||||
"icon": "icon-user"
|
||||
},
|
||||
{
|
||||
"doctype":"Profile",
|
||||
},
|
||||
{
|
||||
"doctype":"Role",
|
||||
},
|
||||
{ "title": "Permission Manager",
|
||||
"route": "permission-manager", "type": "Link", "icon": "icon-shield" },
|
||||
{ "title": "User Properties",
|
||||
"route": "user-properties", "type": "Link", "icon": "icon-user" },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Master Data",
|
||||
"icon": "icon-star"
|
||||
},
|
||||
{
|
||||
"doctype": "Item",
|
||||
"dependencies": [
|
||||
{"doctype":"Item Group", "tree": "Sales Browser"},
|
||||
{"doctype":"Warehouse"},
|
||||
{"doctype":"UOM"},
|
||||
{"doctype":"Brand"},
|
||||
{"doctype":"Price List"},
|
||||
],
|
||||
},
|
||||
{
|
||||
"doctype": "Customer",
|
||||
"dependencies": [
|
||||
{"doctype":"Customer Group", "tree": "Sales Browser"},
|
||||
{"doctype":"Territory", "tree": "Sales Browser"},
|
||||
{"doctype":"Sales Person", "tree": "Sales Browser"},
|
||||
{"doctype":"Contact"},
|
||||
{"doctype":"Address"},
|
||||
]
|
||||
},
|
||||
{
|
||||
"doctype": "Supplier",
|
||||
"dependencies": [
|
||||
{"doctype":"Supplier Type"},
|
||||
{"doctype":"Contact"},
|
||||
{"doctype":"Address"},
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Accounts",
|
||||
"icon": "icon-money"
|
||||
},
|
||||
{
|
||||
"doctype": "Account",
|
||||
"tree": "Accounts Browser",
|
||||
"dependencies": [
|
||||
{
|
||||
"title": "Bank Accounts",
|
||||
"doctype":"Account",
|
||||
"filter": {"account_type": "Bank or Cash"}
|
||||
},
|
||||
{
|
||||
"title": "Tax Accounts",
|
||||
"doctype":"Account",
|
||||
"filter": {"account_type": "Tax"}
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
"doctype": "Cost Center",
|
||||
"tree": "Accounts Browser",
|
||||
},
|
||||
{ "doctype": "Sales Taxes and Charges Master" },
|
||||
{ "doctype": "Purchase Taxes and Charges Master" },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Human Resource",
|
||||
"icon": "icon-group"
|
||||
},
|
||||
{
|
||||
"doctype": "Employee",
|
||||
"dependencies": [
|
||||
{ "doctype": "Employment Type" },
|
||||
{ "doctype": "Branch" },
|
||||
{ "doctype": "Department" },
|
||||
{ "doctype": "Designation" },
|
||||
{ "doctype": "Holiday List" },
|
||||
{ "doctype": "Grade" },
|
||||
]
|
||||
},
|
||||
{ "doctype": "Salary Structure" },
|
||||
{ "doctype": "Leave Allocation" },
|
||||
{ "doctype": "Appraisal Template" },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Printing",
|
||||
"icon": "icon-print"
|
||||
},
|
||||
{ "doctype": "Letter Head" },
|
||||
{ "doctype": "Print Heading" },
|
||||
{ "doctype": "Print Format", "filter": {"standard": "No"} },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Email",
|
||||
"icon": "icon-envelope-alt"
|
||||
},
|
||||
{
|
||||
"title": "Outgoing Email Settings",
|
||||
"doctype": "Email Settings",
|
||||
"single": 1,
|
||||
"query": "select count(*) from tabSingles where doctype='Email Settings' and field='outgoing_mail_server'"
|
||||
},
|
||||
{
|
||||
"doctype": "Support Email Settings",
|
||||
"single": 1,
|
||||
"query": "select count(*) from tabSingles where doctype='Email Settings' and field='support_host'"
|
||||
},
|
||||
{
|
||||
"doctype": "Sales Email Settings",
|
||||
"single": 1,
|
||||
"query": "select count(*) from tabSingles where doctype='Sales Email Settings' and field='host'"
|
||||
},
|
||||
{
|
||||
"doctype": "Jobs Email Settings",
|
||||
"single": 1,
|
||||
"query": "select count(*) from tabSingles where doctype='Jobs Email Settings' and field='host'"
|
||||
},
|
||||
{
|
||||
"doctype": "Email Digest",
|
||||
},
|
||||
{
|
||||
"doctype": "SMS Settings",
|
||||
"single": 1,
|
||||
"query": "select count(*) from tabSingles where doctype='SMS Settings' and field='sms_gateway_url'"
|
||||
},
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Opening Accounts and Stock",
|
||||
"icon": "icon-eye-open"
|
||||
},
|
||||
{ "doctype": "Stock Reconciliation" },
|
||||
{
|
||||
"doctype": "Journal Voucher",
|
||||
"title": "Opening Accounting Entries",
|
||||
"filter": {
|
||||
"is_opening": "Yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Customization",
|
||||
"icon": "icon-glass"
|
||||
},
|
||||
{
|
||||
"doctype": "Customize Form",
|
||||
"single": 1,
|
||||
"query": "select count(distinct doc_type) from `tabProperty Setter`"
|
||||
},
|
||||
{ "doctype": "Workflow" },
|
||||
{ "doctype": "Authorization Rule" },
|
||||
{ "doctype": "Custom Field" },
|
||||
{ "doctype": "Custom Script" },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "Tools",
|
||||
"icon": "icon-wrench"
|
||||
},
|
||||
{ "title": "Global Settings / Default Values",
|
||||
"doctype": "Global Defaults", "single": 1,
|
||||
"query": """select count(*) from tabSingles where doctype='Global Defaults'
|
||||
and field not in ('owner', 'creation', 'modified', 'modified_by')"""},
|
||||
|
||||
{ "title": "Show / Hide Features",
|
||||
"doctype": "Features Setup", "single": 1,
|
||||
"query": """select count(*) from tabSingles where doctype='Features Setup'
|
||||
and field not in ('owner', 'creation', 'modified', 'modified_by')"""},
|
||||
|
||||
{ "title": "Enable / Disable Email Notifications",
|
||||
"doctype": "Notification Control", "single": 1,
|
||||
"query": """select count(*) from tabSingles where doctype='Notification Control'
|
||||
and field in ('quotation', 'sales_order', 'sales_invoice', 'purchase_order', 'purchase_receipt', 'expense_claim', 'delivery_note')"""},
|
||||
|
||||
{ "doctype": "File Data", "title": "Uploaded File Attachments" },
|
||||
|
||||
{ "title": "Data Import",
|
||||
"route": "data-import-tool", "type": "Link", "icon": "icon-upload" },
|
||||
{ "title": "Bulk Rename",
|
||||
"route": "Form/Rename Tool", "type": "Link", "icon": "icon-upload" },
|
||||
{ "title": "Update Numbering Series",
|
||||
"route": "Form/Naming Series", "type": "Link", "icon": "icon-sort-by-order" },
|
||||
{ "title": "Show / Hide Modules",
|
||||
"route": "modules_setup", "type": "Link", "icon": "icon-th" },
|
||||
{ "title": "Send Bulk SMS to Leads / Contacts",
|
||||
"route": "Form/SMS Center", "type": "Link", "icon": "icon-mobile-phone" },
|
||||
{
|
||||
"type": "Section",
|
||||
"title": "System Administration",
|
||||
"icon": "icon-cog"
|
||||
},
|
||||
{ "title": "Update ERPNext",
|
||||
"route": "update-manager", "type": "Link", "icon": "icon-rss" },
|
||||
{ "title": "Manage 3rd Party Backups",
|
||||
"route": "Form/Backup Manager", "type": "Link", "icon": "icon-cloud" },
|
||||
{ "title": "System Scheduler Errors",
|
||||
"route": "Report/Scheduler Log", "type": "Link", "icon": "icon-exclamation-sign" },
|
||||
]
|
||||
|
||||
@webnotes.whitelist(allow_roles=["System Manager"])
|
||||
def get():
|
||||
for item in items:
|
||||
if item.get("type")=="Section":
|
||||
continue
|
||||
set_count(item)
|
||||
|
||||
if item.get("dependencies"):
|
||||
for d in item["dependencies"]:
|
||||
set_count(d)
|
||||
|
||||
return items
|
||||
|
||||
def set_count(item):
|
||||
if "query" in item:
|
||||
item["count"] = webnotes.conn.sql(item["query"])[0][0]
|
||||
elif "filter" in item:
|
||||
key = item["filter"].keys()[0]
|
||||
item["count"] = webnotes.conn.sql("""select count(*) from `tab%s` where
|
||||
%s = %s""" % (item["doctype"], key, "%s"),
|
||||
item["filter"][key])[0][0]
|
||||
elif "doctype" in item:
|
||||
item["count"] = webnotes.conn.sql("select count(*) from `tab%s`" \
|
||||
% item["doctype"])[0][0]
|
||||
Reference in New Issue
Block a user