This commit is contained in:
Vinayak Jethe
2018-01-24 19:47:59 +05:30
parent 46c82c45e0
commit 549c196beb
2 changed files with 22 additions and 20 deletions

View File

@@ -82,18 +82,11 @@ erpnext.stock.ItemDashboard = Class.extend({
var message = __(" Currently no stock available in any warehouse") var message = __(" Currently no stock available in any warehouse")
$("<span class='text-muted small'>"+message+"</span>").appendTo(this.result); $("<span class='text-muted small'>"+message+"</span>").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) { get_item_dashboard_data: function(data, max_count, show_item) {
if(!max_count) max_count = 0; if(!max_count) max_count = 0;
if(!data) data = []; if(!data) data = [];
data.forEach(function(d) { data.forEach(function(d) {
d.actual_or_pending = d.projected_qty + d.reserved_qty + d.reserved_qty_for_production; d.actual_or_pending = d.projected_qty + d.reserved_qty + d.reserved_qty_for_production;
d.pending_qty = 0; d.pending_qty = 0;
@@ -105,9 +98,16 @@ erpnext.stock.ItemDashboard = Class.extend({
max_count = Math.max(d.actual_or_pending, d.actual_qty, max_count = Math.max(d.actual_or_pending, d.actual_qty,
d.total_reserved, max_count); d.total_reserved, max_count);
}); });
var can_write = 0;
if(frappe.boot.user.can_write.indexOf("Stock Entry")>=0){
can_write = 1;
}
return { return {
data: data, data: data,
max_count: max_count, max_count: max_count,
can_write:can_write,
show_item: show_item || false show_item: show_item || false
} }
} }

View File

@@ -40,17 +40,19 @@
</span> </span>
</div> </div>
<div class="col-sm-2 text-right" style="margin-top: 8px;"> <div class="col-sm-2 text-right" style="margin-top: 8px;">
{% if d.actual_qty %} {% if can_write %}
<button class="btn btn-default btn-xs btn-move" {% if d.actual_qty %}
data-warehouse="{{ d.warehouse }}" <button class="btn btn-default btn-xs btn-move"
data-actual_qty="{{ d.actual_qty }}" data-warehouse="{{ d.warehouse }}"
data-item="{{ d.item_code }}">{{ __("Move") }}</a> data-actual_qty="{{ d.actual_qty }}"
data-item="{{ d.item_code }}">{{ __("Move") }}</a>
{% endif %}
<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add"
data-warehouse="{{ d.warehouse }}"
data-actual_qty="{{ d.actual_qty }}"
data-item="{{ d.item_code }}"
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</a>
{% endif %} {% endif %}
<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add"
data-warehouse="{{ d.warehouse }}"
data-actual_qty="{{ d.actual_qty }}"
data-item="{{ d.item_code }}"
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</a>
</div> </div>
</div> </div>
</div> </div>