JeffreyDRL
JeffreyDRL

Reputation: 75

Customize Add Stock Item in SO and PO

currently I am doing some customization in "add stock item" of Sales Order and Purchase Order in acumatica, in this customization I added "Marked For" column but it is not editable even though its already there, how can I make it editable for the users?

Attached here is the screenshot of customized "add stock item".

Things done:

Upvotes: 0

Views: 264

Answers (2)

Brendan
Brendan

Reputation: 5623

Digging into SOSiteStatusLookup which is inherited from INSiteStatusLookup you will find that 'OnRowSelected' it is disabling all fields except for 'Selected' and 'QtySelected' columns. To override this, try adding the following to a SOOrderEntry graph extension for any field you want to add to this view as editable from your extension...

protected virtual void SOSiteStatusSelected_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
{
    del?.Invoke(sender, e);         

    PXUIFieldAttribute.SetEnabled<MyExtension.MyField>(sender, e.Row, true);
}

Replace 'MyExtension' with your class extension name and 'MyField' with the mark for field name.

Upvotes: 1

Hugues Beaus&#233;jour
Hugues Beaus&#233;jour

Reputation: 8299

Add your field to your SOOrderStatusSelected DAC extension. It has to be an unbound field because the DAC is not bound to a table. You can add further logic in event handlers to persist to database.

public class SOSiteStatusSelectedExt : PXCacheExtension<PX.Objects.SO.SOSiteStatusSelected>
{
    [PXString]
    [PXUIField(DisplayName="Marked For")]
    public virtual string UsrMarkedFor { get; set; }
    public abstract class usrMarkedFor : IBqlField { }
}

Enable the field in SOOrderEntry graph extension in the RowSelected event:

public class SOOrderEntryExtension : PXGraphExtension<SOOrderEntry>
{
     protected virtual void SOSiteStatusSelected_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
     {
          PXUIFieldAttribute.SetEnabled<PX.Objects.SO.SOSiteStatusSelectedExt.usrMarkedFor>(sender, e.Row, true);
     }

Tested in Acumatica v6.10.0010 for SalesOrder screen:

enter image description here

Upvotes: 1

Related Questions