Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait
2012-10-04 18:35:47 +05:30
36 changed files with 537 additions and 199 deletions

View File

@@ -3,42 +3,47 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2010-12-14 10:23:28', u'creation': '2012-06-14 15:07:28',
'docstatus': 0, u'docstatus': 0,
'modified': '2010-12-29 12:57:23', u'modified': '2012-10-04 16:57:27',
'modified_by': 'Administrator', u'modified_by': u'Administrator',
'owner': 'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': 'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'page_name': 'Accounts Browser', 'page_name': u'Accounts Browser',
'show_in_menu': 0, 'show_in_menu': 0,
'standard': 'Yes' 'standard': u'Yes'
}, },
# These values are common for all Page Role # These values are common for all Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'idx': 1, u'name': u'__common__',
'name': '__common__', 'parent': u'Accounts Browser',
'parent': 'Accounts Browser', 'parentfield': u'roles',
'parentfield': 'roles', 'parenttype': u'Page'
'parenttype': 'Page',
'role': 'Accounts User'
}, },
# Page, Accounts Browser # Page, Accounts Browser
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': 'Accounts Browser' u'name': u'Accounts Browser'
}, },
# Page Role # Page Role
{ {
'doctype': 'Page Role' u'doctype': u'Page Role',
'role': u'Accounts User'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
} }
] ]

View File

@@ -12,23 +12,29 @@
<p class="help">Bills raised by Suppliers</p> <p class="help">Bills raised by Suppliers</p>
</div> </div>
<div style="width: 48%; float: right;"> <div style="width: 48%; float: right;">
<h4><a href="#!Accounts Browser/Account">Chart of Accounts</a></h4> <h4><a href="#!Accounts Browser/Account"
data-role="Accounts Manager, Accounts User">Chart of Accounts</a></h4>
<p class="help">Structure of books of accounts</p> <p class="help">Structure of books of accounts</p>
<br> <br>
<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4> <h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
<p class="help">Structure cost centers</p> <p class="help">Structure cost centers</p>
<br> <br>
<h4><a href="#general-ledger" data-role="Analytics">General Ledger</a> <h4><a href="#general-ledger"
data-role="Analytics, Accounts Manager, Accounts User">
General Ledger</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">General Ledger Report</p> <p class="help">General Ledger Report</p>
<br> <br>
<h4><a href="#trial-balance" data-role="Analytics">Trial Balance</a> <h4><a href="#trial-balance"
data-role="Analytics, Accounts Manager, Accounts User">Trial Balance</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Tree view of all Account balances</p> <p class="help">Tree view of all Account balances</p>
<br> <br>
<h4><a href="#financial-analytics" data-role="Analytics">Financial Analytics</a> <h4><a href="#financial-analytics"
data-role="Analytics, Accounts Manager, Accounts User">
Financial Analytics</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Visual representation of financial trends</p> <p class="help">Visual representation of financial trends</p>
@@ -64,17 +70,18 @@
href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales or Purchase Returns</a> href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales or Purchase Returns</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" data-role="Analytics" <a class="section-link"
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc" title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a> href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" data-role="Accounts Manager" <a class="section-link"
data-role="Accounts Manager, Accounts User"
title = "Check your Balance Sheet and Profit & Loss Statement" title = "Check your Balance Sheet and Profit & Loss Statement"
href="#!Financial Statements">Financial Statements</a> href="#!Financial Statements">Financial Statements</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link" data-role="Accounts Manager"
title = "Import Multiple Vouchers from CSV" title = "Import Multiple Vouchers from CSV"
href="#voucher-import-tool">Voucher Import Tool</a> href="#voucher-import-tool">Voucher Import Tool</a>
</div> </div>

View File

@@ -22,11 +22,4 @@ pscript['onload_accounts-home'] = function(wrapper) {
$('.india-specific').toggle(false); $('.india-specific').toggle(false);
} }
if(wn.boot.profile.roles.indexOf('Accounts Manager')==-1 && wn.boot.profile.roles.indexOf('Accounts User')==-1) {
$('[href*="Accounts Browser"]').each(function() {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
});
}
} }

View File

