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 chien
parent 6134dd47fb
commit 35cfc4c6ef
2 changed files with 4 additions and 45 deletions

View File

@@ -1,44 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_packaging_calculator
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: stock_packaging_calculator
#: model:ir.model.fields,field_description:stock_packaging_calculator.field_product_product__display_name
msgid "Display Name"
msgstr ""
#. module: stock_packaging_calculator
#: model:ir.model.fields,field_description:stock_packaging_calculator.field_product_product__id
msgid "ID"
msgstr ""
#. module: stock_packaging_calculator
#: model:ir.model.fields,field_description:stock_packaging_calculator.field_product_product____last_update
msgid "Last Modified on"
msgstr ""
#. module: stock_packaging_calculator
#: model:ir.model.fields,field_description:stock_packaging_calculator.field_product_product__packaging_contained_mapping
msgid "Packaging Contained Mapping"
msgstr ""
#. module: stock_packaging_calculator
#: model:ir.model,name:stock_packaging_calculator.model_product_product
msgid "Product"
msgstr ""
#. module: stock_packaging_calculator
#: model:ir.model.fields,help:stock_packaging_calculator.field_product_product__packaging_contained_mapping
msgid "Technical field to store contained packaging. "
msgstr ""

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,