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

[FIX] delivery,stock: always hide length UoM

[1] hides the length UoM if the package is related to a specific
carrier (BPost, Fedex, etc). However, there will still be an issue when
the carrier is not defined: if the length UoM of the database is `ft`,
so will the length UoM of the package type. Moreover, the dimensions
fields are integer:
https://github.com/odoo/odoo/blob/b1012175393ca5612899c1a0f1d3803ed8d4fe94/addons/stock/models/stock_package_type.py#L19-L21


As a result, it will be impossible for a user to encode a package type
with a length equal to 10in

[1] 9250accb

OPW-2865471

closes odoo/odoo#119519

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent f33b61a4
Branches
Tags
No related merge requests found
......@@ -17,18 +17,3 @@ class PackageType(models.Model):
self.shipper_package_code = carrier_id._get_default_custom_package_code()
else:
self.shipper_package_code = False
@api.depends('package_carrier_type')
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()
......@@ -35,8 +35,15 @@ class PackageType(models.Model):
]
def _compute_length_uom_name(self):
for package_type in self:
package_type.length_uom_name = self.env['product.template']._get_length_uom_name_from_ir_config_parameter()
# 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`
# This is also confusing when length UoM of the database is `ft`. The dimensions are integers (not floats) and
# the UoM is not small enough (for instance, the user will not be able to define a package with a length
# of 10 in)
self.length_uom_name = ""
def _compute_weight_uom_name(self):
for package_type in self:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment