mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-30 12:45:42 +00:00
Fix annotations for returning serialized StockItems as lists (#9969)
* Fix annotations/pagination on StockApi itemSerialize and BuildApi outputCreate * Add (to schema) field to specify serial numbers on create for stock item * Return list on StockItem creation * Update api version * Update test to expect list return when creating stock items * Add note about breaking changes to api version * Add handling for stockitem list return on creation * Update api version --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com> Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Group, Text } from '@mantine/core';
|
||||
import { type ReactNode, useMemo, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { ActionButton } from '@lib/components/ActionButton';
|
||||
import { AddItemButton } from '@lib/components/AddItemButton';
|
||||
@@ -8,6 +9,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 { getDetailUrl } from '@lib/functions/Navigation';
|
||||
import type { TableFilter } from '@lib/types/Filters';
|
||||
import type { TableColumn } from '@lib/types/Tables';
|
||||
import OrderPartsWizard from '../../components/wizards/OrderPartsWizard';
|
||||
@@ -483,6 +485,8 @@ export function StockItemTable({
|
||||
[settings]
|
||||
);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const tableColumns = useMemo(
|
||||
() =>
|
||||
stockItemTableColumns({
|
||||
@@ -528,7 +532,12 @@ export function StockItemTable({
|
||||
},
|
||||
follow: true,
|
||||
table: table,
|
||||
modelType: ModelType.stockitem
|
||||
onFormSuccess: (response: any) => {
|
||||
// Returns a list that may contain multiple serialized stock items
|
||||
// Navigate to the first result
|
||||
navigate(getDetailUrl(ModelType.stockitem, response[0].pk));
|
||||
},
|
||||
successMessage: t`Stock item serialized`
|
||||
});
|
||||
|
||||
const [partsToOrder, setPartsToOrder] = useState<any[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user