2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-06-06 00:44:25 +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
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
+5
View File
@@ -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'),
@@ -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):
@@ -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
@@ -258,23 +258,28 @@ export default function BarcodeScanHistoryTable() {
icon={<IconExclamationCircle />}
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>
)}
<InvenTreeTable
url={apiUrl(ApiEndpoints.barcode_history)}
tableState={table}
columns={tableColumns}
props={{
tableFilters: filters,
enableBulkDelete: canDelete,
rowActions: rowActions,
onRowClick: (row) => {
setSelectedResult(row);
open();
}
}}
/>
{globalSettings.isSet('BARCODE_STORE_RESULTS') && (
<InvenTreeTable
url={apiUrl(ApiEndpoints.barcode_history)}
tableState={table}
columns={tableColumns}
props={{
tableFilters: filters,
enableBulkDelete: canDelete,
rowActions: rowActions,
onRowClick: (row) => {
setSelectedResult(row);
open();
}
}}
/>
)}
</Stack>
</>
);
+13 -3
View File
@@ -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 }) => {