mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-07 06:00:57 +00:00
[bug] Allocated items print fix (#9952)
* Fix label printing for SalesOrderAllocation table - Need to provide custom lookup option * Add label actions to BuildOrderAllocationTable
This commit is contained in:
@ -52,6 +52,7 @@ const PAGE_SIZES = [10, 15, 20, 25, 50, 100, 500];
|
|||||||
* @param enableSearch : boolean - Enable search actions
|
* @param enableSearch : boolean - Enable search actions
|
||||||
* @param enableLabels : boolean - Enable printing of labels against selected items
|
* @param enableLabels : boolean - Enable printing of labels against selected items
|
||||||
* @param enableReports : boolean - Enable printing of reports against selected items
|
* @param enableReports : boolean - Enable printing of reports against selected items
|
||||||
|
* @param printingAccessor : string - Accessor for label and report printing (default = 'pk')
|
||||||
* @param enablePagination : boolean - Enable pagination
|
* @param enablePagination : boolean - Enable pagination
|
||||||
* @param enableRefresh : boolean - Enable refresh actions
|
* @param enableRefresh : boolean - Enable refresh actions
|
||||||
* @param enableColumnSwitching : boolean - Enable column switching
|
* @param enableColumnSwitching : boolean - Enable column switching
|
||||||
@ -82,6 +83,7 @@ export type InvenTreeTableProps<T = any> = {
|
|||||||
enableColumnCaching?: boolean;
|
enableColumnCaching?: boolean;
|
||||||
enableLabels?: boolean;
|
enableLabels?: boolean;
|
||||||
enableReports?: boolean;
|
enableReports?: boolean;
|
||||||
|
printingAccessor?: string;
|
||||||
afterBulkDelete?: () => void;
|
afterBulkDelete?: () => void;
|
||||||
barcodeActions?: React.ReactNode[];
|
barcodeActions?: React.ReactNode[];
|
||||||
tableFilters?: TableFilter[];
|
tableFilters?: TableFilter[];
|
||||||
@ -115,6 +117,7 @@ const defaultInvenTreeTableProps: InvenTreeTableProps = {
|
|||||||
enableSelection: false,
|
enableSelection: false,
|
||||||
defaultSortColumn: '',
|
defaultSortColumn: '',
|
||||||
barcodeActions: [],
|
barcodeActions: [],
|
||||||
|
printingAccessor: 'pk',
|
||||||
tableFilters: [],
|
tableFilters: [],
|
||||||
tableActions: []
|
tableActions: []
|
||||||
};
|
};
|
||||||
|
@ -25,6 +25,7 @@ import { Boundary } from '../components/Boundary';
|
|||||||
import { ActionButton } from '../components/buttons/ActionButton';
|
import { ActionButton } from '../components/buttons/ActionButton';
|
||||||
import { ButtonMenu } from '../components/buttons/ButtonMenu';
|
import { ButtonMenu } from '../components/buttons/ButtonMenu';
|
||||||
import { PrintingActions } from '../components/buttons/PrintingActions';
|
import { PrintingActions } from '../components/buttons/PrintingActions';
|
||||||
|
import { resolveItem } from '../functions/conversion';
|
||||||
import useDataExport from '../hooks/UseDataExport';
|
import useDataExport from '../hooks/UseDataExport';
|
||||||
import { useDeleteApiFormModal } from '../hooks/UseForm';
|
import { useDeleteApiFormModal } from '../hooks/UseForm';
|
||||||
import { TableColumnSelect } from './ColumnSelect';
|
import { TableColumnSelect } from './ColumnSelect';
|
||||||
@ -140,6 +141,15 @@ export default function InvenTreeTableHeader({
|
|||||||
return (tableState?.queryFilters?.size ?? 0) > 0;
|
return (tableState?.queryFilters?.size ?? 0) > 0;
|
||||||
}, [tableState.queryFilters]);
|
}, [tableState.queryFilters]);
|
||||||
|
|
||||||
|
// Extract ID values for label and report printing
|
||||||
|
const printingIdValues = useMemo(() => {
|
||||||
|
return (
|
||||||
|
tableState.selectedRecords?.map((record) => {
|
||||||
|
return resolveItem(record, tableProps.printingAccessor ?? 'pk');
|
||||||
|
}) ?? []
|
||||||
|
);
|
||||||
|
}, [tableProps.printingAccessor, tableState.selectedRecords]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{exportModal.modal}
|
{exportModal.modal}
|
||||||
@ -165,7 +175,7 @@ export default function InvenTreeTableHeader({
|
|||||||
<Group justify='apart' grow wrap='nowrap'>
|
<Group justify='apart' grow wrap='nowrap'>
|
||||||
<Group justify='left' key='custom-actions' gap={5} wrap='nowrap'>
|
<Group justify='left' key='custom-actions' gap={5} wrap='nowrap'>
|
||||||
<PrintingActions
|
<PrintingActions
|
||||||
items={tableState.selectedIds}
|
items={printingIdValues}
|
||||||
modelType={tableProps.modelType}
|
modelType={tableProps.modelType}
|
||||||
enableLabels={tableProps.enableLabels}
|
enableLabels={tableProps.enableLabels}
|
||||||
enableReports={tableProps.enableReports}
|
enableReports={tableProps.enableReports}
|
||||||
|
@ -266,6 +266,9 @@ export default function BuildAllocatedStockTable({
|
|||||||
rowActions: rowActions,
|
rowActions: rowActions,
|
||||||
tableActions: tableActions,
|
tableActions: tableActions,
|
||||||
tableFilters: tableFilters,
|
tableFilters: tableFilters,
|
||||||
|
enableLabels: true,
|
||||||
|
enableReports: true,
|
||||||
|
printingAccessor: 'stock_item',
|
||||||
modelField: modelField ?? 'stock_item',
|
modelField: modelField ?? 'stock_item',
|
||||||
modelType: modelTarget ?? ModelType.stockitem
|
modelType: modelTarget ?? ModelType.stockitem
|
||||||
}}
|
}}
|
||||||
|
@ -366,6 +366,7 @@ export default function SalesOrderAllocationTable({
|
|||||||
modelField: modelField ?? 'order',
|
modelField: modelField ?? 'order',
|
||||||
enableReports: !isSubTable,
|
enableReports: !isSubTable,
|
||||||
enableLabels: !isSubTable,
|
enableLabels: !isSubTable,
|
||||||
|
printingAccessor: 'item',
|
||||||
modelType: modelTarget ?? ModelType.salesorder
|
modelType: modelTarget ?? ModelType.salesorder
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user