I am trying to override an action on the Production Orders screen. I am following the instructions that
However, when I get to the invoke method the “BaseMethod” is null and throws an error.
The override fires when you click the button, but the Delegate is null.
public delegate IEnumerable LinkSalesOrderDelegate(PXAdapter adapter);
public IEnumerable LinkSalesOrder(PXAdapter adapter, LinkSalesOrderDelegate BaseMethod)
{
AMProdItem curr = Base.ProdItemSelected.Current;
if (curr == null) return adapter.Get();
//if parent is filled, it is NOT the original, so don't unlink the prod order from the SO
if (curr.ParentOrdID != null)
{
curr.OrdNbr = null;
curr.OrdLineRef = null;
curr.OrdTypeRef = null;
curr.CustomerID = null;
AMProdItemExt ext = curr.GetExtension<AMProdItemExt>();
if (ext != null)
{
ext.UsrItemPrice = null;
ext.UsrOrderQty = null;
}
Base.ProdItemSelected.UpdateCurrent();
Base.Actions.PressSave();
return adapter.Get();
}
else
{
AMProdItemExt ext = curr.GetExtension<AMProdItemExt>();
if (ext != null)
{
ext.UsrItemPrice = null;
ext.UsrOrderQty = null;
}
Base.ProdItemSelected.UpdateCurrent();
return BaseMethod.Invoke(adapter);
}
}
Any ideas why?
The goal: if you unlink a SO from a Production Order and the current order is not the “Parent” order, I don’t want to remove the Parent Production order from the SOLine.