[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,6 +31,7 @@ cur_frm.cscript.make_dashboard = function(doc) {
cur_frm.dashboard.reset(); cur_frm.dashboard.reset();
if(doc.__islocal) if(doc.__islocal)
return; return;
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.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");
@ -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) {
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
cur_frm.dashboard.set_headline( cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>" wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency) + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>'); + '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message); cur_frm.dashboard.set_badge_count(r.message);
} }
}) })

View File

@ -45,6 +45,7 @@ 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;
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.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");
@ -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) {
if (in_list(user_roles, "Accounts User") || in_list(user_roles, "Accounts Manager")) {
cur_frm.dashboard.set_headline( cur_frm.dashboard.set_headline(
wn._("Total Billing This Year: ") + "<b>" wn._("Total Billing This Year: ") + "<b>"
+ format_currency(r.message.total_billing, cur_frm.doc.default_currency) + format_currency(r.message.total_billing, cur_frm.doc.default_currency)
+ '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>" + '</b> / <span class="text-muted">' + wn._("Unpaid") + ": <b>"
+ format_currency(r.message.total_unpaid, cur_frm.doc.default_currency) + format_currency(r.message.total_unpaid, cur_frm.doc.default_currency)
+ '</b></span>'); + '</b></span>');
}
cur_frm.dashboard.set_badge_count(r.message); cur_frm.dashboard.set_badge_count(r.message);
} }
}) })