deprecated dashboard
This commit is contained in:
parent
367f059895
commit
5417f5666c
@ -302,70 +302,4 @@ class DocType:
|
||||
for p in self.period_list:
|
||||
period_end_date = self.period_end_date[p].strftime('%Y-%m-%d')
|
||||
ret.append(get_balance_on(acc, period_end_date))
|
||||
return ret
|
||||
|
||||
def get_top_5_cust(self, company):
|
||||
rec_grp = sql("select receivables_group from tabCompany where name=%s", company)
|
||||
if rec_grp:
|
||||
pa_lft_rgt = sql("select lft, rgt from tabAccount where name=%s and company=%s", (rec_grp[0][0], company))[0]
|
||||
return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft > %s and t1.rgt < %s and t2.account = t1.name and ifnull(t2.is_cancelled, 'No') = 'No' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (pa_lft_rgt[0], pa_lft_rgt[1]))
|
||||
else:
|
||||
return []
|
||||
|
||||
def get_top_5_exp(self, company):
|
||||
a = sql("select distinct account_name, name, debit_or_credit, lft, rgt from `tabAccount` where account_name=%s and company=%s", ('Expenses', company), as_dict=1)[0]
|
||||
return sql("select t1.account_name, SUM(t2.debit) from tabAccount t1, `tabGL Entry` t2 where t1.lft>%s and t1.rgt<%s and t1.group_or_ledger = 'Ledger' and t2.account = t1.name and ifnull(t2.is_cancelled, 'No') = 'No' and t2.voucher_type != 'Period Closing Voucher' GROUP BY t1.name ORDER BY SUM(t2.debit) desc limit 5", (a['lft'],a['rgt']))
|
||||
|
||||
def bl(self, acc, company):
|
||||
dt = getdate(nowdate())
|
||||
|
||||
r = []
|
||||
# cur
|
||||
r.append(get_balance_on(acc, get_fiscal_year(nowdate())))
|
||||
# this month
|
||||
r.append(get_balance_on(acc, get_last_day(dt)))
|
||||
# last month
|
||||
r.append(get_balance_on(acc, get_last_day(get_first_day(dt,0,-1))))
|
||||
|
||||
return r
|
||||
|
||||
def bl_bs(self, acc, company, sd):
|
||||
dt = getdate(nowdate())
|
||||
r = []
|
||||
# cur
|
||||
r.append(get_balance_on(acc, get_fiscal_year(nowdate())))
|
||||
# last month
|
||||
r.append(self.get_balance_on(acc, get_last_day(get_first_day(dt,0,-1))))
|
||||
# opening
|
||||
r.append(self.get_balance_on(acc, sd))
|
||||
return r
|
||||
|
||||
def get_dashboard_values(self, arg=''):
|
||||
d = get_defaults()
|
||||
self.fiscal_year = d['fiscal_year']
|
||||
if arg:
|
||||
company = arg
|
||||
else:
|
||||
company = d['company']
|
||||
|
||||
r = {}
|
||||
r['Income'] = self.bl('Income', company)
|
||||
r['Expenses'] = self.bl('Expenses', company)
|
||||
|
||||
r['Profit'] = []
|
||||
for i in range(3):
|
||||
r['Profit'].append(r['Income'][i] - r['Expenses'][i])
|
||||
|
||||
r['Current Assets'] = self.bl_bs('Current Assets', company, getdate(d['year_start_date']))
|
||||
r['Current Liabilities'] = self.bl_bs('Current Liabilities', company, getdate(d['year_start_date']))
|
||||
|
||||
r['Working Capital'] = []
|
||||
for i in range(3):
|
||||
r['Working Capital'].append(r['Current Assets'][i] - r['Current Liabilities'][i])
|
||||
|
||||
r['Bank Accounts'] = self.bl_bs('Bank Accounts', company, getdate(d['year_start_date']))
|
||||
|
||||
r['Top Customers'] = convert_to_lists(self.get_top_5_cust(company))
|
||||
r['Top Expenses'] = convert_to_lists(self.get_top_5_exp(company))
|
||||
|
||||
return r
|
||||
return ret
|
@ -122,8 +122,6 @@ class DocType:
|
||||
def get_dt_help(self,dt):
|
||||
return sql("select description from tabDocType where name=%s",dt)[0][0] or ''
|
||||
|
||||
# get dashboard counts
|
||||
# --------------------
|
||||
def get_wip_counts(self):
|
||||
#dtl = ['Lead', 'Enquiries', 'Sales Order', 'Invoices', 'Purchase Request', 'Purchase Order', 'Bills', 'Tasks', 'Delivery Note', 'Maintenance']
|
||||
can_read_dt = ['Lead', 'Opportunity', 'Sales Order', 'Sales Invoice', 'Purchase Request', 'Purchase Order', 'Purchase Invoice', 'Delivery Note', 'Task', 'Serial No']
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,12 +0,0 @@
|
||||
div.dashboard_table td {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
div.dashboard-title {
|
||||
font-weight: bold;
|
||||
padding: '3px 0px';
|
||||
}
|
||||
|
||||
div.dashboard-graph {
|
||||
height: 180px;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<div class="layout_wrapper dashboard">
|
||||
<div class="header"></div>
|
||||
<div class="body">
|
||||
<!-- 4x2 table to show the dashboards-->
|
||||
<div class="help_box">Loading...</div>
|
||||
<div class="dashboard_table"></div>
|
||||
</div>
|
||||
</div>
|
@ -1,170 +0,0 @@
|
||||
// ERPNext - web based ERP (http://erpnext.com)
|
||||
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript.onload_dashboard = function() {
|
||||
// load jqplot
|
||||
wn.require('lib/js/lib/jqplot/css/jqplot.css');
|
||||
wn.require('lib/js/lib/jqplot/jquery.jqplot.min.js');
|
||||
wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.barRenderer.js');
|
||||
wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js');
|
||||
wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.canvasTextRenderer.min.js');
|
||||
wn.require('lib/js/lib/jqplot/jqplot-plugins/jqplot.categoryAxisRenderer.min.js');
|
||||
|
||||
|
||||
pscript.dashboard_settings = {
|
||||
company: sys_defaults.company,
|
||||
start: (function() {
|
||||
var start_date = dateutil.add_days(new Date(), -180);
|
||||
var year_start_date = dateutil.str_to_obj(sys_defaults.year_start_date);
|
||||
if (start_date < year_start_date) { start_date = year_start_date; }
|
||||
console.log(start_date);
|
||||
return dateutil.obj_to_str(start_date);
|
||||
})(),
|
||||
end: (function() {
|
||||
var end_date = new Date();
|
||||
var year_end_date = dateutil.str_to_obj(sys_defaults.year_end_date);
|
||||
if (end_date > year_end_date) { end_date = year_end_date; }
|
||||
console.log(end_date);
|
||||
return dateutil.obj_to_str(end_date);
|
||||
})(),
|
||||
interval: 30
|
||||
}
|
||||
|
||||
var ph = new PageHeader($('.dashboard .header').get(0), 'Dashboard');
|
||||
var db = new Dashboard();
|
||||
|
||||
ph.add_button('Settings', db.show_settings);
|
||||
|
||||
db.refresh();
|
||||
|
||||
}
|
||||
|
||||
Dashboard = function() {
|
||||
var me = this;
|
||||
$.extend(me, {
|
||||
refresh: function() {
|
||||
$('.dashboard .help_box').css('display', 'block');
|
||||
$c_page('home', 'dashboard', 'load_dashboard', JSON.stringify(pscript.dashboard_settings), function(r,rt) {
|
||||
$('.dashboard .help_box').css('display', 'none');
|
||||
me.render(r.message);
|
||||
})
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
$('.dashboard_table').html('');
|
||||
var t = make_table($('.dashboard_table').get(0), 4, 2, '100%', ['50%', '50%'], {padding: '5px'});
|
||||
var ridx=0; var cidx=0;
|
||||
for(var i=0; i< data.length; i++) {
|
||||
// switch columns and rows
|
||||
if(cidx==2) { cidx=0; ridx++}
|
||||
|
||||
// give an id!
|
||||
var cell = $td(t,ridx,cidx);
|
||||
var title = $a(cell, 'div', 'dashboard-title', '', data[i][0].title);
|
||||
var parent = $a(cell, 'div', 'dashboard-graph');
|
||||
if(data[i][0].comment);
|
||||
var comment = $a(cell, 'div', 'comment', '', data[i][0].comment)
|
||||
|
||||
parent.id = '_dashboard' + ridx + '-' + cidx;
|
||||
|
||||
// render graph
|
||||
me.render_graph(parent.id, data[i][1], data[i][0].fillColor);
|
||||
cidx++;
|
||||
}
|
||||
},
|
||||
|
||||
render_graph: function(parent, values, fillColor) {
|
||||
var vl = [];
|
||||
$.each(values, function(i,v) {
|
||||
vl.push([dateutil.str_to_user(v[0]), v[1]]);
|
||||
});
|
||||
$.jqplot(parent, [vl], {
|
||||
seriesDefaults:{
|
||||
renderer:$.jqplot.BarRenderer,
|
||||
rendererOptions: {fillToZero: true},
|
||||
},
|
||||
axes: {
|
||||
// Use a category axis on the x axis and use our custom ticks.
|
||||
xaxis: {
|
||||
min: 0,
|
||||
renderer: $.jqplot.CategoryAxisRenderer,
|
||||
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
|
||||
tickOptions: {
|
||||
angle: -30,
|
||||
fontSize: '8pt'
|
||||
}
|
||||
},
|
||||
// Pad the y axis just a little so bars can get close to, but
|
||||
// not touch, the grid boundaries. 1.2 is the default padding.
|
||||
yaxis: {
|
||||
min: 0,
|
||||
pad: 1.05,
|
||||
tickOptions: {formatString: '%d'}
|
||||
}
|
||||
},
|
||||
seriesColors: [fillColor]
|
||||
});
|
||||
},
|
||||
|
||||
show_settings: function() {
|
||||
var d = new wn.ui.Dialog({
|
||||
title: 'Set Company Settings',
|
||||
width: 500,
|
||||
fields: [
|
||||
{
|
||||
label:'Company',
|
||||
reqd: 1,
|
||||
fieldname:'company',
|
||||
fieldtype:'Link',
|
||||
options: 'Company'
|
||||
},
|
||||
{
|
||||
label:'Start Date',
|
||||
reqd: 1,
|
||||
fieldname:'start',
|
||||
fieldtype:'Date',
|
||||
},
|
||||
{
|
||||
label:'End Date',
|
||||
reqd: 1,
|
||||
fieldname:'end',
|
||||
fieldtype:'Date',
|
||||
},
|
||||
{
|
||||
label:'Interval',
|
||||
reqd: 1,
|
||||
fieldname:'interval',
|
||||
fieldtype:'Int'
|
||||
},
|
||||
{
|
||||
label:'Regenerate',
|
||||
fieldname:'refresh',
|
||||
fieldtype:'Button'
|
||||
}
|
||||
]
|
||||
});
|
||||
d.onshow = function() {
|
||||
d.set_values(pscript.dashboard_settings);
|
||||
}
|
||||
d.fields_dict.refresh.input.onclick = function() {
|
||||
pscript.dashboard_settings = d.get_values();
|
||||
me.refresh();
|
||||
d.hide();
|
||||
}
|
||||
d.show();
|
||||
}
|
||||
})
|
||||
}
|
@ -1,281 +0,0 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
dashboards = [
|
||||
{
|
||||
'type': 'account',
|
||||
'account': 'Income',
|
||||
'title': 'Income',
|
||||
'fillColor': '#90EE90'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'account',
|
||||
'account': 'Expenses',
|
||||
'title': 'Expenses',
|
||||
'fillColor': '#90EE90'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'receivables',
|
||||
'title': 'Receivables',
|
||||
'fillColor': '#FFE4B5'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'payables',
|
||||
'title': 'Payables',
|
||||
'fillColor': '#FFE4B5'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'collection',
|
||||
'title': 'Collection',
|
||||
'comment':'This info comes from the accounts your have marked as "Bank or Cash"',
|
||||
'fillColor': '#DDA0DD'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'payments',
|
||||
'title': 'Payments',
|
||||
'comment':'This info comes from the accounts your have marked as "Bank or Cash"',
|
||||
'fillColor': '#DDA0DD'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'creation',
|
||||
'doctype': 'Quotation',
|
||||
'title': 'New Quotations',
|
||||
'fillColor': '#ADD8E6'
|
||||
},
|
||||
|
||||
{
|
||||
'type': 'creation',
|
||||
'doctype': 'Sales Order',
|
||||
'title': 'New Orders',
|
||||
'fillColor': '#ADD8E6'
|
||||
}
|
||||
]
|
||||
|
||||
import webnotes
|
||||
|
||||
class DashboardWidget:
|
||||
def __init__(self, company, start, end, interval):
|
||||
from webnotes.utils import getdate
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
self.company = company
|
||||
self.abbr = webnotes.conn.get_value('Company', company, 'abbr')
|
||||
self.start = getdate(start)
|
||||
self.end = getdate(end)
|
||||
|
||||
self.interval = interval
|
||||
|
||||
self.glc = get_obj('GL Control')
|
||||
self.cash_accounts = [d[0] for d in webnotes.conn.sql("""
|
||||
select name from tabAccount
|
||||
where account_type='Bank or Cash'
|
||||
and company = %s and docstatus = 0
|
||||
""", company)]
|
||||
|
||||
self.receivables_group = webnotes.conn.get_value('Company', company,'receivables_group')
|
||||
self.payables_group = webnotes.conn.get_value('Company', company,'payables_group')
|
||||
|
||||
# list of bank and cash accounts
|
||||
self.bc_list = [s[0] for s in webnotes.conn.sql("select name from tabAccount where account_type='Bank or Cash'")]
|
||||
|
||||
|
||||
def timeline(self):
|
||||
"""
|
||||
get the timeline for the dashboard
|
||||
"""
|
||||
import webnotes
|
||||
from webnotes.utils import add_days
|
||||
tl = []
|
||||
|
||||
if self.start > self.end:
|
||||
webnotes.msgprint("Start must be before end", raise_exception=1)
|
||||
|
||||
curr = self.start
|
||||
tl.append(curr)
|
||||
|
||||
while curr < self.end:
|
||||
curr = add_days(curr, self.interval, 'date')
|
||||
tl.append(curr)
|
||||
|
||||
tl.append(self.end)
|
||||
|
||||
return tl
|
||||
|
||||
def generate(self, opts):
|
||||
"""
|
||||
Generate the dasboard
|
||||
"""
|
||||
from webnotes.utils import flt
|
||||
tl = self.timeline()
|
||||
self.out = []
|
||||
|
||||
for i in range(len(tl)-1):
|
||||
self.out.append([tl[i+1].strftime('%Y-%m-%d'), flt(self.value(opts, tl[i], tl[i+1])) or 0])
|
||||
|
||||
return self.out
|
||||
|
||||
def get_account_balance(self, acc, start):
|
||||
"""
|
||||
Get as on account balance
|
||||
"""
|
||||
import webnotes
|
||||
# add abbreviation to company
|
||||
|
||||
if not acc.endswith(self.abbr):
|
||||
acc += ' - ' + self.abbr
|
||||
|
||||
# get other reqd parameters
|
||||
try:
|
||||
globals().update(webnotes.conn.sql('select debit_or_credit, lft, rgt from tabAccount where name=%s', acc, as_dict=1)[0])
|
||||
except Exception,e:
|
||||
webnotes.msgprint('Wrongly defined account: ' + acc)
|
||||
print acc
|
||||
raise e
|
||||
|
||||
from accounts.utils import get_fiscal_year, get_balance_on
|
||||
fy_end_date = get_fiscal_year(start)[2]
|
||||
return get_balance_on(acc, fy_end_date)
|
||||
|
||||
def get_fiscal_year(self, dt):
|
||||
"""
|
||||
get fiscal year from date
|
||||
"""
|
||||
import webnotes
|
||||
fiscal_year = webnotes.conn.sql("""
|
||||
select name from `tabFiscal Year`
|
||||
where year_start_date <= %s and
|
||||
DATE_ADD(year_start_date, INTERVAL 1 YEAR) >= %s
|
||||
""", (dt, dt))
|
||||
return fiscal_year and (fiscal_year[0] and fiscal_year[0][0]) or None
|
||||
|
||||
def get_creation_trend(self, doctype, start, end):
|
||||
"""
|
||||
Get creation # of creations in period
|
||||
"""
|
||||
import webnotes
|
||||
return int(webnotes.conn.sql("""
|
||||
select count(*) from `tab%s` where creation between %s and %s and docstatus=1
|
||||
""" % (doctype, '%s','%s'), (start, end))[0][0])
|
||||
|
||||
def get_account_amt(self, acc, start, end, debit_or_credit):
|
||||
"""
|
||||
Get debit, credit over a period
|
||||
"""
|
||||
import webnotes
|
||||
# add abbreviation to company
|
||||
|
||||
if not acc.endswith(self.abbr):
|
||||
acc += ' - ' + self.abbr
|
||||
|
||||
ret = webnotes.conn.sql("""
|
||||
select ifnull(sum(ifnull(t1.debit,0)),0), ifnull(sum(ifnull(t1.credit,0)),0)
|
||||
from `tabGL Entry` t1, tabAccount t2
|
||||
where t1.account = t2.name
|
||||
and t2.is_pl_account = 'Yes'
|
||||
and t2.debit_or_credit=%s
|
||||
and ifnull(t1.is_cancelled, 'No')='No'
|
||||
and t1.posting_date between %s and %s
|
||||
""", (debit_or_credit, start, end))[0]
|
||||
|
||||
return debit_or_credit=='Credit' and float(ret[1]-ret[0]) or float(ret[0]-ret[1])
|
||||
|
||||
def get_bank_amt(self, debit_or_credit, master_type, start, end):
|
||||
"""
|
||||
Get collection (reduction in receivables over a period)
|
||||
"""
|
||||
import webnotes
|
||||
|
||||
reg = '('+'|'.join(self.bc_list) + ')'
|
||||
|
||||
return webnotes.conn.sql("""
|
||||
select sum(t1.%s)
|
||||
from `tabGL Entry` t1, tabAccount t2
|
||||
where t1.account = t2.name
|
||||
and t2.master_type='%s'
|
||||
and t1.%s > 0
|
||||
and t1.against REGEXP '%s'
|
||||
and ifnull(t1.is_cancelled, 'No')='No'
|
||||
and t1.posting_date between '%s' and '%s'
|
||||
""" % (debit_or_credit, master_type, debit_or_credit, reg, start, end))[0][0]
|
||||
|
||||
|
||||
def value(self, opts, start, end):
|
||||
"""
|
||||
Value of the series on a particular date
|
||||
"""
|
||||
import webnotes
|
||||
if opts['type']=='account':
|
||||
debit_or_credit = 'Debit'
|
||||
if opts['account']=='Income':
|
||||
debit_or_credit = 'Credit'
|
||||
|
||||
return self.get_account_amt(opts['account'], start, end, debit_or_credit)
|
||||
|
||||
elif opts['type']=='receivables':
|
||||
return self.get_account_balance(self.receivables_group, end)
|
||||
|
||||
elif opts['type']=='payables':
|
||||
return self.get_account_balance(self.payables_group, end)
|
||||
|
||||
elif opts['type']=='collection':
|
||||
return self.get_bank_amt('credit', 'Customer', start, end)
|
||||
|
||||
elif opts['type']=='payments':
|
||||
return self.get_bank_amt('debit', 'Supplier', start, end)
|
||||
|
||||
elif opts['type']=='creation':
|
||||
return self.get_creation_trend(opts['doctype'], start, end)
|
||||
|
||||
@webnotes.whitelist()
|
||||
def load_dashboard(args):
|
||||
"""
|
||||
Get dashboard based on
|
||||
1. Company (default company)
|
||||
2. Start Date (last 3 months)
|
||||
3. End Date (today)
|
||||
4. Interval (7 days)
|
||||
"""
|
||||
dl = []
|
||||
import json
|
||||
args = json.loads(args)
|
||||
dw = DashboardWidget(args['company'], args['start'], args['end'], int(args['interval']))
|
||||
|
||||
# render the dashboards
|
||||
for d in dashboards:
|
||||
dl.append([d, dw.generate(d)])
|
||||
|
||||
return dl
|
||||
|
||||
if __name__=='__main__':
|
||||
import sys
|
||||
sys.path.append('/var/www/webnotes/wnframework/cgi-bin')
|
||||
from webnotes.db import Database
|
||||
import webnotes
|
||||
webnotes.conn = Database(use_default=1)
|
||||
webnotes.session = {'user':'Administrator'}
|
||||
print load_dashboard("""{
|
||||
"company": "My Test",
|
||||
"start": "2011-05-01",
|
||||
"end": "2011-08-01",
|
||||
"interval": "7"
|
||||
}""")
|
@ -1,49 +0,0 @@
|
||||
# Page, dashboard
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-08-25 16:22:44',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-08-25 16:22:54',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Page
|
||||
{
|
||||
'category': 'Standard',
|
||||
'doctype': 'Page',
|
||||
'module': 'Home',
|
||||
'name': '__common__',
|
||||
'page_name': 'Dashboard',
|
||||
'standard': 'Yes'
|
||||
},
|
||||
|
||||
# These values are common for all Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'name': '__common__',
|
||||
'parent': 'dashboard',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Page'
|
||||
},
|
||||
|
||||
# Page, dashboard
|
||||
{
|
||||
'doctype': 'Page',
|
||||
'name': 'dashboard'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'role': 'System Manager'
|
||||
},
|
||||
|
||||
# Page Role
|
||||
{
|
||||
'doctype': 'Page Role',
|
||||
'role': 'Accounts Manager'
|
||||
}
|
||||
]
|
@ -2,7 +2,6 @@
|
||||
.sprite-account{ background-position: 0 0; width: 32px; height: 40px; }
|
||||
.sprite-buying{ background-position: 0 -90px; width: 40px; height: 40px; }
|
||||
.sprite-calendar{ background-position: 0 -180px; width: 35px; height: 40px; }
|
||||
.sprite-dashboard{ background-position: 0 -270px; width: 40px; height: 29px; }
|
||||
.sprite-feed{ background-position: 0 -349px; width: 32px; height: 40px; }
|
||||
.sprite-hr{ background-position: 0 -439px; width: 40px; height: 32px; }
|
||||
.sprite-kb{ background-position: 0 -521px; width: 24px; height: 39px; }
|
||||
@ -30,7 +29,6 @@
|
||||
.sprite-production{ margin-top: 10px; margin-left: 8px; }
|
||||
.sprite-website{ margin-top: 8px; margin-left: 8px; }
|
||||
.sprite-setting{ margin-top: 8px; margin-left: 8px; }
|
||||
.sprite-dashboard{ margin-top: 14px; margin-left: 8px; }
|
||||
.sprite-report{ margin-top: 8px; margin-left: 14px; }
|
||||
|
||||
.sprite-messages{ margin-top: 14px; margin-left: 8px; }
|
||||
|
@ -37,7 +37,6 @@ erpnext.desktop.render = function() {
|
||||
'Website': { sprite: 'website', label: 'Website'},
|
||||
'Activity': { sprite: 'feed', label: 'Activity'},
|
||||
'Setup': { sprite: 'setting', label: 'Setup'},
|
||||
'Dashboard': { sprite: 'dashboard', label: 'Dashboard'},
|
||||
'To Do': { sprite: 'todo', label: 'To Do'},
|
||||
'Messages': { sprite: 'messages', label: 'Messages'},
|
||||
'Calendar': { sprite: 'calendar', label: 'Calendar'},
|
||||
@ -61,12 +60,10 @@ erpnext.desktop.render = function() {
|
||||
// setup
|
||||
for(var i in wn.boot.modules_list) {
|
||||
var m = wn.boot.modules_list[i];
|
||||
if(!in_list(['Setup', 'Dashboard'], m) && wn.boot.profile.allow_modules.indexOf(m)!=-1)
|
||||
if(!in_list(['Setup'], m) && wn.boot.profile.allow_modules.indexOf(m)!=-1)
|
||||
add_icon(m);
|
||||
}
|
||||
|
||||
if(user_roles.indexOf('Accounts Manager')!=-1)
|
||||
add_icon('Dashboard')
|
||||
|
||||
if(user_roles.indexOf('System Manager')!=-1)
|
||||
add_icon('Setup')
|
||||
|
@ -30,7 +30,6 @@ erpnext.modules = {
|
||||
'Calendar': 'calendar',
|
||||
'Messages': 'messages',
|
||||
'Knowledge Base': 'questions',
|
||||
'Dashboard': 'dashboard'
|
||||
}
|
||||
|
||||
// wn.modules is used in breadcrumbs for getting module home page
|
||||
@ -70,7 +69,6 @@ wn.module_css_map = {
|
||||
'Website': 'leaf-green',
|
||||
'Activity': 'brown',
|
||||
'Setup': 'grey',
|
||||
'Dashboard': 'bright-green',
|
||||
'To Do': 'bright-yellow',
|
||||
'Messages': 'pink',
|
||||
'Calendar': 'peacock',
|
||||
|
@ -65,7 +65,6 @@ span, div, td, input, textarea, button, select {
|
||||
.small-module-icons-accounts{ background-position: 0 0; width: 14px; height: 17px; margin-top: -2px; margin-bottom: -2px; }
|
||||
.small-module-icons-selling{ background-position: 0 -67px; width: 14px; height: 17px; margin-top: -2px; margin-bottom: -2px; }
|
||||
.small-module-icons-calendar{ background-position: 0 -134px; width: 15px; height: 17px; margin-top: -2px; margin-bottom: -2px; }
|
||||
.small-module-icons-dashboard{ background-position: 0 -201px; width: 17px; height: 12px; }
|
||||
.small-module-icons-feed{ background-position: 0 -263px; width: 14px; height: 17px; margin-top: -2px; margin-bottom: -2px; }
|
||||
.small-module-icons-hr{ background-position: 0 -330px; width: 17px; height: 14px; margin-top: -1px; }
|
||||
.small-module-icons-kb{ background-position: 0 -394px; width: 10px; height: 17px; margin-top: -2px; margin-bottom: -2px; }
|
||||
|
@ -76,12 +76,6 @@ erpnext.toolbar.add_modules = function() {
|
||||
data-module="%(module)s">%(module_label)s</a></li>', args));
|
||||
}
|
||||
}
|
||||
|
||||
// dasboard for accounts system manager
|
||||
if(user_roles.indexOf("Accounts Manager")!=-1) {
|
||||
$('.navbar .modules').append('<li><a href="#!dashboard" \
|
||||
data-module="Dashboard">Dashboard</a></li>');
|
||||
}
|
||||
|
||||
// setup for system manager
|
||||
if(user_roles.indexOf("System Manager")!=-1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user