In Order Types preference screen, I have added a custom field as usrCompanyAcctCD. In that user will select a company for each order type. In the sales order screen, order type selector should only list down the order types which have current logged company id or null. to that I add a restrictor to Order Type as bellow. but it is not working.
[PXDBString(2, IsKey = true, IsFixed = true, InputMask=">aa")]
[PXDefault(SOOrderTypeConstants.SalesOrder, typeof(SOSetup.defaultOrderType))]
[PXSelector(typeof(Search2<SOOrderType.orderType,
InnerJoin<SOOrderTypeOperation, On2<SOOrderTypeOperation.FK.OrderType, And<SOOrderTypeOperation.operation, Equal<SOOrderType.defaultOperation>>>>,
Where<FeatureInstalled<FeaturesSet.inventory>.Or<SOOrderType.behavior.IsNotEqual<SOBehavior.bL>>>>))]
[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>,
And<Where<
SOOrderTypeExt.usrCompanyAcctCD, IsNull,
Or<SOOrderTypeExt.usrCompanyAcctCD, Equal<Current<AccessInfo.userID>>,
Or<SOOrderTypeExt.usrCompanyAcctCD, Equal<Selector<AccessInfo.branchID, BAccount.acctCD>>>
>>>>),
"The order type is not available for the current company.")]
[PXUIField(DisplayName = "Order Type", Visibility = PXUIVisibility.SelectorVisible)]
[PX.Data.EP.PXFieldDescription]