Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
828 views
in Technique[技术] by (71.8m points)

acumatica - How to enable a custom field on PO301000 when the PO is in Open status?

I have added a customization to the PO Entry screen, PO.30.10.00. The customization adds four date fields, a combobox text field, and a string(10) field.

Right now, the fields are only editable when the PO is on hold. The user wants to be able to edit these fields at any time. They are using these fields to keep track of different POs and will build Generic Inquiries on them so they can communicate the statuses of the POs by maintaining these fields.

The Promise Date is editable when the PO is in Open status. We would like these custom fields to be editable like the Promise Date is.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Purchase Orders screen is heavily driven by Automation Steps. This fact makes changes to automation steps a mandatory step needed to enable a custom field when the PO is in Open status: enter image description here

To enable Custom Text Fields on the Purchase Order Summary area and the Document Details grid, one should modify the NL Open step by adding 2 lines as shown in the screenshot above.

After you added those lines, Custom Text Field becomes editable on the Purchase Order Summary area, however, the Custom Text Field column is still read-only in the Document Details grid because of how POLine_RowSelected handler is implemented in the POOrderEntry BLC:

[Serializable]
public class POOrderEntry : PXGraph<POOrderEntry, POOrder>, PXImportAttribute.IPXPrepareItems
{
    ...
    protected virtual void POLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        POLine row = (POLine)e.Row;
        POOrder doc = this.Document.Current;
        if (row == null) return;

        if (IsExport) return;//for performance 

        bool isLinkedToSO = row.Completed == true && IsLinkedToSO(row);

        if (this.Document.Current.Hold != true || isLinkedToSO)
        {
            PXUIFieldAttribute.SetEnabled(sender, e.Row, false);
            ...
        }
        ...
    }
    ...
}

To enable the Custom Text Field column for editing, you should additionally subscribe to POLine_RowSelected handler within your POOrderEntry BLC extension as shown in the code snippet below:

public class POOrderEntryExt : PXGraphExtension<POOrderEntry>
{
    public void POLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        POLine line = (POLine)e.Row;
        POOrder order = Base.Document.Current;
        if (order == null || line == null || Base.IsExport) return;

        if (order.Status == POOrderStatus.Open)
        {
            PXUIFieldAttribute.SetEnabled<POLineExt.usrCustomTextField>(sender, line, true);
        }
    }
}

Once you made changes in Automation Steps and subscribed to POLine_RowSelected handler within a POOrderEntry BLC extension your custom fields on both the Purchase Order Summary area and the Document Details grid should be open for editing when the PO is in Open status:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...