mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-20 00:56:26 +00:00
Enhancement: add barcode frontend config (#9742)
This commit is contained in:
@@ -96,10 +96,65 @@ class OcrConfig(OutputTypeConfig):
|
||||
user_args = json.loads(settings.OCR_USER_ARGS)
|
||||
except json.JSONDecodeError:
|
||||
user_args = {}
|
||||
|
||||
self.user_args = user_args
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class BarcodeConfig(BaseConfig):
|
||||
"""
|
||||
Barcodes settings
|
||||
"""
|
||||
|
||||
barcodes_enabled: bool = dataclasses.field(init=False)
|
||||
barcode_enable_tiff_support: bool = dataclasses.field(init=False)
|
||||
barcode_string: str = dataclasses.field(init=False)
|
||||
barcode_retain_split_pages: bool = dataclasses.field(init=False)
|
||||
barcode_enable_asn: bool = dataclasses.field(init=False)
|
||||
barcode_asn_prefix: str = dataclasses.field(init=False)
|
||||
barcode_upscale: float = dataclasses.field(init=False)
|
||||
barcode_dpi: int = dataclasses.field(init=False)
|
||||
barcode_max_pages: int = dataclasses.field(init=False)
|
||||
barcode_enable_tag: bool = dataclasses.field(init=False)
|
||||
barcode_tag_mapping: dict[str, str] = dataclasses.field(init=False)
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
app_config = self._get_config_instance()
|
||||
|
||||
self.barcodes_enabled = (
|
||||
app_config.barcodes_enabled or settings.CONSUMER_ENABLE_BARCODES
|
||||
)
|
||||
self.barcode_enable_tiff_support = (
|
||||
app_config.barcode_enable_tiff_support
|
||||
or settings.CONSUMER_BARCODE_TIFF_SUPPORT
|
||||
)
|
||||
self.barcode_string = (
|
||||
app_config.barcode_string or settings.CONSUMER_BARCODE_STRING
|
||||
)
|
||||
self.barcode_retain_split_pages = (
|
||||
app_config.barcode_retain_split_pages
|
||||
or settings.CONSUMER_BARCODE_RETAIN_SPLIT_PAGES
|
||||
)
|
||||
self.barcode_enable_asn = (
|
||||
app_config.barcode_enable_asn or settings.CONSUMER_ENABLE_ASN_BARCODE
|
||||
)
|
||||
self.barcode_asn_prefix = (
|
||||
app_config.barcode_asn_prefix or settings.CONSUMER_ASN_BARCODE_PREFIX
|
||||
)
|
||||
self.barcode_upscale = (
|
||||
app_config.barcode_upscale or settings.CONSUMER_BARCODE_UPSCALE
|
||||
)
|
||||
self.barcode_dpi = app_config.barcode_dpi or settings.CONSUMER_BARCODE_DPI
|
||||
self.barcode_max_pages = (
|
||||
app_config.barcode_max_pages or settings.CONSUMER_BARCODE_MAX_PAGES
|
||||
)
|
||||
self.barcode_enable_tag = (
|
||||
app_config.barcode_enable_tag or settings.CONSUMER_ENABLE_TAG_BARCODE
|
||||
)
|
||||
self.barcode_tag_mapping = (
|
||||
app_config.barcode_tag_mapping or settings.CONSUMER_TAG_BARCODE_MAPPING
|
||||
)
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class GeneralConfig(BaseConfig):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user