diff --git a/src/frontend/src/forms/SalesOrderForms.tsx b/src/frontend/src/forms/SalesOrderForms.tsx index cf75e50069..bbc92a9b1d 100644 --- a/src/frontend/src/forms/SalesOrderForms.tsx +++ b/src/frontend/src/forms/SalesOrderForms.tsx @@ -125,8 +125,11 @@ export function useSalesOrderLineItemFields({ ) .sort((a: any, b: any) => a.quantity - b.quantity); - if (applicablePriceBreaks.length) + if (applicablePriceBreaks.length) { setSalePrice(applicablePriceBreaks[0].price); + } else { + setSalePrice(''); + } }, [part, quantity, partCurrency, create]); return useMemo(() => { diff --git a/src/frontend/tests/pages/pui_part.spec.ts b/src/frontend/tests/pages/pui_part.spec.ts index 97bf308d67..92042b95d7 100644 --- a/src/frontend/tests/pages/pui_part.spec.ts +++ b/src/frontend/tests/pages/pui_part.spec.ts @@ -408,12 +408,10 @@ test('Parts - Pricing (Variant)', async ({ browser }) => { await loadTab(page, 'Part Pricing'); await page.getByLabel('Part Pricing').getByText('Part Pricing').waitFor(); await page.getByRole('button', { name: 'Pricing Overview' }).waitFor(); - await page.getByText('Last Updated').waitFor(); - await page.getByRole('button', { name: 'Internal Pricing' }).isDisabled(); + await page.getByText('Last Updated').first().waitFor(); + await page.getByRole('button', { name: 'Internal Pricing' }).isEnabled(); await page.getByRole('button', { name: 'BOM Pricing' }).isEnabled(); await page.getByRole('button', { name: 'Variant Pricing' }).isEnabled(); - await page.getByRole('button', { name: 'Sale Pricing' }).isDisabled(); - await page.getByRole('button', { name: 'Sale History' }).isDisabled(); // Variant Pricing await page.getByRole('button', { name: 'Variant Pricing' }).click(); @@ -556,7 +554,7 @@ test('Parts - Parameter Filtering', async ({ browser }) => { await clearTableFilters(page); // All parts should be available (no filters applied) - await page.getByText('/ 425').waitFor(); + await page.getByText(/\/ 42\d/).waitFor(); const clickOnParamFilter = async (name: string) => { const button = await page @@ -584,7 +582,7 @@ test('Parts - Parameter Filtering', async ({ browser }) => { // Reset the filter await clearParamFilter('Color'); - await page.getByText('/ 425').waitFor(); + await page.getByText(/\/ 42\d/).waitFor(); }); test('Parts - Notes', async ({ browser }) => { @@ -624,7 +622,7 @@ test('Parts - Revision', async ({ browser }) => { .getByText('Green Round Table (revision B) | B', { exact: true }) .click(); await page - .getByRole('option', { name: 'Thumbnail Green Round Table Virtual' }) + .getByRole('option', { name: 'Thumbnail Green Round Table No stock' }) .click(); await page.waitForURL('**/web/part/101/**');