diff --git a/modules/stock_package_shipping_dpd/stock.py b/modules/stock_package_shipping_dpd/stock.py index 015d18b205..b785632d37 100644 --- a/modules/stock_package_shipping_dpd/stock.py +++ b/modules/stock_package_shipping_dpd/stock.py @@ -4,6 +4,7 @@ import locale from io import BytesIO from itertools import zip_longest +from math import ceil from lxml import etree from zeep.exceptions import Fault @@ -262,12 +263,12 @@ class CreateDPDShipping(Wizard): if (package.length is not None and package.width is not None and package.height is not None): - 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) + length = ceil(UoM.compute_qty( + package.length_uom, package.length, cm, round=False)) + width = ceil(UoM.compute_qty( + package.width_uom, package.width, cm, round=False)) + height = ceil(UoM.compute_qty( + package.height_uom, package.height, cm, round=False)) if length < 1000 and width < 1000 and height < 1000: parcel['volume'] = int( '%03i%03i%03i' % (length, width, height)) diff --git a/modules/stock_package_shipping_ups/stock.py b/modules/stock_package_shipping_ups/stock.py index 98ec214b9d..f9acb5618b 100644 --- a/modules/stock_package_shipping_ups/stock.py +++ b/modules/stock_package_shipping_ups/stock.py @@ -7,6 +7,7 @@ import requests import ssl import urllib.parse from itertools import zip_longest +from math import ceil from trytond.config import config from trytond.i18n import gettext @@ -327,20 +328,28 @@ class CreateShippingUPS(Wizard): 'UnitOfMeasurement': { 'Code': 'CM' if use_metric else 'IN', }, - 'Length': '%i' % round(UoM.compute_qty(package.length_uom, - package.length, cm if use_metric else inch)), - 'Width': '%i' % round(UoM.compute_qty(package.width_uom, - package.width, cm if use_metric else inch)), - 'Height': '%i' % round(UoM.compute_qty(package.height_uom, - package.height, cm if use_metric else inch)), + 'Length': '%i' % ceil( + UoM.compute_qty( + package.length_uom, package.length, + cm if use_metric else inch, round=False)), + 'Width': '%i' % ceil( + UoM.compute_qty( + package.width_uom, package.width, + cm if use_metric else inch, round=False)), + 'Height': '%i' % ceil( + UoM.compute_qty( + package.height_uom, package.height, + cm if use_metric else inch, round=False)), } if package.total_weight is not None: pkg['PackageWeight'] = { 'UnitOfMeasurement': { 'Code': 'KGS' if use_metric else 'LBS', }, - 'Weight': str(UoM.compute_qty(kg, package.total_weight, - kg if use_metric else lb)), + 'Weight': '%i' % ceil( + UoM.compute_qty( + kg, package.total_weight, + kg if use_metric else lb, round=False)), } return pkg