diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 63b514c..2ab8353 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -548,9 +548,13 @@
 
 erpnext.stock.select_batch_and_serial_no = (frm, d = undefined) => {
 	let get_warehouse = (item) => {
-		if(cstr(item.s_warehouse)) return ['Source Warehouse', cstr(item.s_warehouse)];
-		if(cstr(item.t_warehouse)) return ['Target Warehouse', cstr(item.t_warehouse)];
-		return 0;
+		if(frm.fields_dict.from_warehouse.disp_status === "Write") {
+			value = cstr(item.s_warehouse) || ''
+			return ['Source Warehouse', value]
+		} else {
+			value = cstr(item.t_warehouse) || ''
+			return ['Target Warehouse', value]
+		}
 	}
 
 	let show_modal_with_oldest_batch = (item, item_code, total_qty, warehouse_details, has_batch) => {
@@ -587,18 +591,11 @@
 		});
 	}
 
-	if(d) {
-		if(get_warehouse(d)) {
-			if(d.has_batch_no && !d.batch_no) {
-				show_modal_with_oldest_batch(d, d.item_code, d.qty, get_warehouse(d), 1);
-			} else if(d.has_serial_no && !d.serial_no) {
-				erpnext.show_batch_serial_modal(frm, d, d.item_code, d.qty, get_warehouse(d), 0);
-			}
-		} else {
-			d.item_code = '';
-			refresh_field('items');
-			frappe.throw("Please select a warehouse.");
-		}
+	if(d && d.has_batch_no && !d.batch_no) {
+		// show_modal_with_oldest_batch(d, d.item_code, d.qty, get_warehouse(d), 1);
+		erpnext.stock.show_batch_serial_modal(frm, d, d.item_code, d.qty, get_warehouse(d), 1);
+	} else if(d && d.has_serial_no && !d.serial_no) {
+		erpnext.stock.show_batch_serial_modal(frm, d, d.item_code, d.qty, get_warehouse(d), 0);
 	}
 }
 
