We are having a requirement to pass other than shipping address to external tax calculation method to compute tax. I am storing the address in a simple custom table and it is selected in the sales order and the same is copied into sales invoice for calculating the Tax.
The GetAddress is overridden to pass the custom address to the Avalar and this was working fine in Acumatica 2018, but the same is not working in Acumatica 2019.
In 2019, I have tried to override GetAddress function on
public class SOOrderEntryExternalTax_Extension : PXGraphExtension<SOOrderEntryExternalTax, SOOrderEntry>
{
#region Event Handlers
[PXOverride]
public IAddressBase GetToAddress(SOOrder order, Func<SOOrder, IAddressBase> methodBase)
{
var shipAddress = methodBase(order);
if (shipAddress != null)
{
CYBProjectDataNameSpace.CYB_PROJECTS CYBProject = PXSelectorAttribute.Select<SOOrderExt.usrProjectId>(Base.Document.Cache, order) as CYBProjectDataNameSpace.CYB_PROJECTS;
//shipAddress.AddressLine1 = CYBProject.Cyb_address;
shipAddress.AddressLine2 = "";
shipAddress.AddressLine3 = "";
shipAddress.City = CYBProject.Cyb_pcity;
shipAddress.State = CYBProject.Cyb_pstate;
shipAddress.PostalCode = CYBProject.Cyb_pzcode;
shipAddress.CountryID = CYBProject.Cyb_pcountry;
}
return shipAddress;
}
#endregion
}
In ARInvoice
[PXOverride]
public IAddressBase GetToAddress(ARInvoice invoice, Func<ARInvoice, IAddressBase> methodBase)
{
var shipAddress = methodBase(invoice);
if (shipAddress != null)
{
CYBProjectDataNameSpace.CYB_PROJECTS CYBProject = PXSelectorAttribute.Select<ARRegisterExt.usrProjectId>(Base.Document.Cache, invoice) as CYBProjectDataNameSpace.CYB_PROJECTS;
if (CYBProject != null)
{
//shipAddress.AddressLine1 = CYBProject.Cyb_address;
shipAddress.AddressLine2 = "";
shipAddress.AddressLine3 = "";
shipAddress.City = CYBProject.Cyb_pcity;
shipAddress.State = CYBProject.Cyb_pstate;
shipAddress.PostalCode = CYBProject.Cyb_pzcode;
shipAddress.CountryID = CYBProject.Cyb_pcountry;
}
}
return shipAddress;
}
#endregion
}
The customization code is not working.
How to fix the issue?