Acumatica 如何更改应付款付款的“文档类型”下拉列表的标签
我正在尝试更改AP付款表单上“文档类型”下拉列表的标签,类似于我在上一个问题中对AP发票所做的操作:。我正试图将借方和贷方调整的标签更改为一个更熟悉该术语的客户的贷方和借方备忘录。尝试时,引用使用的数组长度不等时出错 我还试图更改应付款付款行项目的Adjd Document Type下拉列表的标签,以执行相同的操作。但是,我编译的代码不会导致任何下拉标签发生更改 我曾尝试使用类似的代码来更改AP发票文档类型的标签,但由于迁移模式未出现在AP Payment下拉列表的属性中,因此我已取消了对迁移模式的引用 CustomAPPaymentType:Acumatica 如何更改应付款付款的“文档类型”下拉列表的标签,acumatica,Acumatica,我正在尝试更改AP付款表单上“文档类型”下拉列表的标签,类似于我在上一个问题中对AP发票所做的操作:。我正试图将借方和贷方调整的标签更改为一个更熟悉该术语的客户的贷方和借方备忘录。尝试时,引用使用的数组长度不等时出错 我还试图更改应付款付款行项目的Adjd Document Type下拉列表的标签,以执行相同的操作。但是,我编译的代码不会导致任何下拉标签发生更改 我曾尝试使用类似的代码来更改AP发票文档类型的标签,但由于迁移模式未出现在AP Payment下拉列表的属性中,因此我已取消了对迁移模
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);
}
}
AppAymentry:
public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry>
{
#region Event Handlers
[PXDBString(3, IsKey = true, IsFixed = true)]
[PXDefault]
[CustomAPPaymentTypeList]
[PXUIField(DisplayName = "Type", Visibility =
PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
[PXFieldDescription]
protected virtual void APPayment_DocType_CacheAttached(PXCache sender)
{
}
[PXDBString(3, IsKey = true, IsFixed = true, InputMask = "")]
[PXDefault(APDocType.Invoice)]
[PXUIField(DisplayName = "Document Type",
Visibility = PXUIVisibility.Visible)]
[CustomAPInvoiceType.AdjdList()]
protected virtual void APAdjust_AdjdDocType_CacheAttached(PXCache sender)
{
}
#endregion
}
我想要的是应付账款付款单的单据类型和调整单据类型下拉列表,以反映我正在尝试的更改,将借方和贷方调整标签更改为贷方和借方备注。我尝试访问AP付款表单时收到的错误为:
错误#0:值数组的长度不等于标签数组的长度。参数名称:allowedLabels
我不确定如何继续,似乎我有太多的“标签”或“值”,但不清楚是哪一个。我试图对APPayment的当前类型的当前设置尽可能准确,有没有关于我哪里出错的建议?1)
要更改“文档类型”字段的标签,请执行以下操作:
“借方/贷方调整”至“借方/贷方备忘录”
您不需要编写任何代码行
您可以通过使用“翻译词典”屏幕(SM200540)实现这一点
当我们需要从字符串列表中添加或删除“文档类型”时,我们在开发中自定义一个属性
2)
使用翻译的另一个原因是,您可以在应用程序的多个位置(如消息)更改它,这些位置是您尚未想到的:)例如:“只能选择发票和借方调整进行支付。”
您将以比开发解决方案更快的速度完成此任务:)
还可以将更改发布到自定义项目(系统区域设置)
3)
良好实践:对于标签,在PXLocalizable类中使用常量,而不是文字字符串。通过这种方式,它将是多语言的,或者客户可以“编辑”可能需要的任何标签。非常感谢您这是一个比我预期的简单得多的解决方案,我更习惯于解决编码问题。我不熟悉翻译词典,非常有用的工具!
public class CustomAPInvoiceType : APInvoiceType
{
public new static readonly string[] NewLabels = new string[]
{
"Bill",
"Debit Memo",
"Credit Memo",
"Prepayment"
};
public new class ListAttribute : PXStringListAttribute
{
public ListAttribute() : base(APInvoiceType.Values,
CustomAPInvoiceType.NewLabels)
{
}
}
public new class AdjdListAttribute : PXStringListAttribute
{
public AdjdListAttribute() : base(APInvoiceType.Values,
CustomAPInvoiceType.NewLabels)
{
}
}
}