From e041ef5209c5f4da599235794547d7014da9dd4d Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Mon, 18 Mar 2024 16:30:40 +0100 Subject: [PATCH] [IMP] Activate reference 2 display on dpd label and set parel ref is ref2 is not set --- roulier/carriers/dpd_fr_soap/encoder.py | 7 +++++++ .../dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/roulier/carriers/dpd_fr_soap/encoder.py b/roulier/carriers/dpd_fr_soap/encoder.py index a605036..54695bf 100755 --- a/roulier/carriers/dpd_fr_soap/encoder.py +++ b/roulier/carriers/dpd_fr_soap/encoder.py @@ -23,6 +23,13 @@ def transform_input_to_carrier_webservice(self, data): data["service"]["shippingDate"] = data["service"]["shippingDate"].strftime( "%d/%m/%Y" ) + # dpd is configure with manage_multi_label = False, so always only 1 pack + if ( + data["parcels"] + and data["parcels"][0]["reference"] + and not data["service"]["reference2"] + ): + data["service"]["reference2"] = data["parcels"][0]["reference"] def reduce_address(address): """Concat some fields. diff --git a/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml b/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml index 6ad3b1b..5bdc579 100644 --- a/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml +++ b/roulier/carriers/dpd_fr_soap/templates/dpd_createShipmentWithLabels.xml @@ -46,5 +46,9 @@ {{ service.reference1 }} {{ service.reference2 }} {{ service.reference3 }} + {{ 'true' if service.reference2 else 'false'}} + + Reference2 +