@@ -3,26 +3,47 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-02-21 13:23:08', u'creation': '2012-06-14 15:07:28',
'docstatus': 0, u'docstatus': 0,
'modified': '2012-02-21 13:23:08', u'modified': '2012-10-04 16:58:11',
'modified_by': u'Administrator', u'modified_by': u'Administrator',
'owner': u'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': u'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'page_name': u'accounts-home', 'page_name': u'accounts-home',
'standard': u'Yes', 'standard': u'Yes',
'title': u'Accounts Home' 'title': u'Accounts Home'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'accounts-home',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, accounts-home # Page, accounts-home
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': u'accounts-home' u'name': u'accounts-home'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts User'
} }
] ]

View File

@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/account_tree_grid.js"); wn.require("app/js/account_tree_grid.js");
wn.pages['financial-analytics'].onload = function(wrapper) { wn.pages['financial-analytics'].onload = function(wrapper) {

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-17 13:46:47', u'creation': '2012-09-18 11:05:48',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-17 13:46:47', u'modified': '2012-10-04 17:02:43',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,36 @@
'title': u'Financial Analytics' 'title': u'Financial Analytics'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'financial-analytics',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, financial-analytics # Page, financial-analytics
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'financial-analytics' u'name': u'financial-analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts User'
} }
] ]

View File

@@ -3,56 +3,47 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2010-10-12 15:19:32', u'creation': '2012-06-14 15:07:28',
'docstatus': 0, u'docstatus': 0,
'modified': '2011-01-03 17:32:30', u'modified': '2012-10-04 17:04:05',
'modified_by': 'Administrator', u'modified_by': u'Administrator',
'owner': 'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': 'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'page_name': 'Financial Statements', 'page_name': u'Financial Statements',
'show_in_menu': 0, 'show_in_menu': 0,
'standard': 'Yes' 'standard': u'Yes'
}, },
# These values are common for all Page Role # These values are common for all Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'name': '__common__', u'name': u'__common__',
'parent': 'Financial Statements', 'parent': u'Financial Statements',
'parentfield': 'roles', 'parentfield': u'roles',
'parenttype': 'Page' 'parenttype': u'Page'
}, },
# Page, Financial Statements # Page, Financial Statements
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': 'Financial Statements' u'name': u'Financial Statements'
}, },
# Page Role # Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'idx': 1, 'role': u'Accounts User'
'role': 'Accounts User'
}, },
# Page Role # Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'idx': 2, 'role': u'Accounts Manager'
'role': 'Administrator'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 3,
'role': 'Accounts Manager'
} }
] ]

View File

