0
votes

I was asked to make what I thought would be a very simple customization, hide the Promised On field on the PO Order Entry page. I opened the PO301000 screen in the customization editor, highlighted Promised On, clicked Attributes and clicked Override on Screen Level. I changed the resulting code on POOrderEntry to:

namespace PX.Objects.PO
{
  public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
 {
    #region Event Handlers


   [PXDBDate()]
   [PXDefault(typeof(POOrder.orderDate), PersistingCheck =         PXPersistingCheck.Nothing)]
   [PXUIField(DisplayName = "Promised On", Visibility = PXUIVisibility.Visible, Visible = false)]
    protected virtual void POOrder_ExpectedDate_CacheAttached(PXCache cache)
    {

    }




    #endregion
  }
 }   

To my surprise, it did not work, the Promised On field is still visible and I do not know why. The version is 18.100.0062.

2

2 Answers

0
votes

It looks like there is a RowSelected event in POOrderEntry that sets the visibility based on if it is a blanket PO. Since this is later in the chain of events it overrides the CacheAttached event.

You can get what you want by adding your own RowSelected event. Here's an example.

    protected void POOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e) 
    {
        PXUIFieldAttribute.SetVisible<POOrder.expectedDate>(cache, null, false);
    }
0
votes

GeorgeM use the code below. The trick is to call baseMethod before making changes to the visible state of the field.

namespace PX.Objects.PO
{
    public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
    {
        [PXOverride]
        protected virtual void POOrder_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected baseMethod)
        {
            baseMethod(cache, e);
            PXUIFieldAttribute.SetVisible<POOrder.expectedDate>(cache, null, false);
        }
    }
}