Larry Dinh
Larry Dinh

Reputation: 387

Acumatica: how can i customize page IN501000 (Release IN Document)

As title, i don't know how can customize this page (processing page). I have extension with override Initialize as below

Base.INDocumentList.SetProcessDelegate(delegate(List<INRegister> list){ ReleaseDocExt(list); });

But ReleaseDocExt not run when i process item.

Upvotes: 1

Views: 531

Answers (1)

Gabriel
Gabriel

Reputation: 3783

I was able to create an extension and override the release process. If I include this extension, system will show "Hello, World!" when trying to release any IN document from the batch processing screen:

namespace PX.Objects.IN
{
  public class INDocumentRelease_Extension:PXGraphExtension<INDocumentRelease>
  {
    public override void Initialize()
    {
    Base.INDocumentList.SetProcessDelegate(delegate(List<INRegister> list){ ReleaseDocExt(list); });
    }

    public static void ReleaseDocExt(List<INRegister> list)
    {
    throw new PXException("Hello, World!!");
    }
  }
}

This code is not getting invoked when releasing a document from one of the inventory screens, like the Receipts (IN.30.10.00) screen. The reason is because these screens directly invoke a static method in the INDocumentRelease class, and don't create a graph to do it:

public PXAction<INRegister> release;
[PXUIField(DisplayName = Messages.Release, MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
[PXProcessButton]
public virtual IEnumerable Release(PXAdapter adapter)
{
    PXCache cache = receipt.Cache;
    List<INRegister> list = new List<INRegister>();
    foreach (INRegister indoc in adapter.Get<INRegister>())
    {
        if (indoc.Hold == false && indoc.Released == false)
        {
            cache.Update(indoc);
            list.Add(indoc);
        }
    }
    if (list.Count == 0)
    {
        throw new PXException(Messages.Document_Status_Invalid);
    }
    Save.Press();
    PXLongOperation.StartOperation(this, delegate() { INDocumentRelease.ReleaseDoc(list, false); });
    return list;
}

There's therefore no opportunity for system to include your extension in this process.

If you absolutely need to customize this process, you'll also need to override the Release actions in the individual screens. This code could also be modified by Acumatica to avoid the use of static functions, and instead instantiate a INDocumentRelease instance that can be customized.

Finally, I would like to warn you about customizing the transaction release processes - make sure you know what you're doing!

Upvotes: 3

Related Questions