@@ -25,6 +25,8 @@ wn.pages['general-ledger'].onload = function(wrapper) {
} }
wn.require("lib/js/wn/views/grid_report.js");
erpnext.GeneralLedger = wn.views.GridReport.extend({ erpnext.GeneralLedger = wn.views.GridReport.extend({
init: function(wrapper) { init: function(wrapper) {
this._super({ this._super({

View File

@@ -3,26 +3,53 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-09-13 13:50:13', u'creation': '2012-09-14 11:25:48',
'docstatus': 0, u'docstatus': 0,
'modified': '2012-09-13 13:50:13', u'modified': '2012-10-04 17:00:09',
'modified_by': u'Administrator', u'modified_by': u'Administrator',
'owner': u'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': u'Accounts', 'module': u'Accounts',
'name': '__common__', u'name': u'__common__',
'page_name': u'general-ledger', 'page_name': u'general-ledger',
'standard': u'Yes', 'standard': u'Yes',
'title': u'General Ledger' 'title': u'General Ledger'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'general-ledger',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, general-ledger # Page, general-ledger
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': u'general-ledger' u'name': u'general-ledger'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts User'
} }
] ]

View File

@@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/account_tree_grid.js"); wn.require("app/js/account_tree_grid.js");
wn.pages['trial-balance'].onload = function(wrapper) { wn.pages['trial-balance'].onload = function(wrapper) {

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-17 13:47:16', u'creation': '2012-09-18 11:05:48',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-17 13:47:16', u'modified': '2012-10-04 17:01:47',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,36 @@
'title': u'Trial Balance' 'title': u'Trial Balance'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'trial-balance',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, trial-balance # Page, trial-balance
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'trial-balance' u'name': u'trial-balance'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts User'
} }
] ]

View File

@@ -35,12 +35,12 @@ def upload():
rows = read_csv_content_from_uploaded_file() rows = read_csv_content_from_uploaded_file()
common_values = get_common_values(rows) common_values = get_common_values(rows)
data = get_data(rows) data, start_idx = get_data(rows)
if rows[0][0]=="Voucher Import :Single": if rows[0][0]=="Voucher Import :Single":
return import_single(common_values, data) return import_single(common_values, data, start_idx)
else: else:
return import_multiple(common_values, data) return import_multiple(common_values, data, start_idx)
def map_fields(field_list, source, target): def map_fields(field_list, source, target):
for f in field_list: for f in field_list:
@@ -49,12 +49,12 @@ def map_fields(field_list, source, target):
else: else:
target[f] = source.get(f) target[f] = source.get(f)
def import_multiple(common_values, data): def import_multiple(common_values, data, start_idx):
from webnotes.model.doc import Document from webnotes.model.doc import Document
from webnotes.model.doclist import DocList from webnotes.model.doclist import DocList
from webnotes.model.code import get_obj from webnotes.model.code import get_obj
from accounts.utils import get_fiscal_year_from_date from accounts.utils import get_fiscal_year
from webnotes.utils.dateutils import user_to_str from webnotes.utils.dateutils import parse_date
messages = [] messages = []
@@ -82,17 +82,17 @@ def import_multiple(common_values, data):
jv = webnotes.DictObj() jv = webnotes.DictObj()
try: try:
d.posting_date = user_to_str(d.posting_date) d.posting_date = parse_date(d.posting_date)
d.due_date = user_to_str(d.due_date) d.due_date = parse_date(d.due_date)
d.ref_date = user_to_str(d.ref_date) d.ref_date = parse_date(d.ref_date)
d.company = common_values.company d.company = common_values.company
jv = Document("Journal Voucher") jv = Document("Journal Voucher")
map_fields(["voucher_type", "posting_date", "naming_series", "remarks:remark", map_fields(["voucher_type", "posting_date", "naming_series", "remarks:remark",
"ref_no:cheque_no", "ref_date:cheque_date", "is_opening", "ref_number:cheque_no", "ref_date:cheque_date", "is_opening",
"amount:total_debit", "amount:total_credit", "due_date", "company"], d, jv.fields) "amount:total_debit", "amount:total_credit", "due_date", "company"], d, jv.fields)
jv.fiscal_year = get_fiscal_year_from_date(jv.posting_date) jv.fiscal_year = get_fiscal_year(jv.posting_date)[0]
detail1 = Document("Journal Voucher Detail") detail1 = Document("Journal Voucher Detail")
detail1.parent = True detail1.parent = True
@@ -112,13 +112,15 @@ def import_multiple(common_values, data):
doclist.submit() doclist.submit()
webnotes.conn.commit() webnotes.conn.commit()
messages.append("<p style='color: green'>[row #%s] %s imported</p>" \ messages.append("""<p style='color: green'>[row #%s]
% (i, jv.name)) <a href=\"#Form/Journal Voucher/%s\">%s</a> imported</p>""" \
% ((start_idx + 1) + i, jv.name, jv.name))
except Exception, e: except Exception, e:
webnotes.conn.rollback() webnotes.conn.rollback()
err_msg = webnotes.message_log and webnotes.message_log[0] or unicode(e)
messages.append("<p style='color: red'>[row #%s] %s failed: %s</p>" \ messages.append("<p style='color: red'>[row #%s] %s failed: %s</p>" \
% (i, jv.name, webnotes.message_log and webnotes.message_log[0] or "No message")) % ((start_idx + 1) + i, jv.name, err_msg or "No message"))
webnotes.errprint(webnotes.getTraceback()) webnotes.errprint(webnotes.getTraceback())
webnotes.message_log = [] webnotes.message_log = []
@@ -142,11 +144,13 @@ def get_common_values(rows):
def get_data(rows): def get_data(rows):
start_row = 0 start_row = 0
data = [] data = []
start_row_idx = 0
for i in xrange(len(rows)): for i in xrange(len(rows)):
r = rows[i] r = rows[i]
if r[0]: if r[0]:
if start_row and i >= start_row: if start_row and i >= start_row:
if not start_row_idx: start_row_idx = i
d = webnotes.DictObj() d = webnotes.DictObj()
for cidx in xrange(len(columns)): for cidx in xrange(len(columns)):
d[columns[cidx]] = r[cidx] d[columns[cidx]] = r[cidx]
@@ -155,7 +159,8 @@ def get_data(rows):
if r[0]=="--------Data----------": if r[0]=="--------Data----------":
start_row = i+2 start_row = i+2
columns = [c.replace(" ", "_").lower() for c in rows[i+1]] columns = [c.replace(" ", "_").lower() for c in rows[i+1]]
return data
return data, start_row_idx
@webnotes.whitelist() @webnotes.whitelist()
def get_template_single(): def get_template_single():

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-26 15:21:57', u'creation': '2012-10-02 18:51:49',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-26 15:21:57', u'modified': '2012-10-04 17:04:18',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,24 @@
'title': u'Voucher Import Tool' 'title': u'Voucher Import Tool'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'voucher-import-tool',
'parentfield': u'roles',
'parenttype': u'Page',
'role': u'Accounts Manager'
},
# Page, voucher-import-tool # Page, voucher-import-tool
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'voucher-import-tool' u'name': u'voucher-import-tool'
},
# Page Role
{
u'doctype': u'Page Role'
} }
] ]

