mirror of
https://github.com/inventree/InvenTree.git
synced 2026-03-25 05:38:41 +00:00
[refactor] Optional prefetch (#11012)
* Automatic prefetch of related fields for enable_filter - Allows us to *not* prefetch fields (expensive) when they are not going to be used - Enables re-usable components for common detail fields * Refactor "project_code_detail" filter into common component - Automatically apply correct prefetch fields * Refactor 'parameters' annotation - add 'enable_parameters_filter' function - Prefetch parameters only when needed - Refactor / consolidate code * Refactor SupplierPartSerializer - Make fields switchable - Ensure correct prefetch_related * Refactor serializer for ManufacturerPart * Refactor BuildSerializer * Refactor PurchaseOrderSerializer * Refactor SalesOrderSerializer * Refactor ReturnOrderSerializer * Remove debug statements * Tweaks * Simplify custom filterable fields * Bump API version * Fix for data export * Additional unit tests * Remove unused "prefetch_func" option * Refactor PurchaseOrderLineItemList * Refactor SalesOrderLineItemList * Refactor ReturnOrderLineItem * Cleanup "pretty_name" * Fix for build list * Refactoring StockItem API endpoint - Needs significant work still * Refactoring for BuildLineSerializer * Keep all optional fields when exporting data * Improve "UserRoles" API endpoint - Prefetch roles - Prevents significant number of db hits * Prefetch Parameter API list * Bug fix for exporting logic * Specify InvenTreeOutputOption * Optional prefetch for primary_address * Fix typing * Fix unit test * fixes for playwright tests * Update Part API - Improved prefetching * Fix for prefetch
This commit is contained in:
@@ -972,8 +972,10 @@ export default function BuildLineTable({
|
||||
...params,
|
||||
build: build.pk,
|
||||
assembly_detail: false,
|
||||
bom_item_detail: true,
|
||||
category_detail: true,
|
||||
part_detail: true
|
||||
part_detail: true,
|
||||
allocations: true
|
||||
},
|
||||
tableActions: tableActions,
|
||||
tableFilters: tableFilters,
|
||||
|
||||
@@ -206,7 +206,9 @@ export default function BuildOutputTable({
|
||||
.get(apiUrl(ApiEndpoints.build_line_list), {
|
||||
params: {
|
||||
build: buildId,
|
||||
tracked: true
|
||||
tracked: true,
|
||||
bom_item_detail: true,
|
||||
allocations: true
|
||||
}
|
||||
})
|
||||
.then((response) => response.data);
|
||||
|
||||
@@ -165,7 +165,8 @@ export default function PartBuildAllocationsTable({
|
||||
project_code_detail: true,
|
||||
assembly_detail: true,
|
||||
build_detail: true,
|
||||
order_outstanding: true
|
||||
order_outstanding: true,
|
||||
allocations: true
|
||||
},
|
||||
enableColumnSwitching: true,
|
||||
enableSearch: false,
|
||||
|
||||
@@ -439,7 +439,8 @@ export function PurchaseOrderLineItemTable({
|
||||
params: {
|
||||
...params,
|
||||
order: orderId,
|
||||
part_detail: true
|
||||
part_detail: true,
|
||||
destination_detail: true
|
||||
},
|
||||
rowActions: rowActions,
|
||||
tableActions: tableActions,
|
||||
|
||||
@@ -419,7 +419,8 @@ test('Purchase Orders - Receive Items', async ({ browser }) => {
|
||||
.getByRole('cell', { name: /Choose Location/ })
|
||||
.getByText('Room 101')
|
||||
.waitFor();
|
||||
await page.getByText('Mechanical Lab').waitFor();
|
||||
|
||||
await page.getByText('Mechanical Lab').first().waitFor();
|
||||
|
||||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user