2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-09-13 14:11:37 +00:00

Badges for supplier part (#10187)

* Badges for supplier part

* Robistify playwright test
This commit is contained in:
Oliver
2025-08-18 14:02:28 +10:00
committed by GitHub
parent 669a155467
commit 698249ecad
2 changed files with 14 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints';
import { ModelType } from '@lib/enums/ModelType';
import { UserRoles } from '@lib/enums/Roles';
import { apiUrl } from '@lib/functions/Api';
import { formatDecimal } from '@lib/functions/Formatting';
import { getDetailUrl } from '@lib/functions/Navigation';
import AdminButton from '../../components/buttons/AdminButton';
import {
@@ -370,7 +371,7 @@ export default function SupplierPartDetail() {
visible={supplierPart.active == false}
/>,
<DetailsBadge
label={`${t`In Stock`}: ${supplierPart.in_stock}`}
label={`${t`In Stock`}: ${formatDecimal(supplierPart.in_stock)}`}
color={'green'}
visible={
supplierPart?.active &&
@@ -386,7 +387,7 @@ export default function SupplierPartDetail() {
key='no_stock'
/>,
<DetailsBadge
label={`${t`On Order`}: ${supplierPart.on_order}`}
label={`${t`On Order`}: ${formatDecimal(supplierPart.on_order)}`}
color='blue'
visible={supplierPart.on_order > 0}
key='on_order'

View File

@@ -2,6 +2,7 @@ import { expect } from '@playwright/test';
import { test } from '../baseFixtures.ts';
import {
clearTableFilters,
clickOnRowMenu,
globalSearch,
loadTab,
setTableChoiceFilter
@@ -111,9 +112,11 @@ test('Sales Orders - Shipments', async ({ browser }) => {
await loadTab(page, 'Sales Orders');
await clearTableFilters(page);
// Click through to a particular sales order
await page.getByRole('cell', { name: 'SO0006' }).first().click();
await loadTab(page, 'Shipments');
await clearTableFilters(page);
// Create a new shipment
await page.getByLabel('action-button-add-shipment').click();
@@ -129,7 +132,8 @@ test('Sales Orders - Shipments', async ({ browser }) => {
await page.getByRole('button', { name: 'Cancel' }).click();
// Edit one of the existing shipments
await page.getByLabel('row-action-menu-0').click();
const cell = page.getByRole('cell', { name: /SHIP-XYZ/ });
await clickOnRowMenu(cell);
await page.getByRole('menuitem', { name: 'Edit' }).click();
// Ensure the form has loaded
@@ -155,8 +159,7 @@ test('Sales Orders - Shipments', async ({ browser }) => {
await page.getByRole('button', { name: 'Submit' }).click();
// Click through to a particular shipment
await page.getByLabel('row-action-menu-0').click();
await page.getByRole('menuitem', { name: 'View Shipment' }).click();
await page.getByRole('cell', { name: tracking_number }).click();
// Click through the various tabs
await loadTab(page, 'Attachments');
@@ -176,14 +179,16 @@ test('Sales Orders - Shipments', async ({ browser }) => {
// Let's try to allocate some stock
await loadTab(page, 'Line Items');
await page.getByLabel('row-action-menu-1').click();
await clickOnRowMenu(page.getByRole('cell', { name: 'WID-REV-A' }));
await page.getByRole('menuitem', { name: 'Allocate stock' }).click();
await page
.getByText('Select the source location for the stock allocation')
.waitFor();
await page.getByLabel('number-field-quantity').fill('123');
await page.getByLabel('related-field-stock_item').click();
await page.getByText('Quantity: 42').click();
await page.getByLabel('related-field-stock_item').fill('42');
await page.getByText('Serial Number: 42').click();
await page.getByRole('button', { name: 'Cancel' }).click();
// Search for shipment by tracking number