View File

@@ -24,7 +24,8 @@
<h4><a href="#!List/Address">Address</a></h4> <h4><a href="#!List/Address">Address</a></h4>
<p class="help">Address Master</p> <p class="help">Address Master</p>
<br> <br>
<h4><a href="#purchase-analytics" data-role="Analytics">Purchase Analytics</a> <h4><a href="#purchase-analytics" data-role="Analytics, Purchase Manager">
Purchase Analytics</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Purchase trends based on Purchase Invoice</p> <p class="help">Purchase trends based on Purchase Invoice</p>
@@ -49,6 +50,13 @@
title = "Supplier classification" title = "Supplier classification"
href="#!List/Supplier Type">Supplier Type</a> href="#!List/Supplier Type">Supplier Type</a>
</div> </div>
<div class="section-item">
<a class="section-link"
title = "Tree of item classification"
href="#!Sales Browser/Item Group"
data-role="Purchase Manager, Purchase Master Manager
Accounts Manager">Item Group</a>
</div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Helper for managing return of goods (sales or purchase)" title = "Helper for managing return of goods (sales or purchase)"

View File

@@ -23,6 +23,7 @@ wn.pages['purchase-analytics'].onload = function(wrapper) {
new erpnext.PurchaseAnalytics(wrapper); new erpnext.PurchaseAnalytics(wrapper);
} }
wn.require("lib/js/wn/views/grid_report.js");
erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({ erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
init: function(wrapper) { init: function(wrapper) {

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-21 15:21:10', u'creation': '2012-09-21 20:15:16',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-21 15:21:10', u'modified': '2012-10-04 17:24:17',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,30 @@
'title': u'Purchase Analytics' 'title': u'Purchase Analytics'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'purchase-analytics',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, purchase-analytics # Page, purchase-analytics
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'purchase-analytics' u'name': u'purchase-analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Purchase Manager'
} }
] ]

View File

@@ -12,7 +12,7 @@
<p class="help">Timesheet for tasks</p> <p class="help">Timesheet for tasks</p>
</div> </div>
<div style="width: 48%; float: right;"> <div style="width: 48%; float: right;">
<h4><a href="#!Projects">Gantt Chart</a></h4> <h4><a href="#!Projects" data-role="Projects User">Gantt Chart</a></h4>
<p class="help">Gantt chart of all tasks</p> <p class="help">Gantt chart of all tasks</p>
</div> </div>
<div style="clear: both"></div> <div style="clear: both"></div>

View File

