Solved

Sales Order Ordered Qty is out of sync to line Quantity

  • 3 January 2024
  • 5 replies
  • 54 views

Userlevel 3
Badge

In Sales Order Entry, the header SOOrder.OrderQty is SumCalc by the SOLine.OrderQty. I changed the SOLine.OrderQty in the SOLine_RowUpdated event by:

      cache.SetValueExt<SOLine.orderQty>(row, newValue);

 

The line quantity did change to the new value, but the header SOOrder.OrderQty still keep the old value. I added another statement:

     PXUnboundFormulaAttribute.CalcAggregate<SOLine.orderQty>(cache, row);

But still no change. Am I missing something?

 

Thanks,

icon

Best answer by junmao01 8 January 2024, 17:07

View original

5 replies

Userlevel 7
Badge +17

@junmao01 I may be missing something here.

By default, Acumatica will do the SUM calculation of SOLine Order Qty and update it in the header level Order Qty field. 

Can you please let me know why are you updating the QTY in the RowUpdated event. 

Userlevel 3
Badge

@Naveen Boga Thanks for the response. This is for return order from Website through API. For example, customer ordered 5 items, Acumatica only shipped 3. The Website created a return order through API. In Acumatica I check the return quantity, if it exceeds the shipped quantity, I set it to shipped quantity. So in RowUpdated event, it customer return quantity 5, but we only shipped 3, then I set the quantity to 3.

Userlevel 7
Badge +17

Understood @junmao01  Thanks for sharing the details.

Seems like caches are not updating properly from the code. Can you please share the source code, so that we can check from our end and let you know.

Userlevel 3
Badge

@Naveen Boga It seems the RowUpdated event get called several times. I have a condition to set the Order quantity:

// Get allowed return quantity allowedReturnQty

…...

decimal? ordQty = row.OrderQty;

if (ordQty > allowedReturnQty)

{

    ordQty = allowedReturnQty;

    cache.SetValueExt<SOLine.orderQty>(row, ordQty);

}

 

The SetValueExt only get called once. It changed the line OrderQty, but it seems doesn’t trigger the SumCalc. If I remove the condition and let the SetValueExt get called every time the RowUpdated is called, then it works. I wonder when the SumCalc is triggered.

Userlevel 3
Badge

I moved my function to FieldUpdated event and it worked. 

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