[fix] warehouse required bug
This commit is contained in:
		
							parent
							
								
									d09f35fa98
								
							
						
					
					
						commit
						7331f169fc
					
				| @ -548,8 +548,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ | |||||||
| 
 | 
 | ||||||
| erpnext.select_batch_and_serial_no = (frm, d = undefined) => { | erpnext.select_batch_and_serial_no = (frm, d = undefined) => { | ||||||
| 	let get_warehouse = (item) => { | 	let get_warehouse = (item) => { | ||||||
| 		return cstr(item.s_warehouse) ? ['Source Warehouse', cstr(item.s_warehouse)] | 		if(cstr(item.s_warehouse)) return ['Source Warehouse', cstr(item.s_warehouse)]; | ||||||
| 			: ['Target Warehouse', cstr(item.t_warehouse)]; | 		if(cstr(item.t_warehouse)) return ['Target Warehouse', cstr(item.t_warehouse)]; | ||||||
|  | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	let show_modal_with_oldest_batch = (item, item_code, total_qty, warehouse_details, has_batch) => { | 	let show_modal_with_oldest_batch = (item, item_code, total_qty, warehouse_details, has_batch) => { | ||||||
| @ -587,16 +588,16 @@ erpnext.select_batch_and_serial_no = (frm, d = undefined) => { | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if(d) { | 	if(d) { | ||||||
| 		if(d.has_batch_no && !d.batch_no) { | 		if(get_warehouse(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); | 				show_modal_with_oldest_batch(d, d.item_code, d.qty, get_warehouse(d), 1); | ||||||
| 			} else { | 			} else if(d.has_serial_no && !d.serial_no) { | ||||||
| 				d.item_code = ''; | 				erpnext.show_batch_serial_modal(frm, d, d.item_code, d.qty, get_warehouse(d), 0); | ||||||
| 				refresh_field('items'); |  | ||||||
| 				frappe.throw("Please select a warehouse."); |  | ||||||
| 			} | 			} | ||||||
| 		} else if(d.has_serial_no && !d.serial_no) { | 		} else { | ||||||
| 			erpnext.show_batch_serial_modal(frm, d, d.item_code, d.qty, get_warehouse(d), 0); | 			d.item_code = ''; | ||||||
|  | 			refresh_field('items'); | ||||||
|  | 			frappe.throw("Please select a warehouse."); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -800,7 +801,7 @@ erpnext.bind_dialog_events = (dialog) => { | |||||||
| 
 | 
 | ||||||
| 	if(serial_no_link) { | 	if(serial_no_link) { | ||||||
| 		serial_no_link.$input.on('change', function(e) { | 		serial_no_link.$input.on('change', function(e) { | ||||||
| 			if(serial_no_link.get_value()) { | 			if(serial_no_link.get_value().length > 0) { | ||||||
| 				let new_line = '\n'; | 				let new_line = '\n'; | ||||||
| 				if(!serial_no_list.get_value()) { | 				if(!serial_no_list.get_value()) { | ||||||
| 					new_line = ''; | 					new_line = ''; | ||||||
| @ -808,7 +809,7 @@ erpnext.bind_dialog_events = (dialog) => { | |||||||
| 				serial_no_list.set_value(serial_no_list.get_value() + new_line + serial_no_link.get_value()); | 				serial_no_list.set_value(serial_no_list.get_value() + new_line + serial_no_link.get_value()); | ||||||
| 				update_quantity(0); | 				update_quantity(0); | ||||||
| 			} | 			} | ||||||
| 			serial_no_link.set_value(''); | 			serial_no_link.set_input(''); | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
| 		serial_no_list.$input.on('input', function() { | 		serial_no_list.$input.on('input', function() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user