AX2012 R3: Add address button on the Returned purchase order line adds up the address to the company instead of vendor

Recently, I have noticed that add address button on the Returned purchase order line adds up the address to the company instead of the vendor. However, we can spot that this logic is not applicable to the Returned purchase order header. You can observe the following:

If you open Returned Purchase order header and click on Add address icon, you may notice that the system is trying to add the address to the Vendor account:

Returned purchase order header

Interestingly, that situation is totally different on the Returned Purchase order line.

Returned purchase order line

If you look at DirPartyPostalAddressFormHandler class, getTransactionEntity method, it might surprise you.

For Purchase order header we have the following conditions:

case tableNum(PurchTable) :

            purchTable = _common;

            if(purchTable.PurchaseType == PurchaseType::ReturnItem)

            {

                return VendTable::find(purchTable.OrderAccount);

            }

            else

            {

                return CompanyInfo::find();

            }

But for Purchase order line we don’t have such conditions:

case tableNum(PurchLine) :

            return CompanyInfo::find();

 

It means that Returned type is not handled for the Purchase order line in a way as it was done for the header.
To be honest, I don’t know why it’s like this, but you could change this by the code below:

case tableNum(PurchLine) :

            purchLine = _common;

            if (purchLine.purchTable().PurchaseType == PurchaseType::ReturnItem)

            {

                return VendTable::find(purchLine.purchTable().OrderAccount);

            }

            else

            {

                return CompanyInfo::find();

            }

 

That’s it!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s