Provide a minor warning message if no stock levels are availiable (#11074)

* Provide a minor warning message if no stock levels are availiable

* Update item_dashboard.js
This commit is contained in:
Stavros Anastasiadis 2017-10-05 16:14:50 +03:00 committed by Nabin Hait
parent e31757b001
commit 58b587834e

View File

@ -75,8 +75,13 @@ erpnext.stock.ItemDashboard = Class.extend({
this.content.find('.more').addClass('hidden'); this.content.find('.more').addClass('hidden');
} }
$(frappe.render_template('item_dashboard_list', context)).appendTo(this.result); // If not any stock in any warehouses provide a message to end user
if (context.data.length > 0) {
$(frappe.render_template('item_dashboard_list', context)).appendTo(this.result);
} else {
var message = __(" Currently no stock available in any warehouse")
$("<span class='small'> <i class='fa fa-exclamation-triangle' aria-hidden='true'></i>"+message+"</span>").appendTo(this.result);
}
}, },
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;
@ -182,4 +187,4 @@ erpnext.stock.move_item = function(item, source, target, actual_qty, rate, callb
frappe.set_route('Form', doc.doctype, doc.name); frappe.set_route('Form', doc.doctype, doc.name);
}) })
}); });
} }