mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Stock transfer dialog fix (#7150)
* Bug fix for stock adjustment dialog - Comparing to null is not sufficient * Update PUI form too * Fix logic * Bug fix
This commit is contained in:
parent
522ea4912c
commit
70b88dbb1c
@ -1110,11 +1110,8 @@ function adjustStock(action, items, options={}) {
|
||||
classes: 'float-right'
|
||||
});
|
||||
|
||||
var quantity = item.quantity;
|
||||
let quantityString = '';
|
||||
|
||||
if (item.part_detail.units != null) {
|
||||
quantity += ` ${item.part_detail.units}`;
|
||||
}
|
||||
|
||||
var location = locationDetail(item, false);
|
||||
|
||||
@ -1122,12 +1119,18 @@ function adjustStock(action, items, options={}) {
|
||||
location = item.location_detail.pathstring;
|
||||
}
|
||||
|
||||
if (item.serial != null) {
|
||||
quantity = `#${item.serial}`;
|
||||
if (!item.serial) {
|
||||
quantityString = `${item.quantity}`;
|
||||
|
||||
if (item.part_detail?.units) {
|
||||
quantityString += `<small> [${item.part_detail.units}]</small>`;
|
||||
}
|
||||
} else {
|
||||
quantityString = `#${item.serial}`;
|
||||
}
|
||||
|
||||
if (item.batch) {
|
||||
quantity += ` - <small>{% trans "Batch" %}: ${item.batch}</small>`;
|
||||
quantityString += ` - <small>{% trans "Batch" %}: ${item.batch}</small>`;
|
||||
}
|
||||
|
||||
var actionInput = '';
|
||||
@ -1158,7 +1161,7 @@ function adjustStock(action, items, options={}) {
|
||||
html += `
|
||||
<tr id='stock_item_${pk}' class='stock-item-row'>
|
||||
<td id='part_${pk}'>${thumb} ${item.part_detail.full_name}</td>
|
||||
<td id='stock_${pk}'>${quantity}${status}</td>
|
||||
<td id='stock_${pk}'>${quantityString}${status}</td>
|
||||
<td id='location_${pk}'>${location}</td>
|
||||
<td id='action_${pk}'>
|
||||
<div id='div_id_${pk}'>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { t } from '@lingui/macro';
|
||||
import { Flex, NumberInput, Skeleton, Text } from '@mantine/core';
|
||||
import { Flex, Group, NumberInput, Skeleton, Text } from '@mantine/core';
|
||||
import { modals } from '@mantine/modals';
|
||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
||||
import { Suspense, useCallback, useMemo, useState } from 'react';
|
||||
@ -283,6 +283,14 @@ function StockOperationsRow({
|
||||
input.removeFn(input.idx);
|
||||
};
|
||||
|
||||
const stockString: string = useMemo(() => {
|
||||
if (!record.serial) {
|
||||
return `${record.quantity}`;
|
||||
} else {
|
||||
return `#${record.serial}`;
|
||||
}
|
||||
}, record);
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td>
|
||||
@ -298,8 +306,10 @@ function StockOperationsRow({
|
||||
<td>{record.location ? record.location_detail.pathstring : '-'}</td>
|
||||
<td>
|
||||
<Flex align="center" gap="xs">
|
||||
<Text>{record.quantity}</Text>
|
||||
<StatusRenderer status={record.status} type={ModelType.stockitem} />
|
||||
<Group position="apart">
|
||||
<Text>{stockString}</Text>
|
||||
<StatusRenderer status={record.status} type={ModelType.stockitem} />
|
||||
</Group>
|
||||
</Flex>
|
||||
</td>
|
||||
{!merge && (
|
||||
|
Loading…
Reference in New Issue
Block a user