acumatica - 客户所需的 BusinessAccountMaint 字段
问题描述
我正在尝试在创建商业帐户时设置它们所需的 PriceClassID。我最初是通过编辑 DAC 来做到这一点的。这导致了一个问题,即每当创建员工时,都会显示错误,从而无法创建员工。
错误:“CPriceClassID”不能为空
我回到绘图板并决定编辑图表上的属性,这允许我创建员工记录。但是,现在通过商业帐户屏幕编辑现有供应商时,我得到了同样的错误。我可以从供应商屏幕创建和编辑供应商,因为它使用不同的图表,但我仍然希望实现更优雅的解决方案
[PXDBString(10, IsUnicode = true)]
[PXSelector(typeof(AR.ARPriceClass.priceClassID))]
[PXUIField(DisplayName = "Price Class", Visibility = PXUIVisibility.Visible)]
[PXDefault()]
protected virtual void Location_CPriceClassID_CacheAttached(PXCache sender)
{
}
在商业帐户屏幕上设置 CPriceClassID 字段的最佳方法是什么,仍然允许我创建员工和供应商而不会出现任何错误?
解决方案
你可以用它PXUIRequiredAttribute
来实现你所需要的。下面是一个示例,说明如何使用它使字段仅在特定屏幕上是必需的:
public class LocationExt : PXCacheExtension<PX.Objects.CR.Location>
{
public class BusinessAccountMaintScreen :Constant<string>
{
//"CR.30.30.00" is the page id of the Business Accounts screen
public BusinessAccountMaintScreen():base("CR.30.30.00")
{
}
}
#region UsrCustomField
[PXDBString(10, IsUnicode = true)]
[PXSelector(typeof(AR.ARPriceClass.priceClassID))]
[PXUIField(DisplayName = "Price Class", Visibility = PXUIVisibility.Visible)]
[PXDefault]
// Here we add checking for the current page so that this field will be required only on the Business Accounts screen
[PXUIRequired(typeof(Where<Current<AccessInfo.screenID>, Equal<BusinessAccountMaintScreen>>))]
public virtual String CPriceClassID {get;set;}
#endregion
}
推荐阅读
- python-3.x - 我不明白这个语法错误。(python 3 的新手)
- c# - 为什么不能在 C# 中设置“this”
- c - CS50 凯撒分段故障说明
- python - 熊猫变换方法执行缓慢
- redis - 切换到 Redis Enterprise 后出现上千个 TimeoutExceptions
- swift - SwiftUI @Binding 值不能改变并调用 init
- javascript - 在 Javascript 中将 ForLoop 隐藏到 ForEach
- postgresql - 将关系“类型”添加到 SQL 中的多对多表是不好的做法吗?
- python - 链接列表 - 添加新节点不起作用
- python-3.x - 如何将连续编号的数组转换为时间戳