Skip to content

Commit

Permalink
PUI: Show "Return from customer" option
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Oct 23, 2024
1 parent a6bba14 commit 99cd0d3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/frontend/src/pages/stock/StockDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ export default function StockDetail() {
});

const stockActions = useMemo(() => {
const inStock = stockitem.in_stock;
const serial = stockitem.serial;
const serialized =
serial != null &&
Expand All @@ -654,13 +655,12 @@ export default function StockDetail() {
/>,
<ActionDropdown
tooltip={t`Stock Operations`}
hidden={!stockitem.in_stock}
icon={<IconPackages />}
actions={[
{
name: t`Count`,
tooltip: t`Count stock`,
hidden: serialized,
hidden: serialized || !inStock,
icon: (
<InvenTreeIcon icon="stocktake" iconProps={{ color: 'blue' }} />
),
Expand All @@ -671,7 +671,7 @@ export default function StockDetail() {
{
name: t`Add`,
tooltip: t`Add Stock`,
hidden: serialized,
hidden: serialized || !inStock,
icon: <InvenTreeIcon icon="add" iconProps={{ color: 'green' }} />,
onClick: () => {
stockitem.pk && addStockItem.open();
Expand All @@ -680,7 +680,7 @@ export default function StockDetail() {
{
name: t`Remove`,
tooltip: t`Remove Stock`,
hidden: serialized,
hidden: serialized || !inStock,
icon: <InvenTreeIcon icon="remove" iconProps={{ color: 'red' }} />,
onClick: () => {
stockitem.pk && removeStockItem.open();
Expand All @@ -689,7 +689,10 @@ export default function StockDetail() {
{
name: t`Serialize`,
tooltip: t`Serialize stock`,
hidden: serialized || stockitem?.part_detail?.trackable != true,
hidden:
!inStock ||
serialized ||
stockitem?.part_detail?.trackable != true,
icon: <InvenTreeIcon icon="serial" iconProps={{ color: 'blue' }} />,
onClick: () => {
serializeStockItem.open();
Expand All @@ -698,6 +701,7 @@ export default function StockDetail() {
{
name: t`Transfer`,
tooltip: t`Transfer Stock`,
hidden: !inStock,
icon: (
<InvenTreeIcon icon="transfer" iconProps={{ color: 'blue' }} />
),
Expand All @@ -708,7 +712,7 @@ export default function StockDetail() {
{
name: t`Return`,
tooltip: t`Return from customer`,
hidden: !stockitem.customer,
hidden: !stockitem.sales_order,
icon: (
<InvenTreeIcon
icon="return_orders"
Expand Down

0 comments on commit 99cd0d3

Please sign in to comment.