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

。_饼干妹妹 提交于 2019-11-29 12:35:14

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:

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:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!