我正在努力在自定义屏幕上启用[PXInsertButton],在该屏幕上我复制了EPExpenseClaimMaint或EPExpenseClaimDetailMaint的行为。
public PXAction<RMCAFilter> createNew;
[PXUIField(DisplayName = "",Visible =true, MapEnableRights = PXCacheRights.Delete, MapViewRights = PXCacheRights.Delete)]
[PXButton(SpecialType = PXSpecialButtonType.Insert, ImageKey =PX.Web.UI.Sprite.Main.AddNew)]
[PXEntryScreenRights(typeof(RMCAFilter), nameof(RMCashAdvanceEntry.Insert))]
protected virtual void CreateNew()
{
using (new PXPreserveScope())
{
RMCashAdvanceEntry graph = (RMCashAdvanceEntry)PXGraph.CreateInstance(typeof(RMCashAdvanceEntry));
graph.Clear(PXClearOption.ClearAll);
RMCashAdvanceRegister Register = (RMCashAdvanceRegister)graph.Document.Cache.CreateInstance();
graph.Document.Insert(Register);
graph.Document.Cache.IsDirty = false;
PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.InlineWindow);
}
}