Skip to content

Commit

Permalink
[PUI] Tweaks for part purchase order table (#8319)
Browse files Browse the repository at this point in the history
* Improve API query

* Table ordering fixes for PartPurchaseOrdersTable
  • Loading branch information
SchrodingersGat authored Oct 20, 2024
1 parent 29726d8 commit 90f726e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/InvenTree/order/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ def create(self, request, *args, **kwargs):
'SKU': 'part__SKU',
'part_name': 'part__part__name',
'order': 'order__reference',
'status': 'order__status',
'complete_date': 'order__complete_date',
}

Expand All @@ -564,6 +565,7 @@ def create(self, request, *args, **kwargs):
'total_price',
'target_date',
'order',
'status',
'complete_date',
]

Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/tables/ColumnRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,22 @@ export function ProjectCodeColumn(props: TableColumnProps): TableColumn {
export function StatusColumn({
model,
sortable,
ordering,
accessor,
title,
hidden
}: {
model: ModelType;
sortable?: boolean;
accessor?: string;
ordering?: string;
hidden?: boolean;
title?: string;
}) {
return {
accessor: accessor ?? 'status',
sortable: sortable ?? true,
ordering: ordering,
title: title,
hidden: hidden,
render: TableStatusRenderer(model, accessor ?? 'status_custom_key')
Expand Down
8 changes: 8 additions & 0 deletions src/frontend/src/tables/part/PartPurchaseOrdersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ export default function PartPurchaseOrdersTable({
return [
ReferenceColumn({
accessor: 'order_detail.reference',
ordering: 'order',
sortable: true,
switchable: false,
title: t`Purchase Order`
}),
StatusColumn({
accessor: 'order_detail.status',
sortable: true,
ordering: 'status',
title: t`Status`,
model: ModelType.purchaseorder
}),
Expand All @@ -55,6 +57,7 @@ export default function PartPurchaseOrdersTable({
},
{
accessor: 'quantity',
sortable: true,
switchable: false,
render: (record: any) => {
let supplier_part = record?.supplier_part_detail ?? {};
Expand Down Expand Up @@ -100,6 +103,11 @@ export default function PartPurchaseOrdersTable({
accessor: 'target_date',
title: t`Target Date`
}),
DateColumn({
accessor: 'order_detail.complete_date',
ordering: 'complete_date',
title: t`Completion Date`
}),
{
accessor: 'purchase_price',
render: (record: any) =>
Expand Down

0 comments on commit 90f726e

Please sign in to comment.