@@ -608,7 +605,7 @@
 	let data = oldest ? oldest : []
 	let title = "";
 	let fields = [
-		{fieldname: frappe.model.scrub(warehouse_details[0]), read_only: 1, fieldtype:'Link',
+		{fieldname: 'warehouse', fieldtype:'Link',
 			options: 'Warehouse', label: __(warehouse_details[0]), 'default': warehouse_details[1]},
 		{fieldtype:'Column Break'},
 		{fieldname: 'item_code', read_only: 1, fieldtype:'Link', options: 'Item',
@@ -638,16 +635,6 @@
 					return this.data;
 				},
 				on_setup: function(grid) {
-					var me = this;
-					grid.wrapper.on('change', 'input[data-fieldname="batch_no"]', function(e) {
-						let $row = $(this).closest('.grid-row');
-						let name = $row.attr('data-name');
-						let row = grid.grid_rows_by_docname[name];
-						row.on_grid_fields[2].set_value('0');
-						row.on_grid_fields[2].$input.trigger('change');
-						set_available_qty(item_code, row.doc.batch_no, warehouse_details[1], row.on_grid_fields[1]);
-					});
-
 					grid.wrapper.on('change', 'input[data-fieldname="selected_qty"]', function(e) {
 						// check if batch is selected
 						if($(this).val().length !== 0) {
@@ -699,6 +686,16 @@
 
 	erpnext.stock.bind_batch_serial_dialog_qty(dialog);
 
+	let map_item_values = (item, values, attribute) => {
+		item[attribute] = values[attribute];
+		if(warehouse_details[0] === 'Source Warehouse') {
+			item.s_warehouse = values.warehouse;
+		} else {
+			item.t_warehouse = values.warehouse;
+		}
+		item.qty = values.qty;
+	}
+
 	let validate_batch_dialog = (values) => {
 		if(values.batches.length === 0 || !values.batches) {
 			frappe.throw(__("Please select batches for batched item " + values.item_code));
@@ -721,18 +718,11 @@
 
 		values.batches.map((batch, i) => {
 			if(i === 0) {
-				item.batch_no = batch.batch_no;
-				item.qty = batch.selected_qty;
+				map_item_values(item, values, 'batch_no');
 			} else {
 				var row = frm.add_child("items");
 				row.item_code = item.item_code;
-				if(item.s_warehouse) {
-					row.s_warehouse = item.s_warehouse;
-				} else {
-					row.t_warehouse = item.t_warehouse;
-				}
-				row.batch_no = batch.batch_no;
-				row.qty = batch.selected_qty;
+				map_item_values(row, values, 'batch_no');
 			}
 		});
 	}
@@ -751,28 +741,13 @@
 		if (!validate_serial_no_dialog(values)) {
 			return;
 		}
-		item.serial_no = values.serial_no;
-		item.qty = values.qty;
-	}
-
-	function set_available_qty(item_code, batch_no, warehouse, field) {
-		frappe.call({
-			method: 'erpnext.stock.doctype.batch.batch.get_batch_qty',
-			args: {
-				batch_no: batch_no,
-				warehouse: warehouse,
-				item_code: item_code
-			},
-			callback: (r) => {
-				if (r.message) {
-					field.set_value(r.message);
-					field.$input.trigger('change');
-				}
-			}
-		});
+		map_item_values(item, values, 'serial_no');
 	}
 
 	dialog.set_primary_action(__('Get Items'), function() {
+		if(!dialog.get_values().warehouse) {
+			frappe.throw(__("Please select a warehouse"));
+		}
 		has_batch ? set_batched_items() : set_serialized_items();
 		refresh_field("items");
 		dialog.hide();
@@ -784,7 +759,10 @@
 	let serial_no_link = dialog.fields_dict.serial_no_select;
 	let serial_no_list = dialog.fields_dict.serial_no;
 	let batches_field = dialog.fields_dict.batches;
+
+	let warehouse_field = dialog.fields_dict.warehouse;
 	let qty_field = dialog.fields_dict.qty;
+	let item_code = dialog.fields_dict.item_code.get_value();
 
 	let update_quantity = (batch) => {
 		if(batch) {
@@ -799,6 +777,27 @@
 		}
 	}
 
+	function set_available_qty(item_code, batch_no, warehouse, field) {
+		if(warehouse) {
+			frappe.call({
+				method: 'erpnext.stock.doctype.batch.batch.get_batch_qty',
+				args: {
+					batch_no: batch_no,
+					warehouse: warehouse,
+					item_code: item_code
+				},
+				callback: (r) => {
+					let value = r.message ? r.message : '0';
+					field.set_value(value);
+					field.$input.val(value);
+					field.$input.trigger('change');
+				}
+			});
+		} else {
+			frappe.throw(__("Please select a warehouse to get available quantities"));
+		}
+	}
+
 	if(serial_no_link) {
 		serial_no_link.$input.on('change', function(e) {
 			if(serial_no_link.get_value().length > 0) {
@@ -818,8 +817,26 @@
 	}
 
 	if(batches_field) {
+		batches_field.grid.wrapper.on('change', 'input[data-fieldname="batch_no"]', function(e) {
+			let $row = $(this).closest('.grid-row');
+			let name = $row.attr('data-name');
+			let row = batches_field.grid.grid_rows_by_docname[name];
+			row.on_grid_fields[2].set_value('0');
+			row.on_grid_fields[2].$input.trigger('change');
+			if(warehouse_field.get_value().length > 0) {
+				set_available_qty(item_code, row.doc.batch_no, warehouse_field.get_value(), row.on_grid_fields[1]);
+			} else {
+				frappe.throw(__("Please select a warehouse to get available quantities"));
+			}
+		});
+
 		batches_field.grid.wrapper.on('change', function(e) {
 			update_quantity(1);
 		});
+
+		warehouse_field.$input.on('change', function() {
+			batches_field.grid.df.data = [];
+			batches_field.grid.refresh();
+		});
 	}
 }
\ No newline at end of file
