Skip to main content
Solved

Sales Order Ordered Qty is out of sync to line Quantity


Forum|alt.badge.img

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,

Best answer by junmao01

I moved my function to FieldUpdated event and it worked. 

View original
Did this topic help you find an answer to your question?

5 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • January 3, 2024

@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. 


Forum|alt.badge.img
  • Author
  • Varsity I
  • 26 replies
  • January 3, 2024

@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.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3404 replies
  • January 3, 2024

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.


Forum|alt.badge.img
  • Author
  • Varsity I
  • 26 replies
  • January 3, 2024

@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.


Forum|alt.badge.img
  • Author
  • Varsity I
  • 26 replies
  • Answer
  • January 8, 2024

I moved my function to FieldUpdated event and it worked. 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings