diff --git a/addons/delivery/models/product_packaging.py b/addons/delivery/models/product_packaging.py index 939a6dd0bdfb0580a2c432f63a15cb57733c6e88..c5dffafaa6a4752bd79396e45168c5f8a635fb31 100644 --- a/addons/delivery/models/product_packaging.py +++ b/addons/delivery/models/product_packaging.py @@ -9,6 +9,7 @@ class ProductPackaging(models.Model): def _get_default_length_uom(self): + # TODO master delete return self.env['product.template']._get_length_uom_name_from_ir_config_parameter() def _get_default_weight_uom(self): @@ -21,7 +22,7 @@ class ProductPackaging(models.Model): shipper_package_code = fields.Char('Package Code') package_carrier_type = fields.Selection([('none', 'No carrier integration')], string='Carrier', default='none') weight_uom_name = fields.Char(string='Weight unit of measure label', compute='_compute_weight_uom_name', default=_get_default_weight_uom) - length_uom_name = fields.Char(string='Length unit of measure label', compute='_compute_length_uom_name', default=_get_default_length_uom) + length_uom_name = fields.Char(string='Length unit of measure label', compute='_compute_length_uom_name') _sql_constraints = [ ('positive_height', 'CHECK(height>=0)', 'Height must be positive'), @@ -40,8 +41,12 @@ class ProductPackaging(models.Model): def _compute_length_uom_name(self): - for packaging in self: - packaging.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` + self.length_uom_name = "" def _compute_weight_uom_name(self): for packaging in self: