The way I’d do it is to create a DAC extension for SOShipment with an unbound field for Requires Invoices, then populate that field in a SOInvoiceShipment graph extension when the records are fetched.
Here is the code for the DAC
using PX.Data;
using PX.Objects.SO;
using PX.Data.BQL;
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class SOShipmentExt : PXCacheExtension<SOShipment>
{
[PXBool]
[PXUIField(DisplayName = "Requires Invoices")]
public bool? UsrRequiresInvoices { get; set; }
public abstract class usrRequiresInvoices : BqlBool.Field<usrRequiresInvoices> { }
}
Here is the code for the Graph
using PX.Data;
using PX.Objects.SO;
using PX.Objects.CR;
using Mapadoc;
using System.Collections;
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class SOInvoiceShipment_Extension : PXGraphExtension<SOInvoiceShipment>
{
public static bool IsActive() => true;
public IEnumerable orders()
{
foreach (var record
in Base.orders())
{
SOShipment shipment = PXResult.Unwrap<SOShipment>(record);
BAccount bAccount = BAccount.PK.Find(Base, shipment.CustomerID);
SOShipmentExt shipmentExt = Base.Caches[typeof(SOShipment)].GetExtension<SOShipmentExt>(shipment);
BAccountExt bAccountExt = bAccount.GetExtension<BAccountExt>();
shipmentExt.UsrRequiresInvoices = bAccountExt.UsrRequiresInvoices;
yield return shipment;
}
}
}
Since the field is apart of a DAC extension for SOShipment you should be able to add it to the Process Shipment screen via the customization editor in the same way you can add normal fields.
And here is a link to a previous question which I based my answer off of
If you run into any issues or have any questions let me know!
Philip Engesser