[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'); 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.refresh = function(doc,dt,dn) {
cur_frm.cscript.make_dashboard(doc); cur_frm.cscript.make_dashboard(doc);
if(sys_defaults.supp_master_name == 'Supplier Name') if(sys_defaults.supp_master_name == 'Supplier Name')
@ -35,7 +31,8 @@ cur_frm.cscript.make_dashboard = function(doc) {
cur_frm.dashboard.reset(); cur_frm.dashboard.reset();
if(doc.__islocal) if(doc.__islocal)
return; 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("Supplier Quotation", "supplier");
cur_frm.dashboard.add_doctype_badge("Purchase Order", "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 supplier: cur_frm.doc.name
}, },
callback: function(r) { callback: function(r) {
cur_frm.dashboard.set_headline( if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
wn._("Total Billing This Year: ") + "<b>" cur_frm.dashboard.set_headline(
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency) wn._("Total Billing This Year: ") + "<b>"
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ '</b></span>'); + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message); 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); cur_frm.dashboard.reset(doc);
if(doc.__islocal) if(doc.__islocal)
return; 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("Opportunity", "customer");
cur_frm.dashboard.add_doctype_badge("Quotation", "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 customer: cur_frm.doc.name
}, },
callback: function(r) { callback: function(r) {
cur_frm.dashboard.set_headline( if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
wn._("Total Billing This Year: ") + "<b>" cur_frm.dashboard.set_headline(
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency) wn._("Total Billing This Year: ") + "<b>"
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ '</b></span>'); + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message); cur_frm.dashboard.set_badge_count(r.message);
} }
}) })