2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-30 18:50:53 +00:00

Add barcode generation capabilities to plugins (#7648)

* initial implementation of barcode generation using plugins

* implement short QR code scanning

* add PUI qrcode preview

* use barcode generation for CUI show barcode modal

* remove short qr prefix validators and fix short qr detection regex

* catch errors if model with pk is not found for scanning and generating

* improve qrcode templatetag

* fix comments

* fix for python 3.9

* add tests

* fix: tests

* add docs

* fix: tests

* bump api version

* add docs to BarcodeMixin

* fix: test

* added suggestions from code review

* fix: tests

* Add MinLengthValidator to short barcode prefix setting

* fix: tests?

* trigger: ci

* try custom cache

* try custom cache ignore all falsy

* remove debugging

* Revert "Add MinLengthValidator to short barcode prefix setting"

This reverts commit 76043ed96b.

* Revert "fix: tests"

This reverts commit 3a2d46ff72.
This commit is contained in:
Lukas
2024-07-22 03:52:45 +02:00
committed by GitHub
parent 0f6551d70f
commit 16e535f45f
48 changed files with 845 additions and 241 deletions

View File

@ -6,6 +6,7 @@ import {
Menu,
Tooltip
} from '@mantine/core';
import { modals } from '@mantine/modals';
import {
IconCopy,
IconEdit,
@ -16,9 +17,11 @@ import {
} from '@tabler/icons-react';
import { ReactNode, useMemo } from 'react';
import { ModelType } from '../../enums/ModelType';
import { identifierString } from '../../functions/conversion';
import { InvenTreeIcon } from '../../functions/icons';
import { notYetImplemented } from '../../functions/notifications';
import { InvenTreeQRCode } from './QRCode';
export type ActionDropdownItem = {
icon: ReactNode;
@ -128,11 +131,20 @@ export function BarcodeActionDropdown({
// Common action button for viewing a barcode
export function ViewBarcodeAction({
hidden = false,
onClick
model,
pk
}: {
hidden?: boolean;
onClick?: () => void;
model: ModelType;
pk: number;
}): ActionDropdownItem {
const onClick = () => {
modals.open({
title: t`View Barcode`,
children: <InvenTreeQRCode model={model} pk={pk} />
});
};
return {
icon: <IconQrcode />,
name: t`View`,