@@ -128,7 +128,10 @@ erpnext.module_page.hide_links = function(wrapper) {
// pages // pages
$(wrapper).find('[data-role]').each(function() { $(wrapper).find('[data-role]').each(function() {
if(!has_common(user_roles, [$(this).attr("data-role"), "System Manager"])) { // can define multiple roles
var data_roles = $(this).attr("data-role").split(",").map(function(role) {
return role.trim(); });
if(!has_common(user_roles, ["System Manager"].concat(data_roles))) {
var html = $(this).html(); var html = $(this).html();
$(this).parent().css('color', '#999'); $(this).parent().css('color', '#999');
$(this).replaceWith('<span title="Only accessible by Roles: '+ $(this).replaceWith('<span title="Only accessible by Roles: '+
@@ -167,7 +170,8 @@ erpnext.module_page.make_list = function(module, wrapper) {
parent: $parent2, parent: $parent2,
method: 'utilities.get_report_list', method: 'utilities.get_report_list',
render_row: function(row, data) { render_row: function(row, data) {
$(row).html(repl('<a href="#!Report2/%(ref_doctype)s/%(name)s" \ data.report_type = data.is_query_report ? "query-report" : "Report2"
$(row).html(repl('<a href="#!%(report_type)s/%(ref_doctype)s/%(name)s" \
data-doctype="%(ref_doctype)s">\ data-doctype="%(ref_doctype)s">\
%(name)s</a>', data)) %(name)s</a>', data))
}, },

View File

@@ -13,9 +13,9 @@
} }
.toggle.expand { .toggle.expand {
background: url(images/expand.gif) no-repeat center center; background: url(app/images/expand.gif) no-repeat center center;
} }
.toggle.collapse { .toggle.collapse {
background: url(images/collapse.gif) no-repeat center center; background: url(app/images/collapse.gif) no-repeat center center;
} }

View File

@@ -67,7 +67,6 @@ class DocType:
return ret return ret
def validate(self): def validate(self):
import string
if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason: if self.doc.status == 'Lead Lost' and not self.doc.order_lost_reason:
msgprint("Please Enter Lost Reason under More Info section") msgprint("Please Enter Lost Reason under More Info section")
raise Exception raise Exception
@@ -80,7 +79,6 @@ class DocType:
if not validate_email_add(self.doc.email_id): if not validate_email_add(self.doc.email_id):
msgprint('Please enter valid email id.') msgprint('Please enter valid email id.')
raise Exception raise Exception
def on_update(self): def on_update(self):
if self.doc.contact_date: if self.doc.contact_date:

View File

@@ -4,7 +4,8 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
this.fields = this.fields.concat([ this.fields = this.fields.concat([
'tabLead.lead_name', 'tabLead.lead_name',
'tabLead.status', 'tabLead.status',
'tabLead.source' 'tabLead.source',
'tabLead.modified_by'
]); ]);
this.stats = this.stats.concat(['status', 'source', 'rating', 'company']); this.stats = this.stats.concat(['status', 'source', 'rating', 'company']);
}, },
@@ -25,7 +26,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
columns: [ columns: [
{width: '3%', content: 'check'}, {width: '3%', content: 'check'},
{width: '5%', content:'avatar'}, {width: '5%', content:'avatar_modified'},
{width: '30%', content:'lead_name'}, {width: '30%', content:'lead_name'},
{width: '12%', content:'status_html'}, {width: '12%', content:'status_html'},
{width: '38%', content:'lead_status+tags', css: {color:'#222'}}, {width: '38%', content:'lead_status+tags', css: {color:'#222'}},

View File

@@ -23,6 +23,8 @@ wn.pages['sales-analytics'].onload = function(wrapper) {
new erpnext.SalesAnalytics(wrapper); new erpnext.SalesAnalytics(wrapper);
} }
wn.require("lib/js/wn/views/grid_report.js");
erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({ erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
init: function(wrapper) { init: function(wrapper) {
this._super({ this._super({

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-21 12:06:14', u'creation': '2012-09-21 20:15:12',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-21 12:06:14', u'modified': '2012-10-04 17:17:39',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,36 @@
'title': u'Sales Analytics' 'title': u'Sales Analytics'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'sales-analytics',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, sales-analytics # Page, sales-analytics
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'sales-analytics' u'name': u'sales-analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Sales Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Maintenance Manager'
} }
] ]

View File

@@ -3,49 +3,77 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2010-12-14 10:23:21', u'creation': '2012-06-14 15:07:26',
'docstatus': 0, u'docstatus': 0,
'modified': '2010-12-24 11:56:34', u'modified': '2012-10-04 17:34:55',
'modified_by': 'Administrator', u'modified_by': u'Administrator',
'owner': 'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': 'Selling', 'module': u'Selling',
'name': '__common__', u'name': u'__common__',
'page_name': 'Sales Browser', 'page_name': u'Sales Browser',
'show_in_menu': 0, 'show_in_menu': 0,
'standard': 'Yes' 'standard': u'Yes'
}, },
# These values are common for all Page Role # These values are common for all Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'name': '__common__', u'name': u'__common__',
'parent': 'Sales Browser', 'parent': u'Sales Browser',
'parentfield': 'roles', 'parentfield': u'roles',
'parenttype': 'Page' 'parenttype': u'Page'
}, },
# Page, Sales Browser # Page, Sales Browser
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': 'Sales Browser' u'name': u'Sales Browser'
}, },
# Page Role # Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'idx': 1, 'role': u'Sales Master Manager'
'role': 'Sales Master Manager'
}, },
# Page Role # Page Role
{ {
'doctype': 'Page Role', u'doctype': u'Page Role',
'idx': 2, 'role': u'Material Master Manager'
'role': 'Material Master Manager' },
# Page Role
{
u'doctype': u'Page Role',
'role': u'Accounts Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Sales Master Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Purchase Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Purchase Master Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Material Manager'
} }
] ]

View File

@@ -27,7 +27,8 @@
<h4><a href="#!List/Address">Address</a></h4> <h4><a href="#!List/Address">Address</a></h4>
<p class="help">Address Master</p> <p class="help">Address Master</p>
<br> <br>
<h4><a href="#sales-analytics" data-role="Analytics">Sales Analytics</a> <h4><a href="#sales-analytics" data-role="Analytics, Sales Manager,
Maintenance Manager">Sales Analytics</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Sales trends based on Sales Invoice</p> <p class="help">Sales trends based on Sales Invoice</p>
@@ -65,17 +66,23 @@
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Tree of customer groups" title = "Tree of customer groups"
href="#!Sales Browser/Customer Group">Customer Group</a> href="#!Sales Browser/Customer Group"
data-role="Sales Manager, Sales Master Manager,
Accounts Manager">Customer Group</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Tree of sales territories" title = "Tree of sales territories"
href="#!Sales Browser/Territory">Territory</a> href="#!Sales Browser/Territory"
data-role="Sales Manager, Sales Master Manager
Accounts Manager">Territory</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Sales persons and targets" title = "Sales persons and targets"
href="#!Sales Browser/Sales Person">Sales Person</a> href="#!Sales Browser/Sales Person"
data-role="Sales Manager, Sales Master Manager
Accounts Manager">Sales Person</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
@@ -85,7 +92,9 @@
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Tree of item classification" title = "Tree of item classification"
href="#!Sales Browser/Item Group">Item Group</a> href="#!Sales Browser/Item Group"
data-role="Sales Manager, Sales Master Manager
Accounts Manager">Item Group</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
@@ -108,15 +117,10 @@
href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales Returns</a> href="#!Form/Sales and Purchase Return Tool/Sales and Purchase Return Tool">Sales Returns</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc" title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a> href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
</div> </div>
<!--<div class="section-item">
<a class="section-link"
title = "sales trends"
href="#!Sales Dashboard">Sales Dashboard</a>
</div>-->
</div> </div>
</div> </div>
</div> </div>

View File

@@ -3,26 +3,41 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2012-02-28 17:48:39', u'creation': '2012-06-14 15:07:28',
'docstatus': 0, u'docstatus': 0,
'modified': '2012-02-28 17:48:39', u'modified': '2012-10-04 16:55:31',
'modified_by': u'Administrator', u'modified_by': u'Administrator',
'owner': u'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': u'Setup', 'module': u'Setup',
'name': '__common__', u'name': u'__common__',
'page_name': u'modules_setup', 'page_name': u'modules_setup',
'standard': u'Yes', 'standard': u'Yes',
'title': u'Modules Setup' 'title': u'Modules Setup'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'modules_setup',
'parentfield': u'roles',
'parenttype': u'Page',
'role': u'System Manager'
},
# Page, modules_setup # Page, modules_setup
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': u'modules_setup' u'name': u'modules_setup'
},
# Page Role
{
u'doctype': u'Page Role'
} }
] ]

