Convert total weight of package into kilogram for DPD shipping

Closes #13876
(grafted from 54c97c86f882dfb10508d8d39512eff3d0bdd9b4)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2025-02-15 22:32:04 +01:00
parent da0773ddbf
commit 2bfcd3f1b1
+4 -1
View File
@@ -246,12 +246,15 @@ class CreateDPDShipping(Wizard):
ModelData = pool.get('ir.model.data')
cm = UoM(ModelData.get_id('product', 'uom_centimeter'))
kg = UoM(ModelData.get_id('product', 'uom_kilogram'))
parcel = {}
if package.total_weight:
# in grams rounded in 10 gram units
weight = int(package.total_weight * 10) * 10
weight = UoM.compute_qty(
package.weight_uom, package.total_weight, kg, round=False)
weight = int(round(weight, 2) * 100)
if weight < 1000000000:
parcel['weight'] = weight