2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-17 18:26:32 +00:00

Improve RenderStockItem (#10028)

- Display "available" quantity if some has been allocted
This commit is contained in:
Oliver
2025-07-15 18:26:48 +10:00
committed by GitHub
parent 24bff424d9
commit 42abc61494
2 changed files with 7 additions and 1 deletions

View File

@@ -57,12 +57,19 @@ export function RenderStockItem(
const { instance } = props;
let quantity_string = '';
const allocated: number = Math.max(0, instance?.allocated ?? 0);
if (instance?.serial !== null && instance?.serial !== undefined) {
quantity_string += `${t`Serial Number`}: ${instance.serial}`;
} else if (allocated > 0) {
const available: number = Math.max(0, instance.quantity - allocated);
quantity_string = `${t`Available`}: ${available} / ${instance.quantity}`;
} else if (instance?.quantity) {
quantity_string = `${t`Quantity`}: ${instance.quantity}`;
}
console.log('item:', instance);
let batch_string = '';
if (!!instance.batch) {

View File

@@ -560,7 +560,6 @@ export default function BuildLineTable({
in_production &&
!consumable &&
user.hasChangeRole(UserRoles.build) &&
record.allocated < record.quantity &&
record.trackable == hasOutput;
// Can de-allocate