mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-18 18:28:18 +00:00
Build order consume (#8191)
* Adds "consumed" field to BuildLine model * Expose new field to serializer * Add "consumed" column to BuildLineTable * Boolean column tweaks * Increase consumed count when completing allocation * Add comment * Update migration * Add serializer for consuming build items * Improve build-line sub-table * Refactor BuildItem.complete_allocation method - Allow optional quantity to be specified - Adjust the allocated quantity when consuming * Perform consumption * Add "BuildConsume" API endpoint * Implement frontend form * Fixes for serializer * Enhance front-end form * Fix rendering of BuildLineTable * Further improve rendering * Bump API version * Update API description * Add option to consume by specifying a list of BuildLine objects * Add form to consume stock via BuildLine reference * Fix api_version * Fix backup colors * Fix typo * Fix migrations * Fix build forms * Forms fixes * Fix formatting * Fixes for BuildLineTable * Account for consumed stock in requirements calculation * Reduce API requirements for BuildLineTable * Docs updates * Updated playwright testing * Update src/frontend/src/forms/BuildForms.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/frontend/src/tables/build/BuildLineTable.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add unit test for filters * Add functional tests * Tweak query count * Increase max query time for testing * adjust unit test again * Prevent consumption of "tracked" items * Adjust playwright tests * Fix table * Fix rendering --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,24 +1,31 @@
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Badge, Skeleton } from '@mantine/core';
|
||||
import { Badge, type MantineColor, Skeleton } from '@mantine/core';
|
||||
|
||||
import { isTrue } from '../functions/Conversion';
|
||||
|
||||
export function PassFailButton({
|
||||
value,
|
||||
passText,
|
||||
failText
|
||||
failText,
|
||||
passColor,
|
||||
failColor
|
||||
}: Readonly<{
|
||||
value: any;
|
||||
passText?: string;
|
||||
failText?: string;
|
||||
passColor?: MantineColor;
|
||||
failColor?: MantineColor;
|
||||
}>) {
|
||||
const v = isTrue(value);
|
||||
const pass = passText ?? t`Pass`;
|
||||
const fail = failText ?? t`Fail`;
|
||||
|
||||
const pColor = passColor ?? 'green';
|
||||
const fColor = failColor ?? 'red';
|
||||
|
||||
return (
|
||||
<Badge
|
||||
color={v ? 'green' : 'red'}
|
||||
color={v ? pColor : fColor}
|
||||
variant='filled'
|
||||
radius='lg'
|
||||
size='sm'
|
||||
@@ -30,7 +37,14 @@ export function PassFailButton({
|
||||
}
|
||||
|
||||
export function YesNoButton({ value }: Readonly<{ value: any }>) {
|
||||
return <PassFailButton value={value} passText={t`Yes`} failText={t`No`} />;
|
||||
return (
|
||||
<PassFailButton
|
||||
value={value}
|
||||
passText={t`Yes`}
|
||||
failText={t`No`}
|
||||
failColor={'orange.6'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function YesNoUndefinedButton({ value }: Readonly<{ value?: boolean }>) {
|
||||
|
||||
@@ -96,6 +96,7 @@ export enum ApiEndpoints {
|
||||
build_output_delete = 'build/:id/delete-outputs/',
|
||||
build_order_auto_allocate = 'build/:id/auto-allocate/',
|
||||
build_order_allocate = 'build/:id/allocate/',
|
||||
build_order_consume = 'build/:id/consume/',
|
||||
build_order_deallocate = 'build/:id/unallocate/',
|
||||
|
||||
build_line_list = 'build/line/',
|
||||
|
||||
Reference in New Issue
Block a user