s_packaging_calculator: improve test util

This way no matter who's changing the behavior of the name getter
we'll get the right name.
This commit is contained in:
Simone Orsi
2021-07-15 16:57:16 +02:00
committed by nguyen hoang hiep
parent 6ce14df9c6
commit 72997319a2

View File

@@ -5,6 +5,7 @@
def make_pkg_values(record, **kw):
"""Helper to generate test values for packaging.
"""
name = record.name
if record._name == "uom.uom":
is_unit = True
barcode = None
@@ -13,9 +14,11 @@ def make_pkg_values(record, **kw):
qty = record.qty
is_unit = False
barcode = record.barcode
if record.product_id:
name = record.product_id._packaging_name_getter(record)
values = {
"id": record.id,
"name": record.name,
"name": name,
"qty": qty,
"barcode": barcode,
"is_unit": is_unit,