View File

@@ -3,25 +3,40 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2010-12-16 23:46:03', u'creation': '2012-06-14 15:07:28',
'docstatus': 0, u'docstatus': 0,
'modified': '2011-07-04 16:58:27', u'modified': '2012-10-04 16:52:41',
'modified_by': 'Administrator', u'modified_by': u'Administrator',
'owner': 'Administrator' u'owner': u'Administrator'
}, },
# These values are common for all Page # These values are common for all Page
{ {
'doctype': 'Page', u'doctype': u'Page',
'module': 'Setup', 'module': u'Setup',
'name': '__common__', u'name': u'__common__',
'page_name': 'Setup', 'page_name': u'Setup',
'standard': 'Yes' 'standard': u'Yes'
},
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'Setup',
'parentfield': u'roles',
'parenttype': u'Page',
'role': u'System Manager'
}, },
# Page, Setup # Page, Setup
{ {
'doctype': 'Page', u'doctype': u'Page',
'name': 'Setup' u'name': u'Setup'
},
# Page Role
{
u'doctype': u'Page Role'
} }
] ]

View File

@@ -26,6 +26,7 @@ wn.pages['stock-ageing'].onload = function(wrapper) {
} }
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js"); wn.require("app/js/stock_grid_report.js");
erpnext.StockAgeing = erpnext.StockGridReport.extend({ erpnext.StockAgeing = erpnext.StockGridReport.extend({

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-21 18:21:31', u'creation': '2012-09-21 20:15:14',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-21 18:21:31', u'modified': '2012-10-04 17:34:24',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,30 @@
'title': u'Stock Ageing' 'title': u'Stock Ageing'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'stock-ageing',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, stock-ageing # Page, stock-ageing
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'stock-ageing' u'name': u'stock-ageing'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Material Manager'
} }
] ]

