我需要添加一个名为&#34的自定义复选框;清除"在Acumatica的期刊交易页面(GL301000)中的详细信息行。在批次发布后,用户必须能够选中此框。当用户选中另一个标题为" Date Cleared"应该记录日期和时间。两个值都必须保存在数据库中。发布批次后,Acumatica会禁用详细信息行。我怎么能这样做?
我看到了类似问题here的答案。 JournalEntry BLC似乎使用ReadOnlyStateController而不是GetStateController方法中的CommonTypeStateController禁用细节线,所以我认为这个解决方案需要不同。此外,期刊交易页面似乎不是由this类似问题的自动化步骤驱动的。
答案 0 :(得分:0)
您是正确的日记帐交易页面不是由自动化步骤驱动的。 如果要在此屏幕的GLTran(行)上启用自定义字段,则需要覆盖JournalEntry图扩展上的GLTran_RowSelected和Batch_RowSelected。此外,您可以重用GetStateController方法中使用的IsBatchReadonly函数。
在 Batch_RowSelected 事件处理程序中,您将:
- 使用 GetStateController 方法中的 isBatchReadOnly 功能,检查是否只读取批次。
- 然后,在缓存上将 allowUpdate 设置为true
- 将 readonly false设置为所有GLTran字段
- 然后将 readonly 设置为对所有GLTran字段设置为true,而不是自定义字段。
然后在 GLTran_RowSelected 事件处理程序中,您将设置启用自定义字段。
见下面的示例:
public class JournalEntry_Extension : PXGraphExtension<JournalEntry>
{
protected void GLTran_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
GLTran row = (GLTran)e.Row;
if (del != null)
del(cache, e);
if (row != null)
{
PXUIFieldAttribute.SetEnabled<GLTranExt.usrCustomField1>(cache, row, true);
PXUIFieldAttribute.SetEnabled<GLTranExt.usrCustomField2>(cache, row, true);
}
}
protected void Batch_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
{
Batch row = (Batch)e.Row;
if (del != null)
del(cache, e);
if (row != null)
{
if (IsBatchReadonly(row))
{
//Set Cache Allow Update
cache.AllowUpdate = true;
Base.GLTranModuleBatNbr.Cache.AllowUpdate = true;
//First Set ReadOnly false to all fields
PXUIFieldAttribute.SetReadOnly(Base.GLTranModuleBatNbr.Cache, null, false);
//Then Set ReadOnly true to all fields but your custom ones
PXUIFieldAttribute.SetReadOnly<GLTran.accountID>(Base.GLTranModuleBatNbr.Cache, null, true);
PXUIFieldAttribute.SetReadOnly<GLTran.subID>(Base.GLTranModuleBatNbr.Cache, null, true);
.......
}
}
}
//Function used on the GetStateController method
private bool IsBatchReadonly(Batch batch)
{
return (batch.Module != GL.BatchModule.GL && Base.BatchModule.Cache.GetStatus(batch) == PXEntryStatus.Inserted)
|| batch.Voided == true || batch.Released == true;
}
}