2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-11-30 09:20:03 +00:00

Bug fix for sales order pricing (#10858)

* Bug fix for sales order pricing

- Clear sale price field if no pricing

* Adjust playwright tests
This commit is contained in:
Oliver
2025-11-19 14:49:51 +11:00
committed by GitHub
parent 2799c4d1fe
commit d06d80fb99
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

@@ -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/**');