2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Part pricing cleanup (#8340)

* Part pricing cleanup

- Improve / tweak rendering for PurchaseHistoryPanel

* Adjust playwright tests
This commit is contained in:
Oliver 2024-10-23 14:33:42 +11:00 committed by GitHub
parent 28146bbbf0
commit a6bba144e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -52,12 +52,15 @@ export default function PurchaseHistoryPanel({
currency: record.purchase_price_currency 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 ( return (
<Group justify="space-between" gap="xs"> <Group justify="space-between" gap="xs">
<Text>{price}</Text> <Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>} {hasPackQuantity && <Text size="xs">[{packQuatity}]</Text>}
</Group> </Group>
); );
} }
@ -74,11 +77,12 @@ export default function PurchaseHistoryPanel({
}); });
let units = record.part_detail?.units; let units = record.part_detail?.units;
let hasUnits = !!units && units !== 1;
return ( return (
<Group justify="space-between" gap="xs"> <Group justify="space-between" gap="xs">
<Text>{price}</Text> <Text>{price}</Text>
{units && <Text size="xs">[{units}]</Text>} {hasUnits && <Text size="xs">[{units}]</Text>}
</Group> </Group>
); );
} }

View File

@ -94,7 +94,10 @@ test('Stock - Serial Numbers', async ({ page }) => {
// Now, with correct quantity // Now, with correct quantity
await page.getByLabel('number-field-quantity').fill('51'); await page.getByLabel('number-field-quantity').fill('51');
await page.waitForTimeout(250);
await page.getByRole('button', { name: 'Submit' }).click(); await page.getByRole('button', { name: 'Submit' }).click();
await page.waitForTimeout(250);
await page await page
.getByText( .getByText(
/The following serial numbers already exist or are invalid : 200,201,202,203,204/ /The following serial numbers already exist or are invalid : 200,201,202,203,204/