Solved

Zero Quantity on Sales Order Line

  • 25 March 2022
  • 1 reply
  • 245 views

Is there a way to force a quantity more than 0 on a SO line?

This is more of a quality check for Customer Service during the order entry process.

icon

Best answer by Naveen Boga 26 March 2022, 09:22

View original

1 reply

Userlevel 7
Badge +17

Hi @jrichards ,


We can do below two options.

  1. Provide a validation, when Qty is Zero
  2. Provide default Qty is One

 

OPTION 1

It requires a small piece of customization. Please find the code for reference.

 public class SOOrderEntryEXT : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOLine_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
{
SOLine row = (SOLine)e.Row;
if (row != null)
{
if (row.OrderQty == decimal.Zero)
{
sender.RaiseExceptionHandling<SOLine.orderQty>(row, row.OrderQty, new PXSetPropertyException("Quantity must be greater than 0", PXErrorLevel.Error));
}
}
}
}

 

OPTION 2

  • In OrderQty FieldDefaulting event, you can set the Default Qty as one. Please find the source code below.
    protected virtual void SOLine_OrderQty_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e, PXFieldDefaulting baseEvent)
{
baseEvent?.Invoke(sender, e);
SOLine row = e.Row as SOLine;
if (row == null) return;

if (row.OrderQty == decimal.Zero)
{
e.NewValue = row.OrderQty = 1;
}
}

 

Hope this helps!!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved