mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-04 03:27:12 -05:00 
			
		
		
		
	Handle the ASN assignment last, after the splitting (#5745)
This commit is contained in:
		
							parent
							
								
									09ab694d05
								
							
						
					
					
						commit
						907b6d1294
					
				@ -87,14 +87,6 @@ class BarcodePlugin(ConsumeTaskPlugin):
 | 
				
			|||||||
        # Locate any barcodes in the files
 | 
					        # Locate any barcodes in the files
 | 
				
			||||||
        self.detect()
 | 
					        self.detect()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Update/overwrite an ASN if possible
 | 
					 | 
				
			||||||
        if (
 | 
					 | 
				
			||||||
            settings.CONSUMER_ENABLE_ASN_BARCODE
 | 
					 | 
				
			||||||
            and (located_asn := self.asn) is not None
 | 
					 | 
				
			||||||
        ):
 | 
					 | 
				
			||||||
            logger.info(f"Found ASN in barcode: {located_asn}")
 | 
					 | 
				
			||||||
            self.metadata.asn = located_asn
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # try reading tags from barcodes
 | 
					        # try reading tags from barcodes
 | 
				
			||||||
        if (
 | 
					        if (
 | 
				
			||||||
            settings.CONSUMER_ENABLE_TAG_BARCODE
 | 
					            settings.CONSUMER_ENABLE_TAG_BARCODE
 | 
				
			||||||
@ -154,6 +146,15 @@ class BarcodePlugin(ConsumeTaskPlugin):
 | 
				
			|||||||
            # Request the consume task stops
 | 
					            # Request the consume task stops
 | 
				
			||||||
            raise StopConsumeTaskError(msg)
 | 
					            raise StopConsumeTaskError(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Update/overwrite an ASN if possible
 | 
				
			||||||
 | 
					        # After splitting, as otherwise each split document gets the same ASN
 | 
				
			||||||
 | 
					        if (
 | 
				
			||||||
 | 
					            settings.CONSUMER_ENABLE_ASN_BARCODE
 | 
				
			||||||
 | 
					            and (located_asn := self.asn) is not None
 | 
				
			||||||
 | 
					        ):
 | 
				
			||||||
 | 
					            logger.info(f"Found ASN in barcode: {located_asn}")
 | 
				
			||||||
 | 
					            self.metadata.asn = located_asn
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def cleanup(self) -> None:
 | 
					    def cleanup(self) -> None:
 | 
				
			||||||
        self.temp_dir.cleanup()
 | 
					        self.temp_dir.cleanup()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user