Use duck typing to convert single UPS package into a list

It seems that UPS has fixed its API such that it always returns a list for
PackageResults but it is still better to test the actual result.

Closes #13116
This commit is contained in:
Cédric Krier committed 2024-03-21 16:55:01 +01:00
1 parent 67e1423194
commit 4f7acf0bbf
1 file changed
+2 -2
+2 -2
View File
@@ -213,8 +213,8 @@ class CreateShippingUPS(Wizard):
shipment.shipping_reference = (
shipment_results['ShipmentIdentificationNumber'])
ups_packages = shipment_results['PackageResults']
if len(packages) == 1:
# In case only one package is requested UPS returns a dictionnary
if not isinstance(ups_packages, list):
# In case only one package is requested UPS may return a dictionary
# instead of a list of one package
ups_packages = [ups_packages]