s_packaging_calculator: remove unneeded   constant

This commit is contained in:
Florent Xicluna
2023-12-05 11:55:00 +01:00
parent 3c742ee34c
commit bb4fc04cce

View File

@@ -2,7 +2,6 @@
# @author: Simone Orsi <simone.orsi@camptocamp.com> # @author: Simone Orsi <simone.orsi@camptocamp.com>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
import unicodedata
from collections import namedtuple from collections import namedtuple
from odoo import api, models from odoo import api, models
@@ -13,8 +12,6 @@ from odoo.addons.base_sparse_field.models.fields import Serialized
# Unify records as we mix up w/ UoM # Unify records as we mix up w/ UoM
Packaging = namedtuple("Packaging", "id name qty barcode is_unit") Packaging = namedtuple("Packaging", "id name qty barcode is_unit")
NO_BREAK_SPACE_CHAR = unicodedata.lookup("NO-BREAK SPACE")
class Product(models.Model): class Product(models.Model):
_inherit = "product.product" _inherit = "product.product"
@@ -206,7 +203,7 @@ class Product(models.Model):
as_string.append(f"{unit_qty} {self.uom_id.name}") as_string.append(f"{unit_qty} {self.uom_id.name}")
# We want to avoid line break here as this string # We want to avoid line break here as this string
# can be used by reports # can be used by reports
res = f",{NO_BREAK_SPACE_CHAR}".join(as_string) res = ",\N{NO-BREAK SPACE}".join(as_string)
if include_total_units and not has_only_units: if include_total_units and not has_only_units:
res += " " + self._qty_by_packaging_total_units(prod_qty) res += " " + self._qty_by_packaging_total_units(prod_qty)
return res return res