首页 > 解决方案 > Acumatica 自定义所有者选择器

问题描述

是否可以在 Acumatica 的“所有者”选择器中按特定部门进行硬编码和过滤?

DAC:AR.Arinvoice

所有者 ID

[PXDBGuid()]

[PXDefault(typeof(Customer.ownerID), PersistingCheck = PXPersistingCheck.Nothing)]

[PXOwnerSelector(typeof(ARInvoice.workgroupID))]

[PXUIField(DisplayName = "Owner", Visibility = PXUIVisibility.SelectorVisible)]

标签: customizationacumaticacustom-selectors

解决方案


是的,您可以使用 PXRestrictor 属性将过滤器添加到选择器。

使用 CODE 文件声明要过滤的所有者部门常量:

namespace PX.TM
{
  public class AdminDepartment : PX.Data.Constant<string>
  {
     public AdminDepartment() : base("ADMIN") { }
  }
}

在此处输入图像描述

扩展 OwnerID DAC 字段以使用新的 PXRestrictor 过滤器附加(合并)现有属性。您可以使用代码中的 CacheAttached 方法或自定义项目编辑器的 DATA ACCESS 部分将属性附加到 DAC 字段:

[PXRestrictor(typeof(Where<PX.TM.PXOwnerSelectorAttribute.EPEmployee.departmentID, Equal<PX.TM.AdminDepartment>>), 
              "Owner Department Filter")]

在此处输入图像描述

您的选择器现在由部门常量过滤: 在此处输入图像描述


推荐阅读