mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Fix for saving stock item objects
This commit is contained in:
		@@ -235,14 +235,18 @@ class StockItem(MPTTModel):
 | 
				
			|||||||
        # Default value if we cannot convert to an integer
 | 
					        # Default value if we cannot convert to an integer
 | 
				
			||||||
        serial_int = 0
 | 
					        serial_int = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Look at the start of the string - can it be "integerized"?
 | 
					        if serial is not None:
 | 
				
			||||||
        result = re.match(r'^(\d+)', serial or "")
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if result and len(result.groups()) == 1:
 | 
					            serial = str(serial)
 | 
				
			||||||
            try:
 | 
					
 | 
				
			||||||
                serial_int = int(result.groups()[0])
 | 
					            # Look at the start of the string - can it be "integerized"?
 | 
				
			||||||
            except:
 | 
					            result = re.match(r'^(\d+)', serial)
 | 
				
			||||||
                serial_int = 0
 | 
					
 | 
				
			||||||
 | 
					            if result and len(result.groups()) == 1:
 | 
				
			||||||
 | 
					                try:
 | 
				
			||||||
 | 
					                    serial_int = int(result.groups()[0])
 | 
				
			||||||
 | 
					                except:
 | 
				
			||||||
 | 
					                    serial_int = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.serial_int = serial_int
 | 
					        self.serial_int = serial_int
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user