Bug fix for sales order pricing (#10858) (#10863)

* Bug fix for sales order pricing

- Clear sale price field if no pricing

* Adjust playwright tests

(cherry picked from commit d06d80fb99)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2025-11-19 15:12:16 +11:00
committed by GitHub
parent 974a7d5510
commit a585f5407a
2 changed files with 9 additions and 8 deletions

View File

@@ -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(() => {

View File

@@ -404,12 +404,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();
@@ -552,7 +550,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
@@ -580,7 +578,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 }) => {
@@ -620,7 +618,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/**');