From f912ba501dedbe85d729f76fa5e1aba22e0ef377 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 1 Jun 2026 14:30:23 +1000 Subject: [PATCH] [bug] Various fixes (#12057) * [bug] Various fixes - Add get_api_url to EmailThread model - Prevent setting creation during import - Tweak BarcodeScanHistoryTable * Tweak barcode history table tests * Bump API version --- .../InvenTree/InvenTree/api_version.py | 5 ++- src/backend/InvenTree/common/models.py | 5 +++ .../InvenTree/plugin/base/barcodes/api.py | 4 +-- .../plugin/base/integration/AppMixin.py | 4 ++- .../settings/BarcodeScanHistoryTable.tsx | 35 +++++++++++-------- src/frontend/tests/pui_settings.spec.ts | 16 +++++++-- 6 files changed, 47 insertions(+), 22 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index f13f695f0c..6997504b6f 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -1,11 +1,14 @@ """InvenTree API version information.""" # InvenTree API version -INVENTREE_API_VERSION = 498 +INVENTREE_API_VERSION = 499 """Increment this API version number whenever there is a significant change to the API that any clients need to know about.""" INVENTREE_API_TEXT = """ +v499 -> 2026-06-01 : https://github.com/inventree/InvenTree/pull/12057 + - Fixes search field issues on the BarcodeScanHistory API endpoint + v498 -> 2026-05-31 : https://github.com/inventree/InvenTree/pull/12055 - Updates the "status_text" field for models which support custom status values diff --git a/src/backend/InvenTree/common/models.py b/src/backend/InvenTree/common/models.py index 022efae6a4..23d5352e9b 100644 --- a/src/backend/InvenTree/common/models.py +++ b/src/backend/InvenTree/common/models.py @@ -3355,6 +3355,11 @@ class EmailThread(InvenTree.models.InvenTreeMetadataModel): unique_together = [['key', 'global_id']] ordering = ['-updated'] + @staticmethod + def get_api_url(): + """Return the API URL associated with the EmailThread model.""" + return reverse('api-email-list') + key = models.CharField( max_length=250, verbose_name=_('Key'), diff --git a/src/backend/InvenTree/plugin/base/barcodes/api.py b/src/backend/InvenTree/plugin/base/barcodes/api.py index f561319f6e..cf9b0d8dd6 100644 --- a/src/backend/InvenTree/plugin/base/barcodes/api.py +++ b/src/backend/InvenTree/plugin/base/barcodes/api.py @@ -853,11 +853,11 @@ class BarcodeScanResultList(BarcodeScanResultMixin, BulkDeleteMixin, ListAPI): filterset_class = BarcodeScanResultFilter filter_backends = SEARCH_ORDER_FILTER - ordering_fields = ['user', 'plugin', 'timestamp', 'endpoint', 'result'] + ordering_fields = ['user', 'timestamp', 'endpoint', 'result'] ordering = '-timestamp' - search_fields = ['plugin'] + search_fields = ['data'] class BarcodeScanResultDetail(BarcodeScanResultMixin, RetrieveDestroyAPI): diff --git a/src/backend/InvenTree/plugin/base/integration/AppMixin.py b/src/backend/InvenTree/plugin/base/integration/AppMixin.py index b3690afee1..507d188ccc 100644 --- a/src/backend/InvenTree/plugin/base/integration/AppMixin.py +++ b/src/backend/InvenTree/plugin/base/integration/AppMixin.py @@ -51,7 +51,9 @@ class AppMixin: """ from common.settings import get_global_setting - if settings.PLUGIN_TESTING or get_global_setting('ENABLE_PLUGINS_APP'): + if settings.PLUGIN_TESTING or get_global_setting( + 'ENABLE_PLUGINS_APP', create=False + ): logger.info('Registering IntegrationPlugin apps') apps_changed = False diff --git a/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx b/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx index 26c04bf547..80b06490f6 100644 --- a/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx +++ b/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx @@ -258,23 +258,28 @@ export default function BarcodeScanHistoryTable() { icon={} title={t`Logging Disabled`} > - {t`Barcode logging is not enabled`} + + {t`Barcode logging is not enabled.`}{' '} + {t`No barcode scan history will be recorded.`} + )} - { - setSelectedResult(row); - open(); - } - }} - /> + {globalSettings.isSet('BARCODE_STORE_RESULTS') && ( + { + setSelectedResult(row); + open(); + } + }} + /> + )} ); diff --git a/src/frontend/tests/pui_settings.spec.ts b/src/frontend/tests/pui_settings.spec.ts index c594f003f6..4cfa94632c 100644 --- a/src/frontend/tests/pui_settings.spec.ts +++ b/src/frontend/tests/pui_settings.spec.ts @@ -385,10 +385,20 @@ test('Settings - Admin - Barcode History', async ({ browser }) => { await page.waitForTimeout(500); - // Barcode history is displayed in table - barcodes.forEach(async (barcode) => { + const checkBarcode = async (barcode: string) => { + await page.getByRole('textbox', { name: 'table-search-input' }).clear(); + await page + .getByRole('textbox', { name: 'table-search-input' }) + .fill(barcode); + await page.waitForLoadState('networkidle'); await page.getByText(barcode).first().waitFor(); - }); + }; + + for (const barcode of barcodes) { + await checkBarcode(barcode); + } + + await page.waitForTimeout(2500); }); test('Settings - Admin - Parameter', async ({ browser }) => {