From f85e288cf84c48d73fb96edb632151ec99584d01 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 Apr 2021 10:46:26 +0200 Subject: [PATCH] strip internal spaces in HTS number The WPINT API requires a 10-digit HTS number without any spaces, while the source number may contain spaces. Our use of 'strip()' is insufficient as it only removes leading and trailing spaces, but not spaces inside the number. We need to do replace(' ', '') instead. Related: SYS#5415 --- models/dp_delivery_carrier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/dp_delivery_carrier.py b/models/dp_delivery_carrier.py index c9274a6..ebaee6a 100644 --- a/models/dp_delivery_carrier.py +++ b/models/dp_delivery_carrier.py @@ -152,7 +152,7 @@ class DPDeliveryCarrier(models.Model): else: raise Warning('Product %s has no Country of Origin defined' % (ptempl.name)) weight = ptempl.weight - hts = ptmpl.customs_code.strip() + hts = ptmpl.customs_code.replace(' ', '') desc = ptmpl.customs_description_en if line.procurement_id and line.procurement_id.sale_line_id: price_unit = line.procurement_id.sale_line_id.price_unit