fix: serial no trim issue (#24949)
* fix: serial no trim issue * fix: valid serial nos * fix: sider Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
		
							parent
							
								
									02142c41bb
								
							
						
					
					
						commit
						12f0923a61
					
				| @ -738,21 +738,15 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ | ||||
| 			} | ||||
| 			else { | ||||
| 				var valid_serial_nos = []; | ||||
| 
 | ||||
| 				var serialnos = []; | ||||
| 				// Replacing all occurences of comma with carriage return
 | ||||
| 				var serial_nos = item.serial_no.trim().replace(/,/g, '\n'); | ||||
| 
 | ||||
| 				serial_nos = serial_nos.trim().split('\n'); | ||||
| 
 | ||||
| 				// Trim each string and push unique string to new list
 | ||||
| 				for (var x=0; x<=serial_nos.length - 1; x++) { | ||||
| 					if (serial_nos[x].trim() != "" && valid_serial_nos.indexOf(serial_nos[x].trim()) == -1) { | ||||
| 						valid_serial_nos.push(serial_nos[x].trim()); | ||||
| 				item.serial_no = item.serial_no.replace(/,/g, '\n'); | ||||
| 				serialnos = item.serial_no.split("\n"); | ||||
| 				for (var i = 0; i < serialnos.length; i++) { | ||||
| 					if (serialnos[i] != "") { | ||||
| 						valid_serial_nos.push(serialnos[i]); | ||||
| 					} | ||||
| 				} | ||||
| 
 | ||||
| 				// Add the new list to the serial no. field in grid with each in new line
 | ||||
| 				item.serial_no = valid_serial_nos.join('\n'); | ||||
| 				item.conversion_factor = item.conversion_factor || 1; | ||||
| 
 | ||||
| 				refresh_field("serial_no", item.name, item.parentfield); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user