Compare commits

..

No commits in common. "68bbebae2a1a3060259599b73485fcecdef41f87" and "b0459af78f91d05a20322efc3fe64997b834c964" have entirely different histories.

3 changed files with 25 additions and 11 deletions

View file

@ -7,7 +7,6 @@ COMPOSE := DOCKER_HOST=$(DOCKER_HOST) $(COMPOSE_CMD)
psql:
$(COMPOSE) exec inventree-db sh -c 'psql $$POSTGRES_USER $$POSTGRES_DB'
.PHONY: update
update:
read -p "Update will cause downtime of the server. Are you sure you want to continue? Press Ctrl+c to abort!" _
$(COMPOSE) pull
@ -18,14 +17,6 @@ update:
data: # podman does not autocreate data folder
mkdir data
.PHONY: caddy-check
caddy-check:
docker run --rm --env-file .env -v ./Caddyfile:/etc/caddy/Caddyfile:ro,Z caddy:alpine caddy validate --config /etc/caddy/Caddyfile
.PHONY: caddy-print
caddy-print:
docker run --rm --env-file .env -v ./Caddyfile:/etc/caddy/Caddyfile:ro,Z caddy:alpine caddy adapt --config /etc/caddy/Caddyfile --pretty
# pass all commands to compose cli
%: data
$(COMPOSE) $@

View file

@ -113,8 +113,6 @@ services:
- 443:443
env_file:
- .env
environment:
INVENTREE_SERVER: http://inventree-server:${INVENTREE_WEB_PORT}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro,z
- ${INVENTREE_EXT_VOLUME}/static:/var/www/static:z

25
plugins/ctbk_barcode.py Normal file
View file

@ -0,0 +1,25 @@
from plugin import InvenTreePlugin
from plugin.mixins import BarcodeMixin
from part.models import Part
import structlog
logger = structlog.get_logger("ctbk.barcode")
class CtbkBarcodePlugin(BarcodeMixin, InvenTreePlugin):
TITLE = "CTBK IPN Barcode Plugin"
NAME = "ctbk-ipn-barcode-plugin"
DESCRIPTION = "Supports the CTBK IPN format directly in barcodes"
VERSION = "0.0.1"
AUTHOR = "kleines Filmröllchen"
def scan(self, barcode_data):
if barcode_data.startswith("963e5440-"):
try:
instance = Part.objects.get(IPN=barcode_data.strip())
label = Part.barcode_model_type()
return {label: instance.format_matched_response()}
except Part.DoesNotExist:
logger.error("could not find a part for barcode %s", barcode_data)
pass