mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-17 01:38:19 +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:
@@ -350,6 +350,59 @@ test('Build Order - Allocation', async ({ browser }) => {
|
||||
.waitFor();
|
||||
});
|
||||
|
||||
// Test partial stock consumption against build order
|
||||
test('Build Order - Consume Stock', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, {
|
||||
url: 'manufacturing/build-order/24/line-items'
|
||||
});
|
||||
|
||||
// Check for expected progress values
|
||||
await page.getByText('2 / 2', { exact: true }).waitFor();
|
||||
await page.getByText('8 / 10', { exact: true }).waitFor();
|
||||
await page.getByText('5 / 35', { exact: true }).waitFor();
|
||||
await page.getByText('5 / 40', { exact: true }).waitFor();
|
||||
|
||||
// Open the "Allocate Stock" dialog
|
||||
await page.getByRole('checkbox', { name: 'Select all records' }).click();
|
||||
await page
|
||||
.getByRole('button', { name: 'action-button-allocate-stock' })
|
||||
.click();
|
||||
await page
|
||||
.getByLabel('Allocate Stock')
|
||||
.getByText('5 / 35', { exact: true })
|
||||
.waitFor();
|
||||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
|
||||
// Open the "Consume Stock" dialog
|
||||
await page
|
||||
.getByRole('button', { name: 'action-button-consume-stock' })
|
||||
.click();
|
||||
await page.getByLabel('Consume Stock').getByText('2 / 2').waitFor();
|
||||
await page.getByLabel('Consume Stock').getByText('8 / 10').waitFor();
|
||||
await page.getByLabel('Consume Stock').getByText('5 / 35').waitFor();
|
||||
await page.getByLabel('Consume Stock').getByText('5 / 40').waitFor();
|
||||
await page
|
||||
.getByRole('textbox', { name: 'text-field-notes' })
|
||||
.fill('some notes here...');
|
||||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
|
||||
// Try with a different build order
|
||||
await navigate(page, 'manufacturing/build-order/26/line-items');
|
||||
await page.getByRole('checkbox', { name: 'Select all records' }).click();
|
||||
await page
|
||||
.getByRole('button', { name: 'action-button-consume-stock' })
|
||||
.click();
|
||||
|
||||
await page.getByLabel('Consume Stock').getByText('306 / 1,900').waitFor();
|
||||
await page
|
||||
.getByLabel('Consume Stock')
|
||||
.getByText('Fully consumed')
|
||||
.first()
|
||||
.waitFor();
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
});
|
||||
|
||||
test('Build Order - Tracked Outputs', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, {
|
||||
url: 'manufacturing/build-order/10/incomplete-outputs'
|
||||
|
||||
Reference in New Issue
Block a user