Skip to content
Snippets Groups Projects
Commit 9250accb authored by Adrien Widart (awt)'s avatar Adrien Widart (awt)
Browse files

[FIX] delivery: hide useless length UoM

The dimensions UoM of the carrier packaging is useless: it is not the
one used in the requests and there is not any conversion

To reproduce the issue
(Need delivery_fedex. Use demo data. Enable debug mode)
1. In Shipping Methods, edit 'Fedex US':
    - Package Weight Unit: KG
    - Debug Requests: True
2. Edit its Fedex Package Type:
    - Height: 1m
    - Width: 1m
    - Length: 1m
    - Package Code: YOUR_PACKAGING
3. Create a SO with a US partner and one product
4. On the SO
    - Add Shipping
    - Select 'Fedex US'
    - Click on 'Get Rate'
5. In Logging, open the request sent

Error: the dimensions of the packaging are expressed with "CM" but they
are not converted:
```xml
<ns0:Dimensions>
	<ns0:Length>1</ns0:Length>
	<ns0:Width>1</ns0:Width>
	<ns0:Height>1</ns0:Height>
	<ns0:Units>CM</ns0:Units>
</ns0:Dimensions>
```

When encoding the packaging in the request, the UoM defined on the
packaging (meter) is ignored. Instead, we define a length UoM depending
on the UoM of the weight and we don't convert any dimension:
https://github.com/odoo/enterprise/blob/e4fd13a0e073b9855864b7fabc26bc05b9a5fd19/delivery_fedex/models/fedex_request.py#L172-L178
There is even a `TODO` about the issue.

It will be the same with the other carriers. For instance, with UPS:
https://github.com/odoo/enterprise/blob/c9899f7860cd19c86f215d6dcea89f73b51433f3/delivery_ups/models/ups_request.py#L98-L102


We use the UoM of `ups_package_dimension_unit` and do not convert the
dimensions.

We can't implement the dimensions conversion on stable versions, since
it will break all existing packagings. So, as temporary solution, we can
simply hide the useless UoM defined on the packagings.

OPW-3053048

closes odoo/odoo#106268

X-original-commit: 35107443
Related: odoo/enterprise#34248
Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
Signed-off-by: default avatarAdrien Widart <awt@odoo.com>
parent e0d1cd33
Branches
Tags
No related merge requests found
......@@ -17,3 +17,17 @@ class PackageType(models.Model):
self.shipper_package_code = carrier_id._get_default_custom_package_code()
else:
self.shipper_package_code = False
def _compute_length_uom_name(self):
package_without_carrier = self.env['stock.package.type']
for package in self:
if package.package_carrier_type and package.package_carrier_type != 'none':
# FIXME This variable does not impact any logic, it is only used for the packaging display on the form view.
# However, it generates some confusion for the users since this UoM will be ignored when sending the requests
# to the carrier server: the dimensions will be expressed with another UoM and there won't be any conversion.
# For instance, with Fedex, the UoM used with the package dimensions will depend on the UoM of
# `fedex_weight_unit`. With UPS, we will use the UoM defined on `ups_package_dimension_unit`
package.length_uom_name = ""
else:
package_without_carrier |= package
super(PackageType, package_without_carrier)._compute_length_uom_name()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment