Merge pull request #12659 from tundebabzy/issue-12658
set batch number only in Sales Invoice and Delivery Note - #12659
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 3c334c4..4a52526 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -75,7 +75,7 @@
this.content.find('.more').addClass('hidden');
}
- // If not any stock in any warehouses provide a message to end user
+ // 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 {
@@ -86,6 +86,7 @@
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;
@@ -97,9 +98,16 @@
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
}
}
@@ -187,4 +195,4 @@
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 63f2480..e0b3431 100644
--- a/erpnext/stock/dashboard/item_dashboard_list.html
+++ b/erpnext/stock/dashboard/item_dashboard_list.html
@@ -39,6 +39,7 @@
</span>
</span>
</div>
+ {% if can_write %}
<div class="col-sm-2 text-right" style="margin-top: 8px;">
{% if d.actual_qty %}
<button class="btn btn-default btn-xs btn-move"
@@ -52,6 +53,7 @@
data-item="{{ d.item_code }}"
data-rate="{{ d.valuation_rate }}">{{ __("Add") }}</a>
</div>
+ {% endif %}
</div>
</div>
{% endfor %}
diff --git a/erpnext/utilities/user_progress_utils.py b/erpnext/utilities/user_progress_utils.py
index 18d38c0..58a03e3 100644
--- a/erpnext/utilities/user_progress_utils.py
+++ b/erpnext/utilities/user_progress_utils.py
@@ -40,12 +40,12 @@
@frappe.whitelist()
def create_letterhead(args_data):
args = json.loads(args_data)
- letterhead = args.get("letterhead").encode('utf-8')
+ letterhead = args.get("letterhead")
if letterhead:
try:
frappe.get_doc({
"doctype":"Letter Head",
- "content":"""<div><img src="{0}" style='max-width: 100%%;'><br></div>""".format(letterhead),
+ "content":"""<div><img src="{0}" style='max-width: 100%%;'><br></div>""".format(letterhead.encode('utf-8')),
"letter_head_name": _("Standard"),
"is_default": 1
}).insert()