如何在 Acumatica 中启用网格字段 - 调整

How to enable grid field in Acumatica - Adjustments

这是我启用网格和输入数据的代码,但它不起作用。

   protected void ARAdjust_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {

        ARInvoice rInvoice = Base.Document.Current;

        if (rInvoice.DocType == ARDocType.DebitMemo)
        {
            Base.Adjustments_2.AllowInsert = true;

        }
    }

这是尚未启用网格的图像。

在主视图(DAC APInvoice)行选择事件中设置调整视图。我会覆盖此事件并在调用基本方法后添加您的更改。像这个例子:

public class APInvoiceEntryTestExtension : PXGraphExtension<APInvoiceEntry>
{
    public virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
    {
        del?.Invoke(cache, e);
        var row = (APInvoice)e.Row;
        if (row?.DocType != ARDocType.DebitMemo)
        {
            return;
        }

        Base.Adjustments.AllowInsert = true;

        //  FROM BASE CALL:
        //    Adjustments.Cache.AllowInsert = false;
        //    Adjustments.Cache.AllowDelete = false;
        //    Adjustments.Cache.AllowUpdate = !invoiceState.IsRetainageDebAdj &&
        //    invoiceState.IsDocumentRejectedOrPendingApproval || invoiceState.IsDocumentApprovedBalanced
        //        ? !invoiceState.IsDocumentRejected
        //        : Transactions.Cache.AllowUpdate && !invoiceState.IsDocumentPrebookedNotCompleted;
        }
}