mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-27 22:26:00 +00:00
PO receive fix (#8423)
* Add "active" filter to PurchaseOrderLineItem.part field * Fix for allocation serial numbers to incoming items * Validate serial numbers per line item
This commit is contained in:
@@ -237,6 +237,12 @@ function LineItemFormRow({
|
||||
onClose: () => props.changeFn(props.idx, 'location', undefined)
|
||||
});
|
||||
|
||||
// Is this a trackable part?
|
||||
const trackable: boolean = useMemo(
|
||||
() => record.part_detail?.trackable ?? false,
|
||||
[record]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!!record.destination) {
|
||||
props.changeFn(props.idx, 'location', record.destination);
|
||||
@@ -303,6 +309,14 @@ function LineItemFormRow({
|
||||
props.changeFn(props.idx, 'barcode', barcode);
|
||||
}, [barcode]);
|
||||
|
||||
const batchToolTip: string = useMemo(() => {
|
||||
if (trackable) {
|
||||
return t`Assign Batch Code and Serial Numbers`;
|
||||
} else {
|
||||
return t`Assign Batch Code`;
|
||||
}
|
||||
}, [trackable]);
|
||||
|
||||
// Update location field description on state change
|
||||
useEffect(() => {
|
||||
if (!opened) {
|
||||
@@ -418,9 +432,7 @@ function LineItemFormRow({
|
||||
size="sm"
|
||||
onClick={() => batchHandlers.toggle()}
|
||||
icon={<InvenTreeIcon icon="batch_code" />}
|
||||
tooltip={t`Assign Batch Code${
|
||||
record.trackable && ' and Serial Numbers'
|
||||
}`}
|
||||
tooltip={batchToolTip}
|
||||
tooltipAlignment="top"
|
||||
variant={batchOpen ? 'filled' : 'transparent'}
|
||||
/>
|
||||
@@ -552,18 +564,20 @@ function LineItemFormRow({
|
||||
fieldDefinition={{
|
||||
field_type: 'string',
|
||||
label: t`Batch Code`,
|
||||
description: t`Enter batch code for received items`,
|
||||
value: props.item.batch_code
|
||||
}}
|
||||
error={props.rowErrors?.batch_code?.message}
|
||||
/>
|
||||
<TableFieldExtraRow
|
||||
visible={batchOpen && record.trackable}
|
||||
visible={batchOpen && trackable}
|
||||
onValueChange={(value) =>
|
||||
props.changeFn(props.idx, 'serial_numbers', value)
|
||||
}
|
||||
fieldDefinition={{
|
||||
field_type: 'string',
|
||||
label: t`Serial numbers`,
|
||||
label: t`Serial Numbers`,
|
||||
description: t`Enter serial numbers for received items`,
|
||||
value: props.item.serial_numbers
|
||||
}}
|
||||
error={props.rowErrors?.serial_numbers?.message}
|
||||
|
||||
Reference in New Issue
Block a user