diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 9e839da766..4609adf56c 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -157,7 +157,7 @@ jobs: with: persist-credentials: false - name: Set Up Python ${{ env.python_version }} - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # pin@v6.0.0 + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # pin@v6.1.0 with: python-version: ${{ env.python_version }} - name: Version Check diff --git a/.github/workflows/qc_checks.yaml b/.github/workflows/qc_checks.yaml index 043c335d87..485a429b58 100644 --- a/.github/workflows/qc_checks.yaml +++ b/.github/workflows/qc_checks.yaml @@ -86,7 +86,7 @@ jobs: with: persist-credentials: false - name: Set up Python ${{ env.python_version }} - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # pin@v6.0.0 + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # pin@v6.1.0 with: python-version: ${{ env.python_version }} cache: "pip" @@ -130,7 +130,7 @@ jobs: with: persist-credentials: false - name: Set up Python ${{ env.python_version }} - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # pin@v6.0.0 + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # pin@v6.1.0 with: python-version: ${{ env.python_version }} - name: Check Config diff --git a/src/backend/InvenTree/InvenTree/models.py b/src/backend/InvenTree/InvenTree/models.py index c80baa5002..c3f5b42f93 100644 --- a/src/backend/InvenTree/InvenTree/models.py +++ b/src/backend/InvenTree/InvenTree/models.py @@ -12,6 +12,7 @@ from django.core.exceptions import ValidationError from django.db import models, transaction from django.db.models import QuerySet from django.db.models.signals import post_save +from django.db.transaction import TransactionManagementError from django.dispatch import receiver from django.urls import resolve, reverse from django.urls.exceptions import NoReverseMatch @@ -915,7 +916,15 @@ class InvenTreeTree(ContentTypeMixin, MPTTModel): if len(trees) > 0: # A tree update was performed, so we need to refresh the instance - self.refresh_from_db() + try: + self.refresh_from_db() + except TransactionManagementError: + # If we are inside a transaction block, we cannot refresh from db + pass + except Exception as e: + # Any other error is unexpected + InvenTree.sentry.report_exception(e) + InvenTree.exceptions.log_error(f'{self.__class__.__name__}.save') def partial_rebuild(self, tree_id: int) -> bool: """Perform a partial rebuild of the tree structure. diff --git a/src/frontend/src/components/buttons/PrintingActions.tsx b/src/frontend/src/components/buttons/PrintingActions.tsx index dad818e96f..4dbb997af9 100644 --- a/src/frontend/src/components/buttons/PrintingActions.tsx +++ b/src/frontend/src/components/buttons/PrintingActions.tsx @@ -52,12 +52,12 @@ export function PrintingActions({ const [labelId, setLabelId] = useState(undefined); const [reportId, setReportId] = useState(undefined); - const labelProgress = useDataOutput({ + useDataOutput({ title: t`Printing Labels`, id: labelId }); - const reportProgress = useDataOutput({ + useDataOutput({ title: t`Printing Reports`, id: reportId }); diff --git a/src/frontend/src/hooks/UseDataExport.tsx b/src/frontend/src/hooks/UseDataExport.tsx index 653a79beb3..8237f326e8 100644 --- a/src/frontend/src/hooks/UseDataExport.tsx +++ b/src/frontend/src/hooks/UseDataExport.tsx @@ -30,7 +30,7 @@ export default function useDataExport({ const [exportId, setExportId] = useState(undefined); - const progress = useDataOutput({ + useDataOutput({ title: t`Exporting Data`, id: exportId }); diff --git a/src/frontend/src/hooks/UseDataOutput.tsx b/src/frontend/src/hooks/UseDataOutput.tsx index 7844e899c0..84be903f70 100644 --- a/src/frontend/src/hooks/UseDataOutput.tsx +++ b/src/frontend/src/hooks/UseDataOutput.tsx @@ -40,7 +40,7 @@ export default function useDataOutput({ } else setLoading(false); }, [id, title]); - const progress = useQuery({ + useQuery({ enabled: !!id && loading && visibility === 'visible', refetchInterval: 500, queryKey: ['data-output', id, title], diff --git a/src/frontend/src/hooks/UseImportSession.tsx b/src/frontend/src/hooks/UseImportSession.tsx index 7503228c03..5410e77ee7 100644 --- a/src/frontend/src/hooks/UseImportSession.tsx +++ b/src/frontend/src/hooks/UseImportSession.tsx @@ -49,7 +49,7 @@ export function useImportSession({ setInstance(data); }, []); - const importSessionStatus = useStatusCodes({ + useStatusCodes({ modelType: ModelType.importsession }); diff --git a/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx b/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx index 153933dac9..2a0954ea42 100644 --- a/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx +++ b/src/frontend/src/pages/sales/SalesOrderShipmentDetail.tsx @@ -72,11 +72,7 @@ export default function SalesOrderShipmentDetail() { } }); - const { - instance: customer, - instanceQuery: customerQuery, - refreshInstance: refreshCustomer - } = useInstance({ + const { instance: customer, instanceQuery: customerQuery } = useInstance({ endpoint: ApiEndpoints.company_list, pk: shipment.order_detail?.customer, hasPrimaryKey: true diff --git a/src/frontend/src/tables/machine/MachineTypeTable.tsx b/src/frontend/src/tables/machine/MachineTypeTable.tsx index f7496da4d7..c9aebc29e8 100644 --- a/src/frontend/src/tables/machine/MachineTypeTable.tsx +++ b/src/frontend/src/tables/machine/MachineTypeTable.tsx @@ -103,9 +103,7 @@ export function MachineDriverTable({ function MachineTypeDrawer({ machineTypeSlug }: Readonly<{ machineTypeSlug: string }>) { - const navigate = useNavigate(); - - const { machineTypes, refresh, isFetching } = useMachineTypeDriver({ + const { machineTypes, isFetching } = useMachineTypeDriver({ includeDrivers: false }); const machineType = useMemo(