I want to change the Invoice main document view and add a condition with a join so that I select only those invoices that belong to the branch set as the current logged-in user’s DefBranchID in UserPreferences.
Solved
How to prevent selecting certain invoices in Invcoice Entry using customization?
Best answer by Marat43
Hi,
Have you tried this approach?
[PXViewName("AR Invoice/Memo")]
[PXCopyPasteHiddenFields(new Type[] { typeof(ARInvoice.invoiceNbr) }, FieldsToShowInSimpleImport = new Type[] { typeof(ARInvoice.invoiceNbr) })]
public SelectFrom<ARInvoice>. LeftJoin<Customer>. On<Customer.bAccountID.IsEqual<ARInvoice.customerID>>
.LeftJoin<UserPreferences>
.On<UserPreferences.userID.IsEqual<AccessInfo.userID.FromCurrent>>
.Where<ARInvoice.docType.IsEqual<Optional<ARInvoice.docType>>.And<ARInvoice.origModule.IsEqual<BatchModule.moduleAR>
.Or<ARInvoice.origModule.IsEqual<BatchModule.moduleEP>>
.Or<ARInvoice.released.IsEqual<True>>>.And<Customer.bAccountID.IsNull.Or<Match<Customer, AccessInfo.userName.FromCurrent>>>
.And<ARInvoice.branchID.IsEqual<UserPreferences.defBranchID>
.Or<UserPreferences.defBranchID.IsNull>>>.View Document;
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.