[fix] showing customer dashboard headline to users with account related roles

This commit is contained in:
Akhilesh Darjee 2013-11-14 14:50:43 +05:30
parent d2d210dc68
commit 65e974096f
2 changed files with 20 additions and 18 deletions

View File

@ -3,10 +3,6 @@
wn.require('app/setup/doctype/contact_control/contact_control.js');
cur_frm.cscript.onload = function(doc,dt,dn){
}
cur_frm.cscript.refresh = function(doc,dt,dn) {
cur_frm.cscript.make_dashboard(doc);
if(sys_defaults.supp_master_name == 'Supplier Name')
@ -35,7 +31,8 @@ cur_frm.cscript.make_dashboard = function(doc) {
cur_frm.dashboard.reset();
if(doc.__islocal)
return;
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
cur_frm.dashboard.set_headline('<span class="text-muted">Loading...</span>')
cur_frm.dashboard.add_doctype_badge("Supplier Quotation", "supplier");
cur_frm.dashboard.add_doctype_badge("Purchase Order", "supplier");
@ -49,12 +46,14 @@ cur_frm.cscript.make_dashboard = function(doc) {
supplier: cur_frm.doc.name
},
callback: function(r) {
cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message);
}
})

View File

@ -45,7 +45,8 @@ cur_frm.cscript.setup_dashboard = function(doc) {
cur_frm.dashboard.reset(doc);
if(doc.__islocal)
return;
cur_frm.dashboard.set_headline('<span class="text-muted">'+ wn._('Loading...')+ '</span>')
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager"))
cur_frm.dashboard.set_headline('<span class="text-muted">'+ wn._('Loading...')+ '</span>')
cur_frm.dashboard.add_doctype_badge("Opportunity", "customer");
cur_frm.dashboard.add_doctype_badge("Quotation", "customer");
@ -60,12 +61,14 @@ cur_frm.cscript.setup_dashboard = function(doc) {
customer: cur_frm.doc.name
},
callback: function(r) {
cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message);
}
})