2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-14 02:07:13 +00:00

[enhancement] Stocktake updates (#11257)

* Allow part queryset to be passed to 'perform_stocktake' function

* Add new options to perform_stocktake

* Allow download of part stocktake snapshot data

* API endpoint for generating a stocktake entry

* Simplify code

* Generate report output

* Dashboard stocktake widget

- Generate stocktake snapshot from the dashboard

* Force stocktake entry for part

* Add docs

* Cleanup docs

* Update API version

* Improve efficiency of stocktake generation

* Error handling

* Add simple playwright test

* Fix typing
This commit is contained in:
Oliver
2026-02-06 10:21:30 +11:00
committed by GitHub
parent 2c59c165ba
commit b4eeba5e31
14 changed files with 545 additions and 68 deletions

View File

@@ -1,13 +1,18 @@
import type { Page } from '@playwright/test';
import { test } from '../baseFixtures.js';
import { doCachedLogin } from '../login.js';
import { setPluginState } from '../settings.js';
const resetDashboard = async (page: Page) => {
await page.getByLabel('dashboard-menu').click();
await page.getByRole('menuitem', { name: 'Clear Widgets' }).click();
};
test('Dashboard - Basic', async ({ browser }) => {
const page = await doCachedLogin(browser);
// Reset wizards
await page.getByLabel('dashboard-menu').click();
await page.getByRole('menuitem', { name: 'Clear Widgets' }).click();
// Reset dashboard widgets
await resetDashboard(page);
await page.getByText('Use the menu to add widgets').waitFor();
@@ -39,6 +44,28 @@ test('Dashboard - Basic', async ({ browser }) => {
await page.getByLabel('dashboard-accept-layout').click();
});
test('Dashboard - Stocktake', async ({ browser }) => {
// Trigger a "stocktake" report from the dashboard
const page = await doCachedLogin(browser);
// Reset dashboard widgets
await resetDashboard(page);
await page.getByLabel('dashboard-menu').click();
await page.getByRole('menuitem', { name: 'Add Widget' }).click();
await page.getByLabel('dashboard-widgets-filter-input').fill('stocktake');
await page.getByRole('button', { name: 'add-widget-stk' }).click();
await page.waitForTimeout(100);
await page.keyboard.press('Escape');
await page.getByRole('button', { name: 'Generate Stocktake Report' }).click();
await page.getByText('Select a category to include').waitFor();
await page.getByRole('button', { name: 'Generate', exact: true }).waitFor();
});
test('Dashboard - Plugins', async ({ browser }) => {
// Ensure that the "SampleUI" plugin is enabled
await setPluginState({
@@ -48,6 +75,8 @@ test('Dashboard - Plugins', async ({ browser }) => {
const page = await doCachedLogin(browser);
await resetDashboard(page);
// Add a dashboard widget from the SampleUI plugin
await page.getByLabel('dashboard-menu').click();
await page.getByRole('menuitem', { name: 'Add Widget' }).click();