details:   https://code.tryton.org/tryton/commit/ed5fc0ff2cf3
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Oct 01 15:30:57 2026 +0200
description:
        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
diffstat:

 modules/stock_package_shipping_dpd/stock.py                        |  12 
++++++++-
 modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst |   4 ++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 0ace319afd0f -r ed5fc0ff2cf3 modules/stock_package_shipping_dpd/stock.py
--- a/modules/stock_package_shipping_dpd/stock.py       Mon Sep 28 11:26:56 
2026 +0200
+++ b/modules/stock_package_shipping_dpd/stock.py       Thu Oct 01 15:30:57 
2026 +0200
@@ -284,10 +284,18 @@
         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 -r 0ace319afd0f -r ed5fc0ff2cf3 
modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst
--- a/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst        
Mon Sep 28 11:26:56 2026 +0200
+++ b/modules/stock_package_shipping_dpd/tests/scenario_shipping_dpd.rst        
Thu Oct 01 15:30:57 2026 +0200
@@ -136,7 +136,9 @@
     ...     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::

Reply via email to