View File

@@ -24,6 +24,7 @@ wn.pages['stock-analytics'].onload = function(wrapper) {
new erpnext.StockAnalytics(wrapper); new erpnext.StockAnalytics(wrapper);
} }
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js"); wn.require("app/js/stock_grid_report.js");
erpnext.StockAnalytics = erpnext.StockGridReport.extend({ erpnext.StockAnalytics = erpnext.StockGridReport.extend({

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-20 12:13:45', u'creation': '2012-09-21 20:15:14',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-20 12:13:45', u'modified': '2012-10-04 17:32:20',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,30 @@
'title': u'Stock Analytics' 'title': u'Stock Analytics'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'stock-analytics',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, stock-analytics # Page, stock-analytics
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'stock-analytics' u'name': u'stock-analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Material Manager'
} }
] ]

View File

@@ -24,17 +24,20 @@
<h4><a href="#!List/Warehouse">Warehouse</a></h4> <h4><a href="#!List/Warehouse">Warehouse</a></h4>
<p class="help">Warehouse is where items are stored</p> <p class="help">Warehouse is where items are stored</p>
<br> <br>
<h4><a href="#stock-ledger" data-role="Analytics">Stock Ledger</a> <h4><a href="#stock-ledger" data-role="Analytics, Material Manager,
Material User">Stock Ledger</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Log of stock movements</p> <p class="help">Log of stock movements</p>
<br> <br>
<h4><a href="#stock-analytics" data-role="Analytics">Stock Analytics</a> <h4><a href="#stock-analytics" data-role="Analytics, Material Manager">
Stock Analytics</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Visual representation of stock trends</p> <p class="help">Visual representation of stock trends</p>
<br> <br>
<h4><a href="#stock-ageing" data-role="Analytics">Stock Ageing</a> <h4><a href="#stock-ageing" data-role="Analytics, Material Manager">
Stock Ageing</a>
<span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span> <span style="background-color: #fed; font-weight: normal; font-size: 80%">beta</span>
</h4> </h4>
<p class="help">Analysis of slow moving stock</p> <p class="help">Analysis of slow moving stock</p>
@@ -102,7 +105,9 @@
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"
title = "Tree of item classification" title = "Tree of item classification"
href="#!Sales Browser/Item Group">Item Group</a> href="#!Sales Browser/Item Group"
data-role="Material Master Master, Material Manager,
Accounts Manager">Item Group</a>
</div> </div>
<div class="section-item"> <div class="section-item">
<a class="section-link" <a class="section-link"

View File

