-->

How to enable CustomerOrderNbr field in Sales Orde

2019-06-08 09:42发布

问题:

In Sales Order screen, I'm trying to enable the CustomerOrderNbr field if the status is completed

protected void SOOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{

  SOOrder doc = e.Row as SOOrder;
  if (doc == null)
  {
    return;
  }

  if (doc.Completed == true )
    {
      PXUIFieldAttribute.SetEnabled(cache, doc , true);
      PXUIFieldAttribute.SetEnabled<SOOrder.customerOrderNbr>(cache, doc, true);
    }


}

however, it remains disabled and not doing what it's supposed to do. So what am I doing wrong ? Am I on the right event to override at all ?

Or is the screen really locked in once the Sales Order is Completed ?

Thanks for any answers.

回答1:

Since Sales Orders screen is heavily driven by Automation Steps, in addition to extended RowSelected handler for the SOOrder DAC, it's an absolute must to modify automation steps for Completed orders that disable entire SOOrder :

In addition to the automation step change shown above, you should keep SOOrder_RowSelected handler:

public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
    public void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        SOOrder order = e.Row as SOOrder;
        if (order == null) return;

        if (order.Completed == true)
        {
            PXUIFieldAttribute.SetEnabled<SOOrder.customerOrderNbr>(sender, order, true);
        }
    }
}

With those 2 changes in place, Customer Order will stay enabled for SO Orders with Completed status:



标签: acumatica