Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/feat: Allow extension of barcode types (without validation) #16006

Merged
merged 4 commits into from
Dec 3, 2018

Commits on Nov 16, 2018

  1. fix/feat: Allow extension of barcode types (without validation)

    Currently, it is difficult to add new custom barcode types for two reasons, both of which relate to validate_barcode in item.py:
    - There is a bug where barcode types with a space in, such as Code 128, are split in two (so barcode_type is checked against 'Code' and '128' rather than 'Code 128'). This is fixed by splitting the Options field against a newline, instead of spaces.
    - All barcodes are validated against the stdnum.ean library. This only handles EAN-8, EAN-13 and UPC-12 barcodes and any other barcode will fail. Barcodes with no type will continue to not be checked. Barcodes with the default barcode_types of EAN, UPC will continue to be checked. The non-default barcode_types of EAN-13 and EAN-8 will also be checked. The barcode_type is cast to upper case before this check is made so ean, upc, ean-13 and ean-8 will also be validated.
    This allows people to add their own barcode types, such as Code 128 and QR codes. Users can add custom validation of these barcodes using the usual hooks, but they cannot remove the standard validation.
    Andrew McLeod committed Nov 16, 2018
    Configuration menu
    Copy the full SHA
    5607762 View commit details
    Browse the repository at this point in the history
  2. feat: Added unit testing for Item Barcodes in item.py

    Adds three different barcodes and barcodes types to a test item and
    checks that they are added correctly.
    Adds a barcode that already exists, and checks a DuplicateEntryError
    is raised.
    Adds an invalid EAN barcode and checks InvalidBarcode (a subclass of
    ValidationError) is raised.
    Andrew McLeod committed Nov 16, 2018
    Configuration menu
    Copy the full SHA
    f99a68a View commit details
    Browse the repository at this point in the history

Commits on Nov 26, 2018

  1. Configuration menu
    Copy the full SHA
    15951e6 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2018

  1. Configuration menu
    Copy the full SHA
    dfd79b0 View commit details
    Browse the repository at this point in the history