mirror of
https://github.com/inventree/InvenTree.git
synced 2026-06-06 08:54:24 +00:00
@@ -122,6 +122,13 @@ export default function StockDetail() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { instance: part, instanceQuery: partQuery } = useInstance({
|
||||||
|
endpoint: ApiEndpoints.part_list,
|
||||||
|
pk: stockitem?.part,
|
||||||
|
hasPrimaryKey: true,
|
||||||
|
defaultValue: {}
|
||||||
|
});
|
||||||
|
|
||||||
const { instance: serialNumbers, instanceQuery: serialNumbersQuery } =
|
const { instance: serialNumbers, instanceQuery: serialNumbersQuery } =
|
||||||
useInstance({
|
useInstance({
|
||||||
endpoint: ApiEndpoints.stock_serial_info,
|
endpoint: ApiEndpoints.stock_serial_info,
|
||||||
@@ -884,9 +891,8 @@ export default function StockDetail() {
|
|||||||
serial != '' &&
|
serial != '' &&
|
||||||
stockitem.quantity == 1;
|
stockitem.quantity == 1;
|
||||||
|
|
||||||
const canConvert =
|
// Allow variant conversion if the part is a variant, or if the part is a template
|
||||||
!!stockitem.part_detail?.variant_of ||
|
const canConvert = part?.variant_of || part?.is_template;
|
||||||
!!stockitem.part_detail?.is_template;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
<AdminButton model={ModelType.stockitem} id={stockitem.pk} />,
|
<AdminButton model={ModelType.stockitem} id={stockitem.pk} />,
|
||||||
@@ -967,7 +973,7 @@ export default function StockDetail() {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
];
|
];
|
||||||
}, [id, stockitem, user, stockAdjustActions.menuActions]);
|
}, [id, stockitem, part, user, stockAdjustActions.menuActions]);
|
||||||
|
|
||||||
const stockBadges: ReactNode[] = useMemo(() => {
|
const stockBadges: ReactNode[] = useMemo(() => {
|
||||||
let available = (stockitem?.quantity ?? 0) - (stockitem?.allocated ?? 0);
|
let available = (stockitem?.quantity ?? 0) - (stockitem?.allocated ?? 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user