Purchase Order Destination (#8403)

* Add "destination" field to PurchaseOrder

* Add 'destination' field to API

* Add location to PurchaseOrderDetail page

* Display "destination" on PurchaseOrderDetail page

* Pre-select location based on selected "destination"

* Fix order of reception priority

* Auto-expand the per-line destination field

* Add "Purchase Order" detail to StockItemDetail page

* Bug fix in PurchaseOrderForms

* Split playwright tests

* Docs updates

* Bump API version

* Unit test fixes

* Fix more tests

* Backport to CUI

* Use PurchaseOrder destination when scanning items
This commit is contained in:
Oliver
2024-11-01 11:10:25 +11:00
committed by GitHub
parent 871cd905f1
commit c4031dba7f
20 changed files with 240 additions and 71 deletions
+16 -3
View File
@@ -166,6 +166,11 @@ export function usePurchaseOrderFields({
target_date: {
icon: <IconCalendar />
},
destination: {
filters: {
structural: false
}
},
link: {},
contact: {
icon: <IconUser />,
@@ -232,6 +237,13 @@ function LineItemFormRow({
onClose: () => props.changeFn(props.idx, 'location', undefined)
});
useEffect(() => {
if (!!record.destination) {
props.changeFn(props.idx, 'location', record.destination);
locationHandlers.open();
}
}, [record.destination]);
// Batch code generator
const batchCodeGenerator = useBatchCodeGenerator((value: any) => {
if (value) {
@@ -239,7 +251,7 @@ function LineItemFormRow({
}
});
// Serial numbebr generator
// Serial number generator
const serialNumberGenerator = useSerialNumberGenerator((value: any) => {
if (value) {
props.changeFn(props.idx, 'serial_numbers', value);
@@ -475,7 +487,7 @@ function LineItemFormRow({
props.changeFn(props.idx, 'location', value);
},
description: locationDescription,
value: location,
value: props.item.location,
label: t`Location`,
icon: <InvenTreeIcon icon="location" />
}}
@@ -599,6 +611,7 @@ type LineFormHandlers = {
type LineItemsForm = {
items: any[];
orderPk: number;
destinationPk?: number;
formProps?: LineFormHandlers;
};
@@ -674,7 +687,7 @@ export function useReceiveLineItems(props: LineItemsForm) {
title: t`Receive Line Items`,
fields: fields,
initialData: {
location: null
location: props.destinationPk
},
size: '80%'
});