Solved

UPDATE INVENTORY

  • 3 November 2021
  • 6 replies
  • 439 views

Userlevel 2
Badge

Hello Acumatica Friends :) 

 

I have a question regarding the Update Inventory in Shipement. We want to do it with code for specific shipments (say a condition on the Customer ID) 

 

Is this possible ? I know we tried this function (

soShipmentGraph.UpdateIN.PressButton ()) It changes the shipement status but the inventory is not updated. We don’t have the 2 step-transfer (IN3040PL).

 

In desperate need for help; plzzzz

 

Thank you. 

icon

Best answer by markusray17 3 November 2021, 22:59

View original

6 replies

Userlevel 6
Badge +5

When and where did you want to do this? As in did you want it to automatically update Inventory when the shipment is confirmed based on this condition, or maybe you want a processing page that can be automated to update inventory on all shipments meeting this condition?

 

If calling the UpdateIN action from the graph isn’t working properly I would check the trace log, I would think that means something errored when creating/releasing the matching inventory transactions.

Userlevel 2
Badge

Hello 

 

Thank you @markusray17 

Yes, we want to update inventory when the shipment is confirmed. 

I don’t think we found anything when checking the trace though :/ 

Userlevel 6
Badge +5

Do you have a code snippet to share? Presumably you are adding the call to UpdateIN after the ConfirmShipment action? 

Userlevel 6
Badge +5
    public class SOShipmentEntryExt: PXGraphExtension<SOShipmentEntry>
{
public static bool IsActive() => true;

[PXOverride]
public IEnumerable ConfirmShipmentAction(PXAdapter adapter)
{
Base.confirmShipmentAction.Press(adapter);

PXLongOperation.WaitCompletion(Base.UID);

Base.SelectTimeStamp();

if (Base.Document.Current.ShipmentType == SOShipmentType.Transfer)
Base.UpdateIN.Press();

return adapter.Get();
}
}

I actually had a similar project on my list to work on and got the above code to work as intended. I added the WaitCompletion() call because I was getting an error that the previous operation was not finished when calling Base.UpdateIN.Press(). The Base.SelectTimeStamp() call just updates the graph’s timestamp so you don’t get an error when the UpdateIN action attempts to persist records. 

Userlevel 2
Badge

Hello @markusray17 

 

It works!! Thank you so much for you help;

My code was missing Base.SelectTimeStamp()

 

:)) 

Userlevel 5
Badge +3
    public class SOShipmentEntryExt: PXGraphExtension<SOShipmentEntry>
{
public static bool IsActive() => true;

[PXOverride]
public IEnumerable ConfirmShipmentAction(PXAdapter adapter)
{
Base.confirmShipmentAction.Press(adapter);

PXLongOperation.WaitCompletion(Base.UID);

Base.SelectTimeStamp();

if (Base.Document.Current.ShipmentType == SOShipmentType.Transfer)
Base.UpdateIN.Press();

return adapter.Get();
}
}

I actually had a similar project on my list to work on and got the above code to work as intended. I added the WaitCompletion() call because I was getting an error that the previous operation was not finished when calling Base.UpdateIN.Press(). The Base.SelectTimeStamp() call just updates the graph’s timestamp so you don’t get an error when the UpdateIN action attempts to persist records. 

@markusray17 , @NAWRES , I believe it shoul be mentioned that this approach works well only since  relatively recent  versions of 2020R2 and 2021R1 (I believe after 20.214 and 21.111). Before these updates, this custom code leaves transfer shipments in the Open status instead of Completed (and probably is vulnerable to otherr problems, since it semmed to run the Update In action on an unconfirmed shipment even if shipment confirmation failed)

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