mirror of
https://github.com/inventree/InvenTree.git
synced 2026-01-29 17:43:55 +00:00
[bug] Trim stock allocation (#11060)
* Trim stock allocation - Handle condition where allocated quantity exceeds available stock - Prevent silent failure of build completion * Fix display in buildallocatedstock table * Consolidate table columns * Fetch substitutes for BOM table
This commit is contained in:
@@ -670,9 +670,10 @@ export function BomTable({
|
||||
params: {
|
||||
...params,
|
||||
part: partId,
|
||||
category_detail: true,
|
||||
substitutes: true,
|
||||
part_detail: true,
|
||||
sub_part_detail: true
|
||||
sub_part_detail: true,
|
||||
category_detail: true
|
||||
},
|
||||
tableActions: tableActions,
|
||||
tableFilters: tableFilters,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
|
||||
import { ModelType } from '@lib/enums/ModelType';
|
||||
import { UserRoles } from '@lib/enums/Roles';
|
||||
import { apiUrl } from '@lib/functions/Api';
|
||||
import { ActionButton } from '@lib/index';
|
||||
import { ActionButton, formatDecimal } from '@lib/index';
|
||||
import type { TableFilter } from '@lib/types/Filters';
|
||||
import type { StockOperationProps } from '@lib/types/Forms';
|
||||
import type { TableColumn } from '@lib/types/Tables';
|
||||
@@ -113,13 +113,6 @@ export default function BuildAllocatedStockTable({
|
||||
sortable: true,
|
||||
switchable: true
|
||||
},
|
||||
{
|
||||
accessor: 'serial',
|
||||
title: t`Serial Number`,
|
||||
sortable: false,
|
||||
switchable: true,
|
||||
render: (record: any) => record?.stock_item_detail?.serial
|
||||
},
|
||||
{
|
||||
accessor: 'batch',
|
||||
title: t`Batch Code`,
|
||||
@@ -128,15 +121,22 @@ export default function BuildAllocatedStockTable({
|
||||
render: (record: any) => record?.stock_item_detail?.batch
|
||||
},
|
||||
DecimalColumn({
|
||||
accessor: 'available',
|
||||
accessor: 'stock_item_detail.quantity',
|
||||
title: t`Available`
|
||||
}),
|
||||
DecimalColumn({
|
||||
{
|
||||
accessor: 'quantity',
|
||||
title: t`Allocated`,
|
||||
sortable: true,
|
||||
switchable: false
|
||||
}),
|
||||
render: (record: any) => {
|
||||
const serial = record?.stock_item_detail?.serial;
|
||||
|
||||
if (serial && record?.quantity == 1) {
|
||||
return `${t`Serial`}: ${serial}`;
|
||||
}
|
||||
|
||||
return formatDecimal(record.quantity);
|
||||
}
|
||||
},
|
||||
LocationColumn({
|
||||
accessor: 'location_detail',
|
||||
switchable: true,
|
||||
|
||||
@@ -135,7 +135,7 @@ test('Parts - BOM', async ({ browser }) => {
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
});
|
||||
|
||||
test('Part - Editing', async ({ browser }) => {
|
||||
test('Parts - Editing', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, { url: 'part/104/details' });
|
||||
|
||||
await page.getByText('A square table - with blue paint').first().waitFor();
|
||||
|
||||
Reference in New Issue
Block a user