2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-02-25 16:17:58 +00:00

[UI] Suggested pricing (#10867)

* Refactor NumberField into separate component

* Add helper func to ensure a number is a number

* Use placeholder value for suggested sale price

* Fix for auto-fill

* Tweak price calculation

* Add UI testing for sales order price breaks

* Fix aria label name

* Annotate price breaks to supplier part

* Fetch price break data

* Support price breaks for purchase order pricing

* Fix required to prevent circular imports

* Add playwright tests for purchase order price breaks

* Bump API version

* Re-add output options for SupplierPriceBreakList

* Revert change

* Simplify unit test
This commit is contained in:
Oliver
2025-11-20 22:51:27 +11:00
committed by GitHub
parent 835c7784f9
commit a76ec0a7b8
16 changed files with 465 additions and 201 deletions

View File

@@ -216,6 +216,44 @@ test('Purchase Orders - Filters', async ({ browser }) => {
await page.getByRole('option', { name: 'Target Date After' }).waitFor();
});
test('Purchase Orders - Price Breaks', async ({ browser }) => {
const page = await doCachedLogin(browser, {
url: 'purchasing/purchase-order/14/line-items'
});
await page
.getByRole('button', { name: 'action-button-add-line-item' })
.click();
await page.getByLabel('related-field-part').fill('002.01');
await page.getByRole('option', { name: 'PCBWOY PCB-002.01' }).click();
// Expected price-break values
const priceBreaks = {
1: 500,
8: 500,
10: 565,
99: 565,
999: 205
};
for (const [qty, expectedPrice] of Object.entries(priceBreaks)) {
await page.getByLabel('number-field-quantity').fill(qty);
await expect(
page.getByRole('textbox', { name: 'number-field-purchase_price' })
).toHaveAttribute('placeholder', expectedPrice.toString(), {
timeout: 500
});
}
// Auto-fill the suggested sale price
await page.getByLabel('field-purchase_price-accept-placeholder').click();
await expect(
page.getByRole('textbox', { name: 'number-field-purchase_price' })
).toHaveValue('205', { timeout: 500 });
});
test('Purchase Orders - Order Parts', async ({ browser }) => {
const page = await doCachedLogin(browser);