@@ -24,6 +24,7 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
new erpnext.StockLedger(wrapper); new erpnext.StockLedger(wrapper);
} }
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js"); wn.require("app/js/stock_grid_report.js");
erpnext.StockLedger = erpnext.StockGridReport.extend({ erpnext.StockLedger = erpnext.StockGridReport.extend({

View File

@@ -3,9 +3,9 @@
# These values are common in all dictionaries # These values are common in all dictionaries
{ {
u'creation': '2012-09-18 14:55:15', u'creation': '2012-09-21 20:15:14',
u'docstatus': 0, u'docstatus': 0,
u'modified': '2012-09-18 14:55:15', u'modified': '2012-10-04 17:25:35',
u'modified_by': u'Administrator', u'modified_by': u'Administrator',
u'owner': u'Administrator' u'owner': u'Administrator'
}, },
@@ -20,9 +20,36 @@
'title': u'Stock Ledger' 'title': u'Stock Ledger'
}, },
# These values are common for all Page Role
{
u'doctype': u'Page Role',
u'name': u'__common__',
'parent': u'stock-ledger',
'parentfield': u'roles',
'parenttype': u'Page'
},
# Page, stock-ledger # Page, stock-ledger
{ {
u'doctype': u'Page', u'doctype': u'Page',
u'name': u'stock-ledger' u'name': u'stock-ledger'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Analytics'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Material Manager'
},
# Page Role
{
u'doctype': u'Page Role',
'role': u'Material User'
} }
] ]

View File

@@ -5,7 +5,9 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
this.fields = this.fields.concat([ this.fields = this.fields.concat([
"`tabSupport Ticket`.status", "`tabSupport Ticket`.status",
"`tabSupport Ticket`.subject", "`tabSupport Ticket`.subject",
"`tabSupport Ticket`.description" "`tabSupport Ticket`.description",
'`tabSupport Ticket`.modified_by'
]); ]);
this.stats = this.stats.concat(['status']); this.stats = this.stats.concat(['status']);
this.show_hide_check_column(); this.show_hide_check_column();
@@ -38,10 +40,11 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
columns: [ columns: [
{width: '3%', content: 'check'}, {width: '3%', content: 'check'},
{width: '5%', content:'avatar_modified'},
{width: '20%', content:'name'}, {width: '20%', content:'name'},
{width: '10%', content:'status_html'}, {width: '10%', content:'status_html'},
{width: '50%', content:'description+tags', css: {color:'#222'}}, {width: '50%', content:'description+tags', css: {color:'#222'}},
{width: '14%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} {width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
] ]
}); });

View File

@@ -16,27 +16,39 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes.utils import cint
@webnotes.whitelist() @webnotes.whitelist()
def get_sc_list(arg=None): def get_sc_list(arg=None):
"""return list of reports for the given module module""" """return list of reports for the given module module"""
webnotes.response['values'] = webnotes.conn.sql("""select limit_start = webnotes.form_dict.get("limit_start")
distinct criteria_name, doc_type, parent_doc_type limit_page_length = webnotes.form_dict.get("limit_page_length")
module = webnotes.form_dict.get("module")
webnotes.response['values'] = webnotes.conn.sql("""
select distinct criteria_name, doc_type, parent_doc_type
from `tabSearch Criteria` from `tabSearch Criteria`
where module='%(module)s' where module=%s
and docstatus in (0, NULL) and docstatus in (0, NULL)
and ifnull(disabled, 0) = 0 and ifnull(disabled, 0) = 0
order by criteria_name order by criteria_name
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) limit %s, %s""" % \
("%s", cint(limit_start), cint(limit_page_length)), (module,), as_dict=True)
@webnotes.whitelist() @webnotes.whitelist()
def get_report_list(): def get_report_list():
"""return list on new style reports for modules""" """return list on new style reports for modules"""
webnotes.response['values'] = webnotes.conn.sql("""select limit_start = webnotes.form_dict.get("limit_start")
distinct tabReport.name, tabReport.ref_doctype limit_page_length = webnotes.form_dict.get("limit_page_length")
module = webnotes.form_dict.get("module")
webnotes.response['values'] = webnotes.conn.sql("""
select distinct tabReport.name, tabReport.ref_doctype,
if(ifnull(tabReport.query, '')!='', 1, 0) as is_query_report
from `tabReport`, `tabDocType` from `tabReport`, `tabDocType`
where tabDocType.module='%(module)s' where tabDocType.module=%s
and tabDocType.name = tabReport.ref_doctype and tabDocType.name = tabReport.ref_doctype
and tabReport.docstatus in (0, NULL) and tabReport.docstatus in (0, NULL)
order by tabReport.name order by tabReport.name
limit %(limit_start)s, %(limit_page_length)s""" % webnotes.form_dict, as_dict=True) limit %s, %s""" % \
("%s", cint(limit_start), cint(limit_page_length)), (module,), as_dict=True)