How to override ReleaseReceipt method in Acumatica

Hi everybody,

today I want to share with you how you can override base method ReleaseReceipt. One of the ways of achieving this is to re-use Action.

For example like this in class, which inherits from POReceiptEntry:

 

[PXOverride]
public void ReleaseReceipt(INReceiptEntry docgraph, AP.APInvoiceEntry invoiceGraph, POReceipt aDoc,
    DocumentList<INRegister> aINCreated, DocumentList<AP.APInvoice> aAPCreatedbool aIsMassProcess,
    Action<INReceiptEntry, AP.APInvoiceEntry, POReceipt,
        DocumentList<INRegister>, DocumentList<AP.APInvoice>, boolreleaseBase
)
{
    // Here you can add your logic
    releaseBase(docgraph, invoiceGraph, aDoc, aINCreated, aAPCreated, aIsMassProcess);
// as well as here }

With such approach you'll be able to save a bit of coding with delegate, and also prepend some steps before release execution, and append after release execution.