2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

[Feature] Part lock (#7527)

* Add "locked" field to Part model

- Default = false

* Add "locked" field to PartSerializer

- Allow filtering in API

* Filter CUI tables by "locked" status

* Add "locked" filter to part table

* Update PUI table

* PUI: Update display of part details  page

* Add "locked" element

* Ensmallen the gap

* Edit "locked" field in CUI

* Check BomItem before editing or deleting

* Prevent bulk delete of BOM items

* Check part lock for PartParameter model

* Prevent deletion of a locked part

* Add option to prevent build order creation for unlocked part

* Bump API version

* Hide actions from BOM table if part is locked

* Fix for boolean form field

* Update <PartParameterTable>

* Add unit test for 'BUILDORDER_REQUIRE_LOCKED_PART' setting

* Add unit test for part deletion

* add bom item test

* unit test for part parameter

* Update playwright tests

* Update docs

* Remove defunct setting

* Update playwright tests
This commit is contained in:
Oliver
2024-07-07 11:35:30 +10:00
committed by GitHub
parent 97b6258797
commit 8309eb628f
30 changed files with 448 additions and 119 deletions

View File

@ -2,6 +2,27 @@ import { test } from '../baseFixtures';
import { baseUrl } from '../defaults';
import { doQuickLogin } from '../login';
test('PUI - Pages - Part - Locking', async ({ page }) => {
await doQuickLogin(page);
// Navigate to a known assembly which is *not* locked
await page.goto(`${baseUrl}/part/104/bom`);
await page.getByRole('tab', { name: 'Bill of Materials' }).click();
await page.getByLabel('action-button-add-bom-item').waitFor();
await page.getByRole('tab', { name: 'Parameters' }).click();
await page.getByLabel('action-button-add-parameter').waitFor();
// Navigate to a known assembly which *is* locked
await page.goto(`${baseUrl}/part/100/bom`);
await page.getByRole('tab', { name: 'Bill of Materials' }).click();
await page.getByText('Locked', { exact: true }).waitFor();
await page.getByText('Part is Locked', { exact: true }).waitFor();
// Check the "parameters" tab also
await page.getByRole('tab', { name: 'Parameters' }).click();
await page.getByText('Part parameters cannot be').waitFor();
});
test('PUI - Pages - Part - Pricing (Nothing, BOM)', async ({ page }) => {
await doQuickLogin(page);