Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fixes the barcode setting always overriding the ASN, even if one wasn't found

Trenton Ha3842d9228da
diff --git a/src/documents/tasks.py b/src/documents/tasks.py
index d320875a0..97a7791f3 100644
--- a/src/documents/tasks.py
+++ b/src/documents/tasks.py
@@ -124,10 +124,11 @@ def consume_file(
return "File successfully split"
# try reading the ASN from barcode
- if settings.CONSUMER_ENABLE_ASN_BARCODE:
+ if settings.CONSUMER_ENABLE_ASN_BARCODE and reader.asn is not None:
+ # Note this will take precedence over an API provided ASN
+ # But it's from a physical barcode, so that's good
overrides.asn = reader.asn
- if overrides.asn:
- logger.info(f"Found ASN in barcode: {overrides.asn}")
+ logger.info(f"Found ASN in barcode: {overrides.asn}")
# continue with consumption if no barcode was found
document = Consumer().try_consume_file(