2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-06-06 08:54:24 +00:00

[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
This commit is contained in:
Oliver
2026-06-01 14:30:23 +10:00
committed by GitHub
parent 956468eb84
commit f912ba501d
6 changed files with 47 additions and 22 deletions
@@ -1,11 +1,14 @@
"""InvenTree API version information.""" """InvenTree API version information."""
# InvenTree API version # 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.""" """Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """ 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 v498 -> 2026-05-31 : https://github.com/inventree/InvenTree/pull/12055
- Updates the "status_text" field for models which support custom status values - Updates the "status_text" field for models which support custom status values
+5
View File
@@ -3355,6 +3355,11 @@ class EmailThread(InvenTree.models.InvenTreeMetadataModel):
unique_together = [['key', 'global_id']] unique_together = [['key', 'global_id']]
ordering = ['-updated'] ordering = ['-updated']
@staticmethod
def get_api_url():
"""Return the API URL associated with the EmailThread model."""
return reverse('api-email-list')
key = models.CharField( key = models.CharField(
max_length=250, max_length=250,
verbose_name=_('Key'), verbose_name=_('Key'),
@@ -853,11 +853,11 @@ class BarcodeScanResultList(BarcodeScanResultMixin, BulkDeleteMixin, ListAPI):
filterset_class = BarcodeScanResultFilter filterset_class = BarcodeScanResultFilter
filter_backends = SEARCH_ORDER_FILTER filter_backends = SEARCH_ORDER_FILTER
ordering_fields = ['user', 'plugin', 'timestamp', 'endpoint', 'result'] ordering_fields = ['user', 'timestamp', 'endpoint', 'result']
ordering = '-timestamp' ordering = '-timestamp'
search_fields = ['plugin'] search_fields = ['data']
class BarcodeScanResultDetail(BarcodeScanResultMixin, RetrieveDestroyAPI): class BarcodeScanResultDetail(BarcodeScanResultMixin, RetrieveDestroyAPI):
@@ -51,7 +51,9 @@ class AppMixin:
""" """
from common.settings import get_global_setting 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') logger.info('Registering IntegrationPlugin apps')
apps_changed = False apps_changed = False
@@ -258,23 +258,28 @@ export default function BarcodeScanHistoryTable() {
icon={<IconExclamationCircle />} icon={<IconExclamationCircle />}
title={t`Logging Disabled`} title={t`Logging Disabled`}
> >
<Text>{t`Barcode logging is not enabled`}</Text> <Text>
{t`Barcode logging is not enabled.`}{' '}
{t`No barcode scan history will be recorded.`}
</Text>
</Alert> </Alert>
)} )}
<InvenTreeTable {globalSettings.isSet('BARCODE_STORE_RESULTS') && (
url={apiUrl(ApiEndpoints.barcode_history)} <InvenTreeTable
tableState={table} url={apiUrl(ApiEndpoints.barcode_history)}
columns={tableColumns} tableState={table}
props={{ columns={tableColumns}
tableFilters: filters, props={{
enableBulkDelete: canDelete, tableFilters: filters,
rowActions: rowActions, enableBulkDelete: canDelete,
onRowClick: (row) => { rowActions: rowActions,
setSelectedResult(row); onRowClick: (row) => {
open(); setSelectedResult(row);
} open();
}} }
/> }}
/>
)}
</Stack> </Stack>
</> </>
); );
+13 -3
View File
@@ -385,10 +385,20 @@ test('Settings - Admin - Barcode History', async ({ browser }) => {
await page.waitForTimeout(500); await page.waitForTimeout(500);
// Barcode history is displayed in table const checkBarcode = async (barcode: string) => {
barcodes.forEach(async (barcode) => { 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(); await page.getByText(barcode).first().waitFor();
}); };
for (const barcode of barcodes) {
await checkBarcode(barcode);
}
await page.waitForTimeout(2500);
}); });
test('Settings - Admin - Parameter', async ({ browser }) => { test('Settings - Admin - Parameter', async ({ browser }) => {