From 10c4a8d62d20bcdf776598bdec9f5c9e148ee3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Oct 2026 15:30:57 +0200 Subject: [PATCH] Use total package weight and volume as shipment weight for PDP The shipment weight must not be less than the sum of parcel weights. Closes #15121 --- modules/stock_package_shipping_dpd/stock.py | 12 ++++++++++-- .../tests/scenario_shipping_dpd.rst | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/stock_package_shipping_dpd/stock.py b/modules/stock_package_shipping_dpd/stock.py index 2678662ed6..c2d84a8671 100644 --- a/modules/stock_package_shipping_dpd/stock.py +++ b/modules/stock_package_shipping_dpd/stock.py @@ -284,10 +284,18 @@ class CreateDPDShipping(Wizard): cm3 = UoM(ModelData.get_id('product', 'uom_cubic_centimeter')) kg = UoM(ModelData.get_id('product', 'uom_kilogram')) + volume = sum( + UoM.compute_qty( + p.volume_uom, p.total_volume, shipment.volume_uom, round=False) + for p in shipment.root_packages) volume = round(UoM.compute_qty( - shipment.volume_uom, shipment.volume, cm3, round=False)) + shipment.volume_uom, volume, cm3, round=False)) + weight = sum( + UoM.compute_qty( + p.weight_uom, p.total_weight, shipment.weight_uom, round=False) + for p in shipment.root_packages) weight = round(UoM.compute_qty( - shipment.weight_uom, shipment.weight, kg, round=False), 2) + shipment.weight_uom, weight, kg, round=False), 2) return { 'generalShipmentData': { 'identificationNumber': shipment.number, diff --git a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst index e008fb2483..3f812b792d 100644 --- a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst +++ b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst @@ -136,7 +136,9 @@ Create Package Type:: ... name='Box', ... length=10, length_uom=cm, ... height=8, height_uom=cm, - ... width=5, width_uom=cm) + ... width=5, width_uom=cm, + ... packaging_weight=50, + ... packaging_weight_uom=g) >>> box.save() Create a DPD Carrier and the related credential::