mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-13 14:11:37 +00:00
Fix for form auto-fill (#10152)
- Properly set value - Add playwright test for this
This commit is contained in:
@@ -99,9 +99,9 @@ export function RelatedModelField({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChange(value);
|
||||||
setInitialData(value);
|
setInitialData(value);
|
||||||
dataRef.current = [value];
|
dataRef.current = [value];
|
||||||
setPk(data.results[0][pk_field]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -364,6 +364,7 @@ export function RelatedModelField({
|
|||||||
options={data}
|
options={data}
|
||||||
filterOption={null}
|
filterOption={null}
|
||||||
onInputChange={(value: any) => {
|
onInputChange={(value: any) => {
|
||||||
|
console.log('onInputChange', value);
|
||||||
setValue(value);
|
setValue(value);
|
||||||
}}
|
}}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
@@ -8,7 +8,7 @@ import { setPluginState } from './settings.js';
|
|||||||
* Select a number of stock items from the table,
|
* Select a number of stock items from the table,
|
||||||
* and print labels against them
|
* and print labels against them
|
||||||
*/
|
*/
|
||||||
test('Label Printing', async ({ browser }) => {
|
test('Printing - Label Printing', async ({ browser }) => {
|
||||||
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
|
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
|
||||||
|
|
||||||
await page.waitForURL('**/web/stock/location/**');
|
await page.waitForURL('**/web/stock/location/**');
|
||||||
@@ -52,7 +52,7 @@ test('Label Printing', async ({ browser }) => {
|
|||||||
* Navigate to a PurchaseOrder detail page,
|
* Navigate to a PurchaseOrder detail page,
|
||||||
* and print a report against it.
|
* and print a report against it.
|
||||||
*/
|
*/
|
||||||
test('Report Printing', async ({ browser }) => {
|
test('Printing - Report Printing', async ({ browser }) => {
|
||||||
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
|
const page = await doCachedLogin(browser, { url: 'stock/location/index/' });
|
||||||
|
|
||||||
await page.waitForURL('**/web/stock/location/**');
|
await page.waitForURL('**/web/stock/location/**');
|
||||||
@@ -68,19 +68,16 @@ test('Report Printing', async ({ browser }) => {
|
|||||||
await page.getByLabel('action-menu-printing-actions').click();
|
await page.getByLabel('action-menu-printing-actions').click();
|
||||||
await page.getByLabel('action-menu-printing-actions-print-reports').click();
|
await page.getByLabel('action-menu-printing-actions-print-reports').click();
|
||||||
|
|
||||||
// Select template
|
// Template should auto-fill (there is only one template available)
|
||||||
await page.getByLabel('related-field-template').click();
|
await page.getByText('Sample purchase order report').waitFor();
|
||||||
await page.getByRole('option', { name: 'InvenTree Purchase Order' }).click();
|
|
||||||
|
|
||||||
// Submit the print form (should result in success)
|
|
||||||
await page.getByRole('button', { name: 'Print', exact: true }).isEnabled();
|
await page.getByRole('button', { name: 'Print', exact: true }).isEnabled();
|
||||||
await page.getByRole('button', { name: 'Print', exact: true }).click();
|
await page.getByRole('button', { name: 'Print', exact: true }).click();
|
||||||
|
|
||||||
await page.getByText('Process completed successfully').first().waitFor();
|
await page.getByText('Process completed successfully').first().waitFor();
|
||||||
|
|
||||||
await page.context().close();
|
await page.context().close();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Report Editing', async ({ browser, request }) => {
|
test('Printing - Report Editing', async ({ browser, request }) => {
|
||||||
const page = await doCachedLogin(browser, {
|
const page = await doCachedLogin(browser, {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: 'inventree'
|
password: 'inventree'
|
||||||
|
Reference in New Issue
Block a user