Hi @mgygi76
We can try the below approach as well. When we save the location, get the details from the Default location and assign to the respective fields.
Please review the below sample.
public class KNMCCustomerLocationMaintExtn : PXGraphExtension<CustomerLocationMaint>
{
public static bool IsActive() { return true; }
#region Action
[PXOverride]
public void Persist(Action del)
{
if (Base.LocationCurrent.Cache.GetStatus((object)Base.LocationCurrent.Current) == PXEntryStatus.Inserted)
{
CustomerMaint customerGraph = PXGraph.CreateInstance<CustomerMaint>();
customerGraph.CurrentCustomer.Current = PXSelect<Customer, Where<Customer.bAccountID, Equal<Required<Customer.bAccountID>>>>.Select(Base, Base.LocationCurrent.Current.BAccountID);
if (customerGraph.CurrentCustomer.Current != null)
{
var defLocationExt = customerGraph.GetExtension<DefLocationExt>();
defLocationExt.DefLocation.Current = defLocationExt.DefLocation.Select();
Base.LocationCurrent.Current.CShipTermsID = defLocationExt.DefLocation.Current?.CShipTermsID;
Base.LocationCurrent.Current.CCarrierID = defLocationExt.DefLocation.Current?.CCarrierID;
Base.LocationCurrent.Current.CTaxZoneID = defLocationExt.DefLocation.Current?.CTaxZoneID;
Base.LocationCurrent.Cache.Update(Base.LocationCurrent.Current);
}
}
del.Invoke();
}
}