diff --git a/modules/stock_package_shipping_ups/stock.py b/modules/stock_package_shipping_ups/stock.py index 66bcdaf4ed..c10f9595f2 100644 --- a/modules/stock_package_shipping_ups/stock.py +++ b/modules/stock_package_shipping_ups/stock.py @@ -421,17 +421,29 @@ class CreateShippingUPS_Customs_Incoterm(metaclass=PoolMeta): if (shipment.customs_international and shipment.incoterm and shipment.incoterm.import_duties == 'seller'): - if customs_agent := shipment.customs_agent: - account_number = customs_agent.ups_account_number - else: - account_number = credential.account_number - payment_information['ShipmentCharge'].append({ - # Type 02 is for Duties and Taxes - 'Type': '02', - 'BillShipper': { - 'AccountNumber': account_number, + charge = { + # Type 02 is for Duties and Taxes + 'Type': '02', + } + if ((customs_agent := shipment.customs_agent) + and (customs_agent.ups_account_number + != credential.account_number)): + address = customs_agent.address + charge['BillThirdParty'] = { + 'AccountNumber': customs_agent.ups_account_number, + 'Address': { + 'CountryCode': ( + address.country.code if address.country else ''), }, - }) + } + if address.postal_code: + charge['BillThirdParty']['Address']['PostalCode'] = ( + (address.postal_code or '').replace(' ', '')[:9]) + else: + charge['BillShipper'] = { + 'AccountNumber': credential.account_number, + } + payment_information['ShipmentCharge'].append(charge) return payment_information def get_international_form(self, shipment, credential):