diff --git a/src/backend/InvenTree/machine/machine_types/label_printer.py b/src/backend/InvenTree/machine/machine_types/label_printer.py
index f598f5dd55..47f108ffc7 100644
--- a/src/backend/InvenTree/machine/machine_types/label_printer.py
+++ b/src/backend/InvenTree/machine/machine_types/label_printer.py
@@ -267,4 +267,4 @@ class LabelPrinterMachine(BaseMachineType):
if not location_pk:
return None
- return StockLocation.objects.get(pk=location_pk)
+ return StockLocation.objects.filter(pk=location_pk).first()
diff --git a/src/backend/InvenTree/machine/tests.py b/src/backend/InvenTree/machine/tests.py
index 831438e356..abd7f42211 100755
--- a/src/backend/InvenTree/machine/tests.py
+++ b/src/backend/InvenTree/machine/tests.py
@@ -297,6 +297,14 @@ class TestLabelPrinterMachineType(InvenTreeAPITestCase):
self.assertIn('is not a valid choice', str(response.data['machine']))
+ def test_location_invalid_pk(self):
+ """Test that location property returns None for an invalid PK without raising."""
+ machine = self.create_machine()
+
+ machine.set_setting('LOCATION', 'M', 999999)
+
+ self.assertIsNone(machine.location)
+
class AdminTest(AdminTestCase):
"""Tests for the admin interface integration."""
diff --git a/src/frontend/src/defaults/actions.tsx b/src/frontend/src/defaults/actions.tsx
index 908dce6b3c..1eb3d01a32 100644
--- a/src/frontend/src/defaults/actions.tsx
+++ b/src/frontend/src/defaults/actions.tsx
@@ -2,6 +2,7 @@ import { t } from '@lingui/core/macro';
import type { SpotlightActionData } from '@mantine/spotlight';
import {
IconBarcode,
+ IconDevicesPc,
IconLink,
IconPlug,
IconPointer,
@@ -234,6 +235,16 @@ export function getActions(navigate: NavigateFunction) {
leftSection:
});
+ staff &&
+ user?.hasViewPermission(ModelType.pluginconfig) &&
+ _actions.push({
+ id: 'machine-management',
+ label: t`Machines`,
+ description: t`Manage machines and machine types`,
+ onClick: () => navigate('/settings/admin/machine'),
+ leftSection:
+ });
+
staff &&
user?.hasViewPermission(ModelType.reporttemplate) &&
_actions.push({