mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-14 16:29:57 +00:00
Merge branch 'master' into generic-parameters
This commit is contained in:
2
.github/workflows/check_translations.yaml
vendored
2
.github/workflows/check_translations.yaml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
|
||||
8
.github/workflows/docker.yaml
vendored
8
.github/workflows/docker.yaml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
docker: ${{ steps.filter.outputs.docker }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # pin@v3.0.2
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Test Docker Image
|
||||
@@ -129,7 +129,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Run Migration Tests
|
||||
@@ -153,7 +153,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set Up Python ${{ env.python_version }}
|
||||
|
||||
32
.github/workflows/qc_checks.yaml
vendored
32
.github/workflows/qc_checks.yaml
vendored
@@ -41,7 +41,7 @@ jobs:
|
||||
requirements: ${{ steps.filter.outputs.requirements }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # pin@v3.0.2
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
if: needs.paths-filter.outputs.cicd == 'true' || needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.frontend == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Python ${{ env.python_version }}
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.requirements == 'true' || needs.paths-filter.outputs.force == 'true'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -126,7 +126,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Set up Python ${{ env.python_version }}
|
||||
@@ -164,7 +164,7 @@ jobs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -249,7 +249,7 @@ jobs:
|
||||
version: ${{ needs.schema.outputs.version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
name: Checkout Code
|
||||
with:
|
||||
repository: inventree/schema
|
||||
@@ -302,7 +302,7 @@ jobs:
|
||||
INVENTREE_LOG_LEVEL: WARNING
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: true
|
||||
- name: Environment Setup
|
||||
@@ -346,7 +346,7 @@ jobs:
|
||||
python_version: ${{ matrix.python_version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -410,7 +410,7 @@ jobs:
|
||||
- 6379:6379
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -458,7 +458,7 @@ jobs:
|
||||
- 3306:3306
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -500,7 +500,7 @@ jobs:
|
||||
- 5432:5432
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -534,7 +534,7 @@ jobs:
|
||||
INVENTREE_PLUGINS_ENABLED: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
name: Checkout Code
|
||||
@@ -613,7 +613,7 @@ jobs:
|
||||
VITE_COVERAGE_BUILD: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -663,7 +663,7 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -696,7 +696,7 @@ jobs:
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # pin@v2
|
||||
@@ -705,7 +705,7 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # pin@v3
|
||||
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # pin@v3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
category: zizmor
|
||||
|
||||
14
.github/workflows/release.yaml
vendored
14
.github/workflows/release.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Version Check
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
contents: write
|
||||
attestations: write
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
- name: Build frontend
|
||||
run: cd src/frontend && npm run compile && npm run build
|
||||
- name: Create SBOM for frontend
|
||||
uses: anchore/sbom-action@8e94d75ddd33f69f691467e42275782e4bfefe84 # pin@v0
|
||||
uses: anchore/sbom-action@fbfd9c6c189226748411491745178e0c2017392d # pin@v0
|
||||
with:
|
||||
artifact-name: frontend-build.spdx
|
||||
path: src/frontend
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
subject-path: "${{ github.workspace }}/src/backend/InvenTree/web/static/frontend-build.zip"
|
||||
|
||||
- name: Upload frontend
|
||||
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # pin@2.11.2
|
||||
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: src/backend/InvenTree/web/static/frontend-build.zip
|
||||
@@ -84,7 +84,7 @@ jobs:
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
- name: Upload Attestation
|
||||
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # pin@2.11.2
|
||||
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: frontend-build.intoto.jsonl
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
INVENTREE_DEBUG: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Environment Setup
|
||||
@@ -127,7 +127,7 @@ jobs:
|
||||
cd docs/site
|
||||
zip -r docs-html.zip *
|
||||
- name: Publish documentation
|
||||
uses: svenstaro/upload-release-action@81c65b7cd4de9b2570615ce3aad67a41de5b1a13 # pin@2.11.2
|
||||
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # pin@2.11.3
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: docs/site/docs-html.zip
|
||||
|
||||
4
.github/workflows/scorecard.yaml
vendored
4
.github/workflows/scorecard.yaml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
@@ -67,6 +67,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
|
||||
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
2
.github/workflows/translations.yaml
vendored
2
.github/workflows/translations.yaml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # pin@v5.0.0
|
||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # pin@v6.0.0
|
||||
with:
|
||||
persist-credentials: true
|
||||
- name: Environment Setup
|
||||
|
||||
@@ -1482,9 +1482,9 @@ pynacl==1.6.0 \
|
||||
--hash=sha256:f46386c24a65383a9081d68e9c2de909b1834ec74ff3013271f1bca9c2d233eb \
|
||||
--hash=sha256:f4b3824920e206b4f52abd7de621ea7a44fd3cb5c8daceb7c3612345dfc54f2e
|
||||
# via paramiko
|
||||
pypdf==6.3.0 \
|
||||
--hash=sha256:2d5f9741e851e378908692d571374b3cbd94582fdd1c740fcf7c029ec35ac0e6 \
|
||||
--hash=sha256:d066a2fdf8195e1811ae5a9d5a2f97f5bed0e1e7954297295eadee6357e76c5d
|
||||
pypdf==6.4.0 \
|
||||
--hash=sha256:4769d471f8ddc3341193ecc5d6560fa44cf8cd0abfabf21af4e195cc0c224072 \
|
||||
--hash=sha256:55ab9837ed97fd7fcc5c131d52fcc2223bc5c6b8a1488bbf7c0e27f1f0023a79
|
||||
# via -r src/backend/requirements.in
|
||||
pyphen==0.17.2 \
|
||||
--hash=sha256:3a07fb017cb2341e1d9ff31b8634efb1ae4dc4b130468c7c39dd3d32e7c3affd \
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Table } from '@mantine/core';
|
||||
import { Alert, Table, Text } from '@mantine/core';
|
||||
import {
|
||||
IconAddressBook,
|
||||
IconCalendar,
|
||||
IconCircleCheck,
|
||||
IconCircleX,
|
||||
IconCoins,
|
||||
IconUser,
|
||||
IconUsers
|
||||
@@ -23,8 +25,9 @@ import type {
|
||||
ApiFormFieldType
|
||||
} from '@lib/types/Forms';
|
||||
import type { TableFieldRowProps } from '../components/forms/fields/TableField';
|
||||
import { useCreateApiFormModal } from '../hooks/UseForm';
|
||||
import { useCreateApiFormModal, useEditApiFormModal } from '../hooks/UseForm';
|
||||
import { useGlobalSettingsState } from '../states/SettingsStates';
|
||||
import { useUserState } from '../states/UserState';
|
||||
import { RenderPartColumn } from '../tables/ColumnRenderers';
|
||||
|
||||
export function useSalesOrderFields({
|
||||
@@ -190,6 +193,64 @@ export function useSalesOrderLineItemFields({
|
||||
}, [salePrice, partCurrency, orderId, create]);
|
||||
}
|
||||
|
||||
export function useCheckShipmentForm({
|
||||
shipmentId,
|
||||
onSuccess
|
||||
}: {
|
||||
shipmentId: number;
|
||||
onSuccess: (response: any) => void;
|
||||
}) {
|
||||
const user = useUserState();
|
||||
|
||||
return useEditApiFormModal({
|
||||
url: ApiEndpoints.sales_order_shipment_list,
|
||||
pk: shipmentId,
|
||||
title: t`Check Shipment`,
|
||||
preFormContent: (
|
||||
<Alert color='green' icon={<IconCircleCheck />} title={t`Check Shipment`}>
|
||||
<Text>{t`Marking the shipment as checked indicates that you have verified that all items included in this shipment are correct`}</Text>
|
||||
</Alert>
|
||||
),
|
||||
fetchInitialData: false,
|
||||
fields: {
|
||||
checked_by: {
|
||||
hidden: true,
|
||||
value: user.getUser()?.pk
|
||||
}
|
||||
},
|
||||
successMessage: t`Shipment marked as checked`,
|
||||
onFormSuccess: onSuccess
|
||||
});
|
||||
}
|
||||
|
||||
export function useUncheckShipmentForm({
|
||||
shipmentId,
|
||||
onSuccess
|
||||
}: {
|
||||
shipmentId: number;
|
||||
onSuccess: (response: any) => void;
|
||||
}) {
|
||||
return useEditApiFormModal({
|
||||
url: ApiEndpoints.sales_order_shipment_list,
|
||||
pk: shipmentId,
|
||||
title: t`Uncheck Shipment`,
|
||||
preFormContent: (
|
||||
<Alert color='red' icon={<IconCircleX />} title={t`Uncheck Shipment`}>
|
||||
<Text>{t`Marking the shipment as unchecked indicates that the shipment requires further verification`}</Text>
|
||||
</Alert>
|
||||
),
|
||||
fetchInitialData: false,
|
||||
fields: {
|
||||
checked_by: {
|
||||
hidden: true,
|
||||
value: null
|
||||
}
|
||||
},
|
||||
successMessage: t`Shipment marked as unchecked`,
|
||||
onFormSuccess: onSuccess
|
||||
});
|
||||
}
|
||||
|
||||
function SalesOrderAllocateLineRow({
|
||||
props,
|
||||
record,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Alert, Grid, Skeleton, Stack, Text } from '@mantine/core';
|
||||
import { Grid, Skeleton, Stack, Text } from '@mantine/core';
|
||||
import {
|
||||
IconBookmark,
|
||||
IconCircleCheck,
|
||||
@@ -39,8 +39,10 @@ import { RenderAddress } from '../../components/render/Company';
|
||||
import { RenderUser } from '../../components/render/User';
|
||||
import { formatDate } from '../../defaults/formatters';
|
||||
import {
|
||||
useCheckShipmentForm,
|
||||
useSalesOrderShipmentCompleteFields,
|
||||
useSalesOrderShipmentFields
|
||||
useSalesOrderShipmentFields,
|
||||
useUncheckShipmentForm
|
||||
} from '../../forms/SalesOrderForms';
|
||||
import {
|
||||
useCreateApiFormModal,
|
||||
@@ -320,44 +322,14 @@ export default function SalesOrderShipmentDetail() {
|
||||
onFormSuccess: refreshShipment
|
||||
});
|
||||
|
||||
const checkShipment = useEditApiFormModal({
|
||||
url: ApiEndpoints.sales_order_shipment_list,
|
||||
pk: shipment.pk,
|
||||
title: t`Check Shipment`,
|
||||
preFormContent: (
|
||||
<Alert color='green' icon={<IconCircleCheck />} title={t`Check Shipment`}>
|
||||
<Text>{t`Marking the shipment as checked indicates that you have verified that all items included in this shipment are correct`}</Text>
|
||||
</Alert>
|
||||
),
|
||||
fetchInitialData: false,
|
||||
fields: {
|
||||
checked_by: {
|
||||
hidden: true,
|
||||
value: userId
|
||||
}
|
||||
},
|
||||
successMessage: t`Shipment marked as checked`,
|
||||
onFormSuccess: refreshShipment
|
||||
const checkShipment = useCheckShipmentForm({
|
||||
shipmentId: shipment.pk,
|
||||
onSuccess: refreshShipment
|
||||
});
|
||||
|
||||
const uncheckShipment = useEditApiFormModal({
|
||||
url: ApiEndpoints.sales_order_shipment_list,
|
||||
pk: shipment.pk,
|
||||
title: t`Uncheck Shipment`,
|
||||
preFormContent: (
|
||||
<Alert color='red' icon={<IconCircleX />} title={t`Uncheck Shipment`}>
|
||||
<Text>{t`Marking the shipment as unchecked indicates that the shipment requires further verification`}</Text>
|
||||
</Alert>
|
||||
),
|
||||
fetchInitialData: false,
|
||||
fields: {
|
||||
checked_by: {
|
||||
hidden: true,
|
||||
value: null
|
||||
}
|
||||
},
|
||||
successMessage: t`Shipment marked as unchecked`,
|
||||
onFormSuccess: refreshShipment
|
||||
const uncheckShipment = useUncheckShipmentForm({
|
||||
shipmentId: shipment.pk,
|
||||
onSuccess: refreshShipment
|
||||
});
|
||||
|
||||
const shipmentBadges = useMemo(() => {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { IconTruckDelivery } from '@tabler/icons-react';
|
||||
import {
|
||||
IconCircleCheck,
|
||||
IconCircleX,
|
||||
IconTruckDelivery
|
||||
} from '@tabler/icons-react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
@@ -19,8 +23,10 @@ import type { TableFilter } from '@lib/types/Filters';
|
||||
import type { TableColumn } from '@lib/types/Tables';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
useCheckShipmentForm,
|
||||
useSalesOrderShipmentCompleteFields,
|
||||
useSalesOrderShipmentFields
|
||||
useSalesOrderShipmentFields,
|
||||
useUncheckShipmentForm
|
||||
} from '../../forms/SalesOrderForms';
|
||||
import {
|
||||
useCreateApiFormModal,
|
||||
@@ -91,6 +97,20 @@ export default function SalesOrderShipmentTable({
|
||||
table: table
|
||||
});
|
||||
|
||||
const checkShipment = useCheckShipmentForm({
|
||||
shipmentId: selectedShipment.pk,
|
||||
onSuccess: () => {
|
||||
table.refreshTable();
|
||||
}
|
||||
});
|
||||
|
||||
const uncheckShipment = useUncheckShipmentForm({
|
||||
shipmentId: selectedShipment.pk,
|
||||
onSuccess: () => {
|
||||
table.refreshTable();
|
||||
}
|
||||
});
|
||||
|
||||
const completeShipment = useCreateApiFormModal({
|
||||
url: ApiEndpoints.sales_order_shipment_complete,
|
||||
pk: selectedShipment.pk,
|
||||
@@ -188,6 +208,30 @@ export default function SalesOrderShipmentTable({
|
||||
const shipped: boolean = !!record.shipment_date;
|
||||
|
||||
return [
|
||||
{
|
||||
hidden:
|
||||
!!record.checked_by || !user.hasChangeRole(UserRoles.sales_order),
|
||||
title: t`Check Shipment`,
|
||||
color: 'blue',
|
||||
icon: <IconCircleCheck />,
|
||||
onClick: () => {
|
||||
setSelectedShipment(record);
|
||||
checkShipment.open();
|
||||
}
|
||||
},
|
||||
{
|
||||
hidden:
|
||||
shipped ||
|
||||
!record.checked_by ||
|
||||
!user.hasChangeRole(UserRoles.sales_order),
|
||||
title: t`Uncheck Shipment`,
|
||||
color: 'red',
|
||||
icon: <IconCircleX />,
|
||||
onClick: () => {
|
||||
setSelectedShipment(record);
|
||||
uncheckShipment.open();
|
||||
}
|
||||
},
|
||||
{
|
||||
hidden: shipped || !user.hasChangeRole(UserRoles.sales_order),
|
||||
title: t`Complete Shipment`,
|
||||
@@ -271,7 +315,9 @@ export default function SalesOrderShipmentTable({
|
||||
<>
|
||||
{newShipment.modal}
|
||||
{editShipment.modal}
|
||||
{checkShipment.modal}
|
||||
{deleteShipment.modal}
|
||||
{uncheckShipment.modal}
|
||||
{completeShipment.modal}
|
||||
<InvenTreeTable
|
||||
url={apiUrl(ApiEndpoints.sales_order_shipment_list)}
|
||||
|
||||
Reference in New Issue
Block a user