When the Business account is selected on the opportunity screen, the 'SHIP-TO Address' panel address fields on the shipping tab will be updated with business account address.
We will, however, create an Opportunity without a business account and add the address by clicking the override address checkbox. The business account will then be assigned to the opportunity later.
Even if the override address checkbox is ticked, Acumatica will override the currently available address with the selected business account address.
We wanted to restrict this functionality such that the address from the business account is not updated if the override address checkbox is ticked.
The "OpportunityAddressID" field of the CROpportunity DAC handles this logic with the "CROpportunityAddressAttribute" class, which is inherited from the "CRAddressAttribute" and "AddressAttribute" classes.
We tried to change/override the methods in these classes, however we were unable to access already entered data of the address fields in these classes. If the override address checkbox was checked, we wanted to skip the address of a business account.
public class OpportunityMaint_Extension : PXGraphExtension<PX.Objects.CR.OpportunityMaint>
#region Event Handlers
[PXMergeAttributes(Method = MergeMethod.Append)]
[TestCROpportunityAddressAttribute(typeof(Select<Address, Where<True, Equal<False>>>))]
protected virtual void CROpportunity_OpportunityAddressID_CacheAttached(PXCache sender)
I tried to access current data on DefaultRecord method but the object (targetAddress from below screenshot) is returning null always.
Anyone have a suggestion/idea for implementing this?
Thanks in advance.