mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-03 13:58:47 +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'
|
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);
|
var location = locationDetail(item, false);
|
||||||
|
|
||||||
@ -1122,12 +1119,18 @@ function adjustStock(action, items, options={}) {
|
|||||||
location = item.location_detail.pathstring;
|
location = item.location_detail.pathstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.serial != null) {
|
if (!item.serial) {
|
||||||
quantity = `#${item.serial}`;
|
quantityString = `${item.quantity}`;
|
||||||
|
|
||||||
|
if (item.part_detail?.units) {
|
||||||
|
quantityString += `<small> [${item.part_detail.units}]</small>`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quantityString = `#${item.serial}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.batch) {
|
if (item.batch) {
|
||||||
quantity += ` - <small>{% trans "Batch" %}: ${item.batch}</small>`;
|
quantityString += ` - <small>{% trans "Batch" %}: ${item.batch}</small>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actionInput = '';
|
var actionInput = '';
|
||||||
@ -1158,7 +1161,7 @@ function adjustStock(action, items, options={}) {
|
|||||||
html += `
|
html += `
|
||||||
<tr id='stock_item_${pk}' class='stock-item-row'>
|
<tr id='stock_item_${pk}' class='stock-item-row'>
|
||||||
<td id='part_${pk}'>${thumb} ${item.part_detail.full_name}</td>
|
<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='location_${pk}'>${location}</td>
|
||||||
<td id='action_${pk}'>
|
<td id='action_${pk}'>
|
||||||
<div id='div_id_${pk}'>
|
<div id='div_id_${pk}'>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { t } from '@lingui/macro';
|
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 { modals } from '@mantine/modals';
|
||||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
||||||
import { Suspense, useCallback, useMemo, useState } from 'react';
|
import { Suspense, useCallback, useMemo, useState } from 'react';
|
||||||
@ -283,6 +283,14 @@ function StockOperationsRow({
|
|||||||
input.removeFn(input.idx);
|
input.removeFn(input.idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const stockString: string = useMemo(() => {
|
||||||
|
if (!record.serial) {
|
||||||
|
return `${record.quantity}`;
|
||||||
|
} else {
|
||||||
|
return `#${record.serial}`;
|
||||||
|
}
|
||||||
|
}, record);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -298,8 +306,10 @@ function StockOperationsRow({
|
|||||||
<td>{record.location ? record.location_detail.pathstring : '-'}</td>
|
<td>{record.location ? record.location_detail.pathstring : '-'}</td>
|
||||||
<td>
|
<td>
|
||||||
<Flex align="center" gap="xs">
|
<Flex align="center" gap="xs">
|
||||||
<Text>{record.quantity}</Text>
|
<Group position="apart">
|
||||||
<StatusRenderer status={record.status} type={ModelType.stockitem} />
|
<Text>{stockString}</Text>
|
||||||
|
<StatusRenderer status={record.status} type={ModelType.stockitem} />
|
||||||
|
</Group>
|
||||||
</Flex>
|
</Flex>
|
||||||
</td>
|
</td>
|
||||||
{!merge && (
|
{!merge && (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user