How can we remove the “Create Payment” button for Sales users while still allowing our users (Salespeople) to create pre-payments?
Our goal is to allow prepayments, but prevent the team from using the standard payment processing flow.
Thanks!
Best answer by Naveen Boga
@SergioSP Instead of customizing, you can simply create a role for your team that restricts access to the 'Create Payment' feature by configuring the appropriate access rights.
It depends, you can remove it by going into a customization project and making it disabled. However, this can be an issue if you use any sales order types where you can’t use prepayments, such as mixed orders. In my case, I conditionally disabled it by creating a custom field that checks the order type and spits out true for order types that it needs to be enabled and spits out false for the others.
If that doesn’t matter to you, then just set the Enabled field to false instead of worrying about the DependOnGrid and StateColumn. It’s the second button from the top on the Adjustments grid.
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active // Acuminator disable once PX1011 InheritanceFromPXCacheExtension [Justification] public class SO_SOOrder_ExistingColumn : PXCacheExtension<PX.Objects.SO.SOOrder> { #region UsrPaymentVisibleCondition [PXBool] [PXUIField(DisplayName = "PaymentVisibleCondition")] [PXUIEnabled(typeof(False))] [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)] [PXFormula(typeof(IIf<SOOrder.behavior.IsEqual<SOOrderConstants.orderTypeMO> .And<SOOrder.curyUnpaidBalance .IsNotEqual<SOOrderConstants.decimalZero>>, True, False>), Persistent = true)] public virtual bool? UsrPaymentVisibleCondition { get; set; } public abstract class usrPaymentVisibleCondition : PX.Data.BQL.BqlBool.Field<usrPaymentVisibleCondition> { } #endregion }
public class SOOrderConstants { public const string OrderTypeMO = "MO"; public class orderTypeMO : BqlType<IBqlString, string>.Constant<orderTypeMO> { public orderTypeMO() : base(OrderTypeMO) { } } }
@SergioSP Instead of customizing, you can simply create a role for your team that restricts access to the 'Create Payment' feature by configuring the appropriate access rights.
@SergioSP Instead of customizing, you can simply create a role for your team that restricts access to the 'Create Payment' feature by configuring the appropriate access rights.
@Naveen Boga Hmm, I never even thought about doing it that way. Can you do it per sales order type that way as well?
@DrewNisley Access Rights works for the screen generally and cannot apply it only for specific SOTypes, so in this case, your method steps in as the best way to do it
By the way, just in case anyone was planning on using my method, I realized I am an idiot and there is a much simpler way to accomplish it.
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry> { protected virtual void _(Events.RowSelected<SOOrder> e, PXRowSelected baseHandler) { SOOrder line = e.Row;
baseHandler?.Invoke(e.Cache, e.Args);
var ext = Base.GetExtension<PX.Objects.SO.GraphExtensions.SOOrderEntryExt.CreatePaymentExt>();