2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-07-10 09:00:57 +00:00

[Feature] SalesOrder Auto-Allocate (#12000)

* Add basic auto-allocate functionality

- backend code
- background task
- API endpoint

* Add new endpoint enum

* add frontend components

* Tweak auto-allocate output

* Allow specifying of individual line items

* Tweak error boundary

* Enable bulk-delete of allocated items against sales order

* Refactor stock sorting options

* Allow user to select how to handle serialized stock

* Backport new functionality to BuildOrder allocation

* Refactor sorting options to use enumerated values

* Implement functional unit tests for new feature

* Update API and CHANGELOG

* Additional unit test

* Add playwright testing

* Documentation

* Update docs for build auto-allocate

* Fix dependencies

* Adjust build line filtering

* Fix serializer
This commit is contained in:
Oliver
2026-05-26 23:21:06 +10:00
committed by GitHub
parent 06680758c3
commit 540eb84796
23 changed files with 1468 additions and 22 deletions
@@ -128,6 +128,42 @@ test('Sales Orders - Basic Tests', async ({ browser }) => {
await page.getByRole('button', { name: 'Issue Order' }).waitFor();
});
test('Sales Orders - Auto Allocate', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'sales/sales-order/11/' });
// Duplicate the order
await page.getByRole('button', { name: 'action-menu-order-actions' }).click();
await page.getByRole('menuitem', { name: 'Duplicate' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Pending').first().waitFor();
await loadTab(page, 'Line Items');
await page
.getByRole('button', { name: 'action-button-auto-allocate-' })
.click();
await page
.getByRole('combobox', { name: 'choice-field-stock_sort_by' })
.click();
await page.getByRole('option', { name: 'Newest stock' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Stock allocation complete').first().waitFor();
await page.getByText('10 / 10').first().waitFor();
// Cancel the order (to free up the allocated stock)
await page.getByRole('button', { name: 'action-menu-order-actions' }).click();
await page.getByRole('menuitem', { name: 'Cancel' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Cancelled').first().waitFor();
// Check that the allocated stock has been released
await page
.getByRole('region', { name: 'Line Items', exact: true })
.getByLabel('table-refresh')
.click();
await page.getByText('0 / 10').first().waitFor();
});
test('Sales Orders - Shipments', async ({ browser }) => {
const page = await doCachedLogin(browser);