限制可用的下拉值

时间:2018-04-11 15:45:47

标签: acumatica

我有一位客户希望删除"信用调整。"和"预付款" "票据和调整(AP301000)"屏幕。

我创建了一个Customization Project并查看了Type字段中的Attributes。它看起来像这样:

enter image description here

是否有人知道是否可以在"自定义属性"中添加一些代码。上面截图的区域隐藏了" Credit Adj。"和"预付款"选项?

1 个答案:

答案 0 :(得分:0)

您需要创建自己的ListAttribute,然后替换APInvoice.DocType的那个。

示例ListAttribute

using System;
using PX.Data;
using PX.Objects.AP;

namespace APDocTypeOverride {
    public class APPaymentDocTypeExt {
        public new class ListAttribute : PXStringListAttribute {
            public ListAttribute () : base (
                new string[] { APDocType.Invoice, APDocType.DebitAdj },
                new string[] { Messages.Invoice, Messages.DebitAdj }) { ; }
        }
    }
}

之后,您需要替换DocType字段上的属性。您可以通过覆盖DAC上的DocType属性或仅使用CacheAttached事件覆盖屏幕来实现。我会覆盖屏幕,否则在DAC级别执行它会覆盖Acumatica中使用它的每个屏幕。

示例APInvoiceEntry图扩展

[PXDBString(3, IsKey = true, IsFixed = true)]
[PXDefault]
[APDocTypeOverride.APPaymentDocTypeExt.List]
[PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
[PXFieldDescription]
protected virtual void APInvoice_DocType_CacheAttached(PXCache cache)
{

}
相关问题