mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-18 02:36:31 +00:00
Improve RenderStockItem (#10028)
- Display "available" quantity if some has been allocted
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user