details: https://code.tryton.org/tryton/commit/693c3aa598a4
branch: default
user: Cédric Krier <[email protected]>
date: Thu Sep 17 17:02:06 2026 +0200
description:
Use BillThirdParty tag when requesting UPS to bill charge to customs
agent
It is not allowed to use BillShipper or BillReceiver with different
accounts
for different charges.
Closes #15105
diffstat:
modules/stock_package_shipping_ups/stock.py | 32 +++++++++++++++++++---------
1 files changed, 22 insertions(+), 10 deletions(-)
diffs (43 lines):
diff -r 278d3ae130c3 -r 693c3aa598a4 modules/stock_package_shipping_ups/stock.py
--- a/modules/stock_package_shipping_ups/stock.py Thu Sep 10 10:02:49
2026 +0200
+++ b/modules/stock_package_shipping_ups/stock.py Thu Sep 17 17:02:06
2026 +0200
@@ -421,17 +421,29 @@
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
+ 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:
- account_number = credential.account_number
- payment_information['ShipmentCharge'].append({
- # Type 02 is for Duties and Taxes
- 'Type': '02',
- 'BillShipper': {
- 'AccountNumber': account_number,
- },
- })
+ charge['BillShipper'] = {
+ 'AccountNumber': credential.account_number,
+ }
+ payment_information['ShipmentCharge'].append(charge)
return payment_information
def get_international_form(self, shipment, credential):