fix(fusion_shipping): UPS REST ship request sends malformed ReferenceNumber
The UPS REST ship request wrapped the reference as
{'Value': [{'Code':'BM','Value': picking.name}]}, but _ups_rest_prepare_shipping_data
already builds reference_number as a list of {Code, Value} dicts. UPS expects
ReferenceNumber to be such an object (or array) with a STRING Value and rejects
the double-wrapped form on the ship call. This branch fires for every non-US/US
(e.g. CA->CA, CA->US) shipment, so rating worked but label creation failed.
Pass the list directly. Validated end-to-end against UPS production from a
Canadian origin: rate + real label (tracking 1Z6W...6355, then voided).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -431,9 +431,11 @@ class UPSRequest:
|
||||
(ship_from.country_id.code == 'US' and ship_to.country_id.code == 'US') or
|
||||
(ship_from.country_id.code == 'PR' and ship_to.country_id.code == 'PR')
|
||||
):
|
||||
request['ShipmentRequest']['Shipment']['ReferenceNumber'] = {
|
||||
'Value': shipment_info.get('reference_number')
|
||||
}
|
||||
# reference_number is already a list of {'Code', 'Value'} dicts
|
||||
# (see _ups_rest_prepare_shipping_data). UPS expects ReferenceNumber
|
||||
# to be such an object (or an array of them) with a string Value --
|
||||
# NOT {'Value': [<dict>, ...]}, which UPS rejects on the ship call.
|
||||
request['ShipmentRequest']['Shipment']['ReferenceNumber'] = shipment_info.get('reference_number')
|
||||
|
||||
# Shipments from US to CA or PR require extra info
|
||||
if ship_from.country_id.code == 'US' and ship_to.country_id.code in ['CA', 'PR']:
|
||||
|
||||
Reference in New Issue
Block a user