From 549c196bebf2a116f1e38b66d6884e20bf909a46 Mon Sep 17 00:00:00 2001 From: Vinayak Jethe Date: Wed, 24 Jan 2018 19:47:59 +0530 Subject: [PATCH] Fixes issue #12512 --- erpnext/stock/dashboard/item_dashboard.js | 18 +++++++------- .../stock/dashboard/item_dashboard_list.html | 24 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js index 04220260840..4a525261b85 100644 --- a/erpnext/stock/dashboard/item_dashboard.js +++ b/erpnext/stock/dashboard/item_dashboard.js @@ -82,18 +82,11 @@ erpnext.stock.ItemDashboard = Class.extend({ var message = __(" Currently no stock available in any warehouse") $(""+message+"").appendTo(this.result); } - - if (frappe.boot.user.can_write.indexOf("Stock Entry")>=0){ - $(".btn-move").show(); - $(".btn-add").show(); - }else{ - $(".btn-move").hide(); - $(".btn-add").hide(); - } }, get_item_dashboard_data: function(data, max_count, show_item) { if(!max_count) max_count = 0; if(!data) data = []; + data.forEach(function(d) { d.actual_or_pending = d.projected_qty + d.reserved_qty + d.reserved_qty_for_production; d.pending_qty = 0; @@ -105,9 +98,16 @@ erpnext.stock.ItemDashboard = Class.extend({ max_count = Math.max(d.actual_or_pending, d.actual_qty, d.total_reserved, max_count); }); + + var can_write = 0; + if(frappe.boot.user.can_write.indexOf("Stock Entry")>=0){ + can_write = 1; + } + return { data: data, max_count: max_count, + can_write:can_write, show_item: show_item || false } } @@ -195,4 +195,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb frappe.set_route('Form', doc.doctype, doc.name); }) }); -} +} \ No newline at end of file diff --git a/erpnext/stock/dashboard/item_dashboard_list.html b/erpnext/stock/dashboard/item_dashboard_list.html index 63f248043c3..7d7f7e4c717 100644 --- a/erpnext/stock/dashboard/item_dashboard_list.html +++ b/erpnext/stock/dashboard/item_dashboard_list.html @@ -40,18 +40,20 @@
- {% if d.actual_qty %} -
-{% endfor %} +{% endfor %} \ No newline at end of file