From 61c57bb8412c21435fa709a50fb596133d62b279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Jul 2024 18:32:56 +0200 Subject: [PATCH] Send package weight in kilograms to Sendcloud Since a3e3a447615f, the unit of total weight for a package can be configured. Closes #13391 --- modules/stock_package_shipping_sendcloud/stock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/stock_package_shipping_sendcloud/stock.py b/modules/stock_package_shipping_sendcloud/stock.py index 6fb1f72b4e..3b57951679 100644 --- a/modules/stock_package_shipping_sendcloud/stock.py +++ b/modules/stock_package_shipping_sendcloud/stock.py @@ -145,6 +145,7 @@ class CreateShippingSendcloud(Wizard): ModelData = pool.get('ir.model.data') cm = UoM(ModelData.get_id('product', 'uom_centimeter')) + kg = UoM(ModelData.get_id('product', 'uom_kilogram')) party = shipment.shipping_to address = shipment.shipping_to_address phone = address.contact_mechanism_get( @@ -171,7 +172,8 @@ class CreateShippingSendcloud(Wizard): 'external_reference': '/'.join([shipment.number, package.number]), 'quantity': 1, 'order_number': shipment.number, - 'weight': package.total_weight, + 'weight': UoM.compute_qty( + package.weight_uom, package.total_weight, kg), 'length': UoM.compute_qty(package.length_uom, package.length, cm), 'width': UoM.compute_qty(package.width_uom, package.width, cm), 'height': UoM.compute_qty(package.height_uom, package.height, cm),