How to override action "Create " at form SO301000 or "Sales orders"

Hello everybody,

today I want to document one important piece of functionality in Acumatica. Sales order screen. This is very important screen and has many staff. One of the important screens in it is "Sales orders"  screen. From prospective of understanding Acumatica source code of method "Actions" has plenty of food for mind.

Take a look at it's declaration:

                public PXAction<SOOrder> action;
[PXUIField(DisplayName = "Actions", MapEnableRights = PXCacheRights.Select)] [PXButton] protected virtual IEnumerable Action(PXAdapter adapter, [PXInt] [PXIntList(new int[] { 1, 2, 3, 4, 5 }, new string[] { "Create Shipment""Apply Assignment Rules",                 "Create Invoice""Post Invoice to IN""Create Purchase Order" })] int? actionID, [PXDate] DateTime? shipDate, [PXSelector(typeof(INSite.siteCD))] string siteCD, [SOOperation.List] string operation, [PXString()] string ActionName ) {

}

From this declaration alone you can see that in order to have a button with menu items you need to 

  1. Declare member of type PXAction with lower case name ( in case of "Sales order" screen member is named action )
  2. Create method with Uppser case name ( in case of "Sales order" screen method is named Action )
  3. Besides passing PXAdatapter into method pass also in method integer which is attributted with PXInt, PXIntList
  4. Other attributes and their purpose you can figure out by yourself 

Here I want to leave piece of code that allows you to append this method with your own piece of functionality:

public delegate IEnumerable ActionDelegate(PXAdapter adapter, Nullable<Int32> actionID, Nullable<DateTime> shipDate,
   String siteCD, String operation, String ActionDelegateName);
 
[PXOverride]
public IEnumerable Action(PXAdapter adapter, Nullable<Int32> actionID, Nullable<DateTime> shipDate, String siteCD,
    String operation, String ActionName, ActionDelegate baseMethod)
{
    var currentSoOrder = Base.CurrentDocument.Current;
//and other code }

If to summarize, you'll need:

  1. Declare delegate
  2. Declare action

No Comments

Add a Comment