Skip to main content
Answer

Restrict AR Invoice, Document type for users

  • January 26, 2022
  • 3 replies
  • 216 views

Forum|alt.badge.img

Hello!

Is there any possible way to restrict some of the document types for users? 

For example, we need to restrict the ‘Credit Memo’ document type for one user.

Thank You,

Regards 

Amanda 

Best answer by jinin

Hi @apallawala21 

We can achieve this through customization. We need to customize the Doc. Type field and restrict the types. Need to provide conditions based on the User Role.
 

 

Sample code:

public class SOInvoiceEntry_Extension : PXGraphExtension<SOInvoiceEntry>
    {
        #region Event Handlers
        [PXDBString(3, IsKey = true, IsFixed = true)]
        [PXDefault()]
        [ARInvoiceTypeExtn]
        [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
        [PXFieldDescription]
        protected virtual void ARInvoice_DocType_CacheAttached(PXCache cache)
        {
        }

        public class ARInvoiceTypeExtn : PXStringListAttribute
        {
            public ARInvoiceTypeExtn() : base(
                new[]
            {
              Pair(ARDocType.Invoice,ARDocType.GetDisplayName(ARDocType.Invoice)),
              Pair(ARDocType.CashSale,ARDocType.GetDisplayName(ARDocType.CashSale)),
              Pair(ARDocType.CashReturn,ARDocType.GetDisplayName(ARDocType.CashReturn)),
             // Pair(ARDocType.DebitMemo,ARDocType.GetDisplayName(ARDocType.DebitMemo)),            
               })
            { }
        }

        #endregion
    }
 

3 replies

Jp89
Varsity I
Forum|alt.badge.img
  • January 26, 2022

@danamoffat89 

I'm glad to see that I not the only one requesting this, also as listed in my list of complaints.


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • Answer
  • January 27, 2022

Hi @apallawala21 

We can achieve this through customization. We need to customize the Doc. Type field and restrict the types. Need to provide conditions based on the User Role.
 

 

Sample code:

public class SOInvoiceEntry_Extension : PXGraphExtension<SOInvoiceEntry>
    {
        #region Event Handlers
        [PXDBString(3, IsKey = true, IsFixed = true)]
        [PXDefault()]
        [ARInvoiceTypeExtn]
        [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
        [PXFieldDescription]
        protected virtual void ARInvoice_DocType_CacheAttached(PXCache cache)
        {
        }

        public class ARInvoiceTypeExtn : PXStringListAttribute
        {
            public ARInvoiceTypeExtn() : base(
                new[]
            {
              Pair(ARDocType.Invoice,ARDocType.GetDisplayName(ARDocType.Invoice)),
              Pair(ARDocType.CashSale,ARDocType.GetDisplayName(ARDocType.CashSale)),
              Pair(ARDocType.CashReturn,ARDocType.GetDisplayName(ARDocType.CashReturn)),
             // Pair(ARDocType.DebitMemo,ARDocType.GetDisplayName(ARDocType.DebitMemo)),            
               })
            { }
        }

        #endregion
    }
 


Forum|alt.badge.img
  • Jr Varsity II
  • September 1, 2022

@danamoffat89

I'm glad to see that I not the only one requesting this, also as listed in my list of complaints.

Thank you for highlighting that I hope in the future release this will be addressed in a simple manner