Это старый код, но вы можете попробовать ограничить его в соответствии с ролью. В этом примере пользователи с гостевой ролью ограничены типами IN и TR OrderTypes:
[PXDBString(2, IsKey = true, IsFixed = true, InputMask = ">aa")]
[PXDefault(SOOrderTypeConstants.SalesOrder, typeof(SOSetup.defaultOrderType))]
[PXSelector(typeof(Search5<SOOrderType.orderType,
InnerJoin<SOOrderTypeOperation, On<SOOrderTypeOperation.orderType,
Equal<SOOrderType.orderType>, And<SOOrderTypeOperation.operation, Equal<SOOrderType.defaultOperation>>>,
LeftJoin<SOSetupApproval, On<SOOrderType.orderType, Equal<SOSetupApproval.orderType>>
, InnerJoin<Users, On<Current<AccessInfo.userName>, Equal<Users.username>>
, InnerJoin<UsersInRoles, On<Users.username, Equal<UsersInRoles.username>>
, InnerJoin<Roles, On<Roles.rolename, Equal<UsersInRoles.rolename>>>>>>>,
Where2<Where<Roles.guest, Equal<False>>,
Or<Where<SOOrderType.orderType, Equal<string_IN>,
Or<SOOrderType.orderType, Equal<string_TR>>>>>,
Aggregate<GroupBy<SOOrderType.orderType>>>))]
[PXRestrictor(typeof(Where<SOOrderTypeOperation.iNDocType, NotEqual<INTranType.transfer>,
Or<FeatureInstalled<FeaturesSet.warehouse>>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
[PXRestrictor(typeof(Where<SOOrderType.requireAllocation, NotEqual<True>,
Or<AllocationAllowed>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
[PXRestrictor(typeof(Where<SOOrderType.active, Equal<True>>), null)]
[PXUIField(DisplayName = "Order Type", Visibility = PXUIVisibility.SelectorVisible)]
[PX.Data.EP.PXFieldDescription]
protected virtual void SOOrder_OrderType_CacheAttached(PXCache sender) { }