2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 22:21:37 +00:00

[refactor] PO receive fix (#10174)

* Enhance 'count_queries' helper

* Add threshold

* Update typing

* Better rendering

* Improve StockItem

- Make model operations more efficient

* improve with_mixin

- Cache config map against the session cache

* Refactor receive_line_item

- Pass multiple line items in simultaneously
- DB query optimization
- Use bulk_create and bulk_update operations

* Remove extraneous save call

* Fix for unit tests

* Fix return type

* Fix serializer return type

* Refactor part pricing updates

* UI tweaks

* Use bulk_create

* Refactor API and endpoints

* Bump API version

* Fix unit tests

* Fix playwright tests

* Remove debug msg

* Fix for table filter hover

* Adjust unit test
This commit is contained in:
Oliver
2025-08-15 22:01:19 +10:00
committed by GitHub
parent 0f04c31ffb
commit 0bed5cf511
21 changed files with 519 additions and 313 deletions

View File

@@ -364,7 +364,6 @@ export function RelatedModelField({
options={data}
filterOption={null}
onInputChange={(value: any) => {
console.log('onInputChange', value);
setValue(value);
}}
onChange={onChange}

View File

@@ -1,4 +1,5 @@
import { t } from '@lingui/core/macro';
import { Text } from '@mantine/core';
import type { ReactNode } from 'react';
import { ModelType } from '@lib/enums/ModelType';
@@ -118,7 +119,7 @@ export function RenderSalesOrderShipment({
return (
<RenderInlineModel
primary={order.reference}
secondary={`${t`Shipment`} ${instance.reference}`}
suffix={<Text size='sm'>{`${t`Shipment`} ${instance.reference}`}</Text>}
/>
);
}

View File

@@ -63,7 +63,7 @@ export function RenderPartCategory(
const suffix: ReactNode = (
<Group gap='xs'>
<TableHoverCard
value=''
value={<Text size='sm'>{instance.description}</Text>}
position='bottom-end'
zIndex={10000}
icon='sitemap'
@@ -89,7 +89,6 @@ export function RenderPartCategory(
</>
}
primary={category}
secondary={instance.description}
suffix={suffix}
url={
props.link

View File

@@ -25,7 +25,7 @@ export function RenderStockLocation(
const suffix: ReactNode = (
<Group gap='xs'>
<TableHoverCard
value=''
value={<Text size='sm'>{instance.description}</Text>}
position='bottom-end'
zIndex={10000}
icon='sitemap'
@@ -51,7 +51,6 @@ export function RenderStockLocation(
</>
}
primary={location}
secondary={instance.description}
suffix={suffix}
url={
props.link

View File

@@ -843,13 +843,6 @@ export default function PartDetail() {
<Skeleton />
)
},
{
name: 'builds',
label: t`Build Orders`,
icon: <IconTools />,
hidden: !part.assembly || !user.hasViewRole(UserRoles.build),
content: part.pk ? <BuildOrderTable partId={part.pk} /> : <Skeleton />
},
{
name: 'used_in',
label: t`Used In`,
@@ -905,6 +898,13 @@ export default function PartDetail() {
!globalSettings.isSet('RETURNORDER_ENABLED'),
content: part.pk ? <ReturnOrderTable partId={part.pk} /> : <Skeleton />
},
{
name: 'builds',
label: t`Build Orders`,
icon: <IconTools />,
hidden: !part.assembly || !user.hasViewRole(UserRoles.build),
content: part.pk ? <BuildOrderTable partId={part.pk} /> : <Skeleton />
},
{
name: 'stocktake',
label: t`Stock History`,

View File

@@ -247,38 +247,42 @@ export default function InvenTreeTableHeader({
variant='transparent'
aria-label='table-select-filters'
>
<Tooltip label={t`Table Filters`} position='top-end'>
<HoverCard
position='bottom-end'
withinPortal={true}
disabled={!tableState.filterSet.activeFilters?.length}
>
<HoverCard.Target>
<HoverCard
position='bottom-end'
withinPortal={true}
disabled={!tableState.filterSet.activeFilters?.length}
>
<HoverCard.Target>
<Tooltip
label={t`Table Filters`}
position='top-end'
disabled={!!tableState.filterSet.activeFilters?.length}
>
<IconFilter
onClick={() => setFiltersVisible(!filtersVisible)}
/>
</HoverCard.Target>
<HoverCard.Dropdown>
<Paper p='sm' withBorder>
<Stack gap='xs'>
<StylishText size='md'>{t`Active Filters`}</StylishText>
<Divider />
{tableState.filterSet.activeFilters?.map((filter) => (
<Group
key={filter.name}
justify='space-between'
gap='xl'
wrap='nowrap'
>
<Text size='sm'>{filter.label}</Text>
<Text size='xs'>{filter.displayValue}</Text>
</Group>
))}
</Stack>
</Paper>
</HoverCard.Dropdown>
</HoverCard>
</Tooltip>
</Tooltip>
</HoverCard.Target>
<HoverCard.Dropdown>
<Paper p='sm' withBorder>
<Stack gap='xs'>
<StylishText size='md'>{t`Active Filters`}</StylishText>
<Divider />
{tableState.filterSet.activeFilters?.map((filter) => (
<Group
key={filter.name}
justify='space-between'
gap='xl'
wrap='nowrap'
>
<Text size='sm'>{filter.label}</Text>
<Text size='xs'>{filter.displayValue}</Text>
</Group>
))}
</Stack>
</Paper>
</HoverCard.Dropdown>
</HoverCard>
</ActionIcon>
</Indicator>
)}

View File

@@ -616,11 +616,7 @@ test('Parts - Bulk Edit', async ({ browser }) => {
await page.getByLabel('action-menu-part-actions').click();
await page.getByLabel('action-menu-part-actions-set-category').click();
await page.getByLabel('related-field-category').fill('rnitu');
await page
.getByRole('option', { name: '- Furniture/Chairs' })
.getByRole('paragraph')
.click();
await page.getByRole('option', { name: '- Furniture/Chairs' }).click;
await page.getByRole('button', { name: 'Update' }).click();
await page.getByText('Items Updated').waitFor();
});