2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-05-17 23:08:28 +00:00

Selection lists updates (#11705)

* Add search capability to selection list entry endpoint

* Use API lookup for selection entries

* Add renderer func

* Allow API filtering

* Fetch selectionentry data related to the selected data item

* remove now unneeded entry

* add missing modelinfo

* fix ref

* add api bump

* Provide optional single fetch function to API forms

- Useful if we need to perform a custom API call for initial data

* django-admin support for SelectionList

* Docstring improvements

* Apply 'active' filter

* Tweak api version entry

* Playwright tests

* Tweak docs wording

* Fix incorrect docstring

* Adjust playwright tests

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
Oliver
2026-04-10 09:22:12 +10:00
committed by GitHub
parent 6701f4085d
commit 9965ebcfa1
22 changed files with 325 additions and 84 deletions
+31 -1
View File
@@ -667,7 +667,37 @@ test('Parts - Parameters by Category', async ({ browser }) => {
});
test('Parts - Parameters', async ({ browser }) => {
const page = await doCachedLogin(browser, { url: 'part/69/parameters' });
const page = await doCachedLogin(browser, { url: 'part/915/parameters' });
// Edit parameter defined with a SelectionListEntry
const animalCell = await page.getByRole('cell', {
name: 'Animal',
exact: true
});
await clickOnRowMenu(animalCell);
await page.getByRole('menuitem', { name: 'Edit' }).click();
// Check the data field, which should be populated with the options defined in the "Animal" parameter template
// If both values are present, we know that the correct SelectionListEntry has been loaded
await page
.getByText('Data *Parameter')
.getByText(/Armadillo/i)
.waitFor();
await page
.getByText('Data *Parameter')
.getByText(/A mammal known for/i)
.waitFor();
// Check for other values
await page
.getByRole('combobox', { name: 'related-field-data' })
.fill('horse');
await page.getByText('The offspring of a male donkey').waitFor();
await page.getByText('A small marine fish with a head').waitFor();
await page.getByText('Zebra').click();
// Close the edit dialog
await page.getByRole('button', { name: 'Cancel' }).click();
// check that "is polarized" parameter is not already present - if it is, delete it before proceeding with the rest of the test
await page
@@ -82,6 +82,52 @@ test('Purchasing - Index', async ({ browser }) => {
.waitFor();
});
test('Purchasing - Parameters', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/11/parameters'
});
// Create a new parameter against this purchase order
// We will use a "SelectionList" to choose the value here
await page
.getByRole('button', { name: 'action-menu-add-parameters' })
.click();
await page
.getByRole('menuitem', {
name: 'action-menu-add-parameters-create-parameter'
})
.click();
// Select the template
await page
.getByRole('combobox', { name: 'related-field-template' })
.fill('animal');
await page.getByRole('option', { name: 'Animal Select an animal' }).click();
// Select an animal
await page.getByRole('combobox', { name: 'related-field-data' }).fill('cat');
await page.getByRole('option', { name: 'Caracal' }).click();
// Add a note and submit the form
await page
.getByRole('textbox', { name: 'text-field-note' })
.fill('The caracal is an interesting beast');
await page.getByRole('button', { name: 'Submit' }).click();
// Let's edit this parameter to ensure the "edit" form works as expected
await clickOnRowMenu(await page.getByRole('cell', { name: 'Caracal' }));
await page.getByRole('menuitem', { name: 'Edit' }).click();
await page.getByRole('combobox', { name: 'related-field-data' }).fill('ox');
await page.getByRole('option', { name: 'Fennec Fox' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
// Finally, delete the parameter
await clickOnRowMenu(await page.getByRole('cell', { name: 'Fennec Fox' }));
await page.getByRole('menuitem', { name: 'Delete' }).click();
await page.getByRole('button', { name: 'Delete', exact: true }).click();
});
test('Purchasing - Manufacturer Parts', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/index/manufacturer-parts'