A client has troubles entering in Debit Adjustments and Credit Adjustments into Payables, because they are more familiar with the terms Debit Memos and Credit Memos. Because they have confuse the two, they often enter a Debit Adjustment when they mean to enter a Credit Adjustment. How can we change the appearance of the Debit and Credit Adjustments so they appear as Credit and Debit Memos?
We have traced the source of where APInvoice gets the values of the DocType to the PX.Objects\AP\Descriptor\Messages.cs file. However we aren't sure how to access it via a customization project.
using System;
using PX.Common;
namespace PX.Objects.AP
{
[PXLocalizable(Messages.Prefix)]
public static class Messages
{
// Add your messages here as follows (see line below):
// public const string YourMessage = "Your message here.";
#region Validation and Processing Messages
#region Translatable Strings used in the code
#region Graph Names
#region DAC Names
#region Document Type
public const string Invoice = "Bill";
public const string CreditAdj = "Credit Adj.";
public const string DebitAdj = "Debit Adj.";
public const string Check = "Check";
public const string Prepayment = "Prepayment";
public const string Refund = "Vendor Refund";
What we want is for CreditAdj to equal "Debit Memo" and DebitAdj to equal "Credit Memo". Please let us know if this is possible and if there are any known problems with trying to change these values or if this is not a good practice.
Edit: Now that I've managed to implement the label changes thanks to Samvel's answer, I've attempted to do something similar for APPayment. An issue has come up where an error appears when loading the screen:
Error: The length of the values array is not equal to the length of labels array.
Parameter name: allowedLabels
My New code is as follows:
APPaymentEntry:
public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry>
{
#region Event Handlers
[PXDBString(3, IsKey = true, IsFixed = true)]
[PXDefault]
[PXUIField(DisplayName = "Type", Visibility =
PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
[PXFieldDescription]
[CustomAPPaymentTypeList]
protected virtual void APPayment_DocType_CacheAttached(PXCache sender)
{
}
#endregion
}
CustomAPPaymentType:
public class CustomAPPaymentType : APPaymentType
{
public new static readonly string[] NewLabels = new string[]
{
"Check",
"Credit Memo",
"Prepayment",
"Vendor Refund",
"Voided Refund",
"Voided Check"
};
public new class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(APPaymentType.Values, CustomAPPaymentType.NewLabels )
{
}
}
}
CustomAPPaymentTypeListAttribute
public class CustomAPPaymentTypeListAttribute : CustomAPPaymentType.ListAttribute
{
public override void CacheAttached(PXCache sender)
{
this._AllowedValues = new string[]
{
"CHK",
"ADR",
"PPM",
"REF",
"VRF",
"VCK"
};
this._AllowedLabels = new string[]
{
"Check",
"Credit Memo",
"Prepayment",
"Vendor Refund",
"Voided Refund",
"Voided Check"
};
this._NeutralAllowedLabels = new string[]
{
"Check",
"Credit Memo",
"Prepayment",
"Vendor Refund",
"Voided Refund",
"Voided Check"
};
base.CacheAttached(sender);
}
}
I'm unsure on how to proceed, it seems like I either have too many 'Labels' or 'Values' but it isn't clear on which. I tried to be as accurate to the current setup for current types for APPayment, any advice on where I went wrong?
You can achieve this goal in the following way:
WARNING the customization provided below doesn't change the Debit and Credit Adj labels to Credit and Debit Memo throughout the whole system, for doing that you will need to modify attributes for all the DACs.
First, you need to change labels in the base attribute which is
APInvoiceType.List
, I will inherit fromAPInvoiceType
for doing it like below:Now you need to change the labels in the
APMigrationModeDependentInvoiceTypeListAttribute
for doing that I will inherit fromCustomAPInvoiceType.ListAttribute
, which I have defined in the previous step like below:The last step is to apply this attribute from step 2 to
DocType
field, we will do it usingCacheAttached
event handler andPXGraphExtension
:After publishing this code you will see that the Dropdown for type is showing Credit and Debit Memo like ob the screenshot below: