Browse Source

wpint: Raise exception if creating shipping label fails for some reason

master
Harald Welte 8 months ago
parent
commit
3ebb9425d0
  1. 3
      models/dp_delivery_carrier.py

3
models/dp_delivery_carrier.py

@ -195,6 +195,9 @@ class DPDeliveryCarrier(models.Model):
'EUR', customer_reference=pickings.name, contents=wpi_content)
# actually create the order + download the label
wpi_res = wpi.api_create_order([wpi_item], 'Max Mustermann')
if not 'shipments' in wpi_res:
_logger.error("Warenpost International failed to create shipment: %s", wpi_res)
raise Warning("Warenpost International failed to create shipment: %s", wpi_res)
wpi_res_item = wpi_res['shipments'][0]['items'][0]
png = wpi.api_get_item_label(wpi_res_item['id'], 'image/png')
# build result dict

Loading…
Cancel
Save