Good day every one,
In my customization I have extended the KitAssemblyEntry (KitAssemblyEntry_Extension) and added an event handler to the release action:
[PXOverride]
public PXAction<INKitRegister> release;
[PXProcessButton(CommitChanges = true)]
[PXUIField(DisplayName = Messages.Release, MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
public virtual IEnumerable Release(PXAdapter adapter)
{
//Base.Document.Ask("Application date does not equal to Business date, do you really want to release payment?", MessageButtons.OK);
INKitRegister kitRegister = (INKitRegister)Base.Caches[typeof(INKitRegister)].Current;
InventoryItem inventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>.Select(Base, kitRegister.KitInventoryID);
inventoryItem.Descr = "Update from Kit Assembly";
// Update the InventoryItem in the database
Base.Caches[typeof(InventoryItem)].Update(inventoryItem);
// Save changes to the database
Base.Actions.PressSave();
//return adapter.Get();
return Base.release.Press(adapter);
}
I am trying to update the Stock Item (InventoryItem) from the Kit Assembly when the Release action is pressed?
I am not sure why this is not working?
Thanks