From 139e2ef6dd20e89cb9eee336f78f94654f1dae65 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Tue, 25 Jun 2024 12:31:15 +0200 Subject: [PATCH] [IMP] Geodis : add possibility to add the volume in the EDI file as it may be important for shipments in foreign countries --- roulier/carriers/geodis_fr/edi/api.py | 6 ++++++ roulier/carriers/geodis_fr/edi/encoder.py | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/roulier/carriers/geodis_fr/edi/api.py b/roulier/carriers/geodis_fr/edi/api.py index af2c369..4373092 100644 --- a/roulier/carriers/geodis_fr/edi/api.py +++ b/roulier/carriers/geodis_fr/edi/api.py @@ -70,6 +70,12 @@ def _parcel(self): "required": True, "coerce": "accents", }, + "volume": { + "type": "float", + "required": False, + "empty": True, + "default": 0, + }, } def _to_address(self): diff --git a/roulier/carriers/geodis_fr/edi/encoder.py b/roulier/carriers/geodis_fr/edi/encoder.py index 37d9e92..1eda4fc 100644 --- a/roulier/carriers/geodis_fr/edi/encoder.py +++ b/roulier/carriers/geodis_fr/edi/encoder.py @@ -63,6 +63,10 @@ def encode_shipment(self, shipment, service, idx): lines += [ ["GID", "%s" % j, ["1", "PC", "21", "6"]], ["MEA", "AAE", "AAD", ["KGM", "%s" % pack["weight"]]], + ] + if pack.get("volume"): + lines.append(["MEA", "AAE", "AAW", ["MTQ", "%s" % pack["volume"]]]) + lines += [ ["PCI", "18"], ["GIN", "BN", pack["barcode"]], ]