diff --git a/src/documents/barcodes.py b/src/documents/barcodes.py index 2e290a61b..e4a138f98 100644 --- a/src/documents/barcodes.py +++ b/src/documents/barcodes.py @@ -154,7 +154,8 @@ class BarcodePlugin(ConsumeTaskPlugin): and (located_asn := self.asn) is not None ): logger.info(f"Found ASN in barcode: {located_asn}") - self.metadata.asn = located_asn + if not settings.CONSUMER_ENABLE_ASN0_SPLITTING or located_asn > 0: + self.metadata.asn = located_asn def cleanup(self) -> None: self.temp_dir.cleanup() diff --git a/src/paperless/settings.py b/src/paperless/settings.py index c4e70f68a..0e2db2626 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -893,6 +893,10 @@ CONSUMER_ENABLE_ASN_BARCODE: Final[bool] = __get_boolean( "PAPERLESS_CONSUMER_ENABLE_ASN_BARCODE", ) +CONSUMER_ENABLE_ASN0_SPLITTING: Final[bool] = __get_boolean( + "PAPERLESS_CONSUMER_ENABLE_ASN0_SPLITTING", +) + CONSUMER_ASN_BARCODE_PREFIX: Final[str] = os.getenv( "PAPERLESS_CONSUMER_ASN_BARCODE_PREFIX", "ASN",