Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Part pricing cleanup #8340

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ export default function PurchaseHistoryPanel({
currency: record.purchase_price_currency
});

let units = record.supplier_part_detail?.pack_quantity;
let packQuatity = record.supplier_part_detail?.pack_quantity;
let hasPackQuantity =
!!packQuatity &&
record.supplier_part_detail?.pack_quantity_native != 1;

return (
<Group justify="space-between" gap="xs">
<Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>}
{hasPackQuantity && <Text size="xs">[{packQuatity}]</Text>}
</Group>
);
}
Expand All @@ -74,11 +77,12 @@ export default function PurchaseHistoryPanel({
});

let units = record.part_detail?.units;
let hasUnits = !!units && units !== 1;

return (
<Group justify="space-between" gap="xs">
<Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>}
{hasUnits && <Text size="xs">[{units}]</Text>}
</Group>
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/tests/pages/pui_stock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from '../baseFixtures.js';

Check failure on line 1 in src/frontend/tests/pages/pui_stock.spec.ts

View workflow job for this annotation

GitHub Actions / Tests - Platform UI

[chromium] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers

1) [chromium] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers ──────────────────────────── Test timeout of 90000ms exceeded.

Check failure on line 1 in src/frontend/tests/pages/pui_stock.spec.ts

View workflow job for this annotation

GitHub Actions / Tests - Platform UI

[firefox] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers

2) [firefox] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers ───────────────────────────── Test timeout of 90000ms exceeded.
import { baseUrl } from '../defaults.js';
import { doQuickLogin } from '../login.js';

Expand Down Expand Up @@ -86,7 +86,7 @@
await page.getByRole('button', { name: 'Submit' }).click();

// Expected error messages
await page.getByText('Errors exist for one or more form fields').waitFor();

Check failure on line 89 in src/frontend/tests/pages/pui_stock.spec.ts

View workflow job for this annotation

GitHub Actions / Tests - Platform UI

[chromium] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers

1) [chromium] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers ──────────────────────────── Error: locator.waitFor: Test timeout of 90000ms exceeded. Call log: - waiting for getByText('Errors exist for one or more form fields') to be visible 87 | 88 | // Expected error messages > 89 | await page.getByText('Errors exist for one or more form fields').waitFor(); | ^ 90 | await page 91 | .getByText(/exceeds allowed quantity/) 92 | .first() at /home/runner/work/InvenTree/InvenTree/src/frontend/tests/pages/pui_stock.spec.ts:89:68

Check failure on line 89 in src/frontend/tests/pages/pui_stock.spec.ts

View workflow job for this annotation

GitHub Actions / Tests - Platform UI

[firefox] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers

2) [firefox] › pages/pui_stock.spec.ts:52:1 › Stock - Serial Numbers ───────────────────────────── Error: locator.waitFor: Test timeout of 90000ms exceeded. Call log: - waiting for getByText('Errors exist for one or more form fields') to be visible 87 | 88 | // Expected error messages > 89 | await page.getByText('Errors exist for one or more form fields').waitFor(); | ^ 90 | await page 91 | .getByText(/exceeds allowed quantity/) 92 | .first() at /home/runner/work/InvenTree/InvenTree/src/frontend/tests/pages/pui_stock.spec.ts:89:68
await page
.getByText(/exceeds allowed quantity/)
.first()
Expand All @@ -94,7 +94,10 @@

// Now, with correct quantity
await page.getByLabel('number-field-quantity').fill('51');
await page.waitForTimeout(250);
await page.getByRole('button', { name: 'Submit' }).click();
await page.waitForTimeout(250);

await page
.getByText(
/The following serial numbers already exist or are invalid : 200,201,202,203,204/
Expand Down
Loading