Skip to content
Snippets Groups Projects
  • Adrien Widart (awt)'s avatar
    35107443
    [FIX] delivery: hide useless length UoM · 35107443
    Adrien Widart (awt) authored
    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#105308
    
    Related: odoo/enterprise#33754
    Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>
    35107443
    History
    [FIX] delivery: hide useless length UoM
    Adrien Widart (awt) authored
    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#105308
    
    Related: odoo/enterprise#33754
    Signed-off-by: default avatarArnold Moyaux (arm) <arm@odoo.com>