@edsonvelez64
Well, I think you have to go down to the StartOperation call. Try this:
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
// baseMethod not invoked as we are doing the code ourselves
PXCache cache = Base.INRegisterDataMember.Cache;
var 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(PX.Objects.IN.Messages.Document_Status_Invalid);
}
Save.Press();
PXLongOperation.StartOperation(this, delegate ()
{
try
{
INDocumentRelease.ReleaseDoc(list, false, adapter.QuickProcessFlow);
}
catch(PXException ex)
{
// Your code here
throw ex; // required
}
});
return list;
}
Hi,
I achieved what I want using this code. Thanks for the help.
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
baseMethod(adapter);
bool rValue = PXLongOperation.WaitCompletion(Base.UID);
Base.SelectTimeStamp();
if (rValue)
{
if (INRegister.PK.Find(Base, Base.CurrentDocument.Current.DocType, Base.CurrentDocument.Current.RefNbr).Status == INDocStatus.Released)
{
_inservice.UpdateItemLocation(Base, itemloc.Cache, AddOrSubstract.Add, Base.transactions.Cache);
Base.Save.PressButton();
}
}
return adapter.Get();
}