Merge pull request #18095 from scmmishra/remove-move-stock-summary

refactor: move and add for serialized and batch items in stock summary
diff --git a/erpnext/stock/dashboard/item_dashboard.js b/erpnext/stock/dashboard/item_dashboard.js
index 157dbfe..1bfa2cf 100644
--- a/erpnext/stock/dashboard/item_dashboard.js
+++ b/erpnext/stock/dashboard/item_dashboard.js
@@ -16,18 +16,47 @@
 		this.content = $(frappe.render_template('item_dashboard')).appendTo(this.parent);
 		this.result = this.content.find('.result');
 
-		// move
 		this.content.on('click', '.btn-move', function() {
-			erpnext.stock.move_item(unescape($(this).attr('data-item')), $(this).attr('data-warehouse'),
-				null, $(this).attr('data-actual_qty'), null, function() { me.refresh(); });
+			handle_move_add($(this), "Move")
 		});
 
 		this.content.on('click', '.btn-add', function() {
-			erpnext.stock.move_item(unescape($(this).attr('data-item')), null, $(this).attr('data-warehouse'),
-				$(this).attr('data-actual_qty'), $(this).attr('data-rate'),
-				function() { me.refresh(); });
+			handle_move_add($(this), "Add")
 		});
 
+		function handle_move_add(element, action) {
+			let item = unescape(element.attr('data-item'));
+			let warehouse = unescape(element.attr('data-warehouse'));
+			let actual_qty = unescape(element.attr('data-actual_qty'));
+			let disable_quick_entry = Number(unescape(element.attr('data-disable_quick_entry')));
+			let entry_type = action === "Move" ? "Material Transfer": null;
+
+			if (disable_quick_entry) {
+				open_stock_entry(item, warehouse, entry_type);
+			} else {
+				if (action === "Add") {
+					let rate = unescape($(this).attr('data-rate'));
+					erpnext.stock.move_item(item, null, warehouse, actual_qty, rate, function() { me.refresh(); });
+				}
+				else {
+					erpnext.stock.move_item(item, warehouse, null, actual_qty, null, function() { me.refresh(); });
+				}
+			}
+		}
+
+		function open_stock_entry(item, warehouse, entry_type) {
+			frappe.model.with_doctype('Stock Entry', function() {
+				var doc = frappe.model.get_new_doc('Stock Entry');
+				if (entry_type) doc.stock_entry_type = entry_type;
+
+				var row = frappe.model.add_child(doc, 'items');
+				row.item_code = item;
+				row.s_warehouse = warehouse;
+
+				frappe.set_route('Form', doc.doctype, doc.name);
+			})
+		}
+
 		// more
 		this.content.find('.btn-more').on('click', function() {
 			me.start += 20;
@@ -196,4 +225,4 @@
 				frappe.set_route('Form', doc.doctype, doc.name);
 			})
 		});
-}
\ No newline at end of file
+}
diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py
index 487c765..cafb5c3 100644
--- a/erpnext/stock/dashboard/item_dashboard.py
+++ b/erpnext/stock/dashboard/item_dashboard.py
@@ -44,7 +44,9 @@
 
 	for item in items:
 		item.update({
-			'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name')
+			'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name'),
+			'disable_quick_entry': frappe.get_cached_value("Item", item.item_code, 'has_batch_no')
+				or frappe.get_cached_value("Item", item.item_code, 'has_serial_no'),
 		})
 
 	return items
diff --git a/erpnext/stock/dashboard/item_dashboard_list.html b/erpnext/stock/dashboard/item_dashboard_list.html
index 5a3fa2e..e1914ed 100644
--- a/erpnext/stock/dashboard/item_dashboard_list.html
+++ b/erpnext/stock/dashboard/item_dashboard_list.html
@@ -43,11 +43,13 @@
 			<div class="col-sm-2 text-right" style="margin-top: 8px;">
 				{% if d.actual_qty %}
 				<button class="btn btn-default btn-xs btn-move"
+					data-disable_quick_entry="{{ d.disable_quick_entry }}"
 					data-warehouse="{{ d.warehouse }}"
 					data-actual_qty="{{ d.actual_qty }}"
 					data-item="{{ escape(d.item_code) }}">{{ __("Move") }}</a>
 				{% endif %}
 				<button style="margin-left: 7px;" class="btn btn-default btn-xs btn-add"
+					data-disable_quick_entry="{{ d.disable_quick_entry }}"
 					data-warehouse="{{ d.warehouse }}"
 					data-actual_qty="{{ d.actual_qty }}"
 					data-item="{{ escape(d.item_code) }}"