mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 22:26:00 +00:00
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:
@@ -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%'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user