[IMP] stock: split name in 2 lines on product label

Product's display_name can be too long and might not fit in small
labels. A decision was made to split it into default_code and actual
product name, and display both in separate lines.

Unfortunately, the logic of joining those 2 strings is embedded in the
model, so it had to be duplicated in the label.

Task: 3290154
Part-of: odoo/odoo#122511
This commit is contained in:
Paweł Fertyk
2023-09-28 10:22:02 +00:00
parent 4060f13cb0
commit 020b2ed0d9
+2 -1
View File
@@ -25,7 +25,8 @@
<t name="gs1_datamatrix_lot" t-if="o.product_id.tracking == 'lot'" t-set="final_barcode" t-value="(final_barcode or '') + '10' + o.name"/>
<t t-elif="o.product_id.tracking == 'serial'" t-set="final_barcode" t-value="(final_barcode or '') + '21' + o.name"/>
</t>
<div class="o_label_4x12" t-field="o.product_id.display_name" t-att-style="'width:22mm' if final_barcode else ''"/>
<div class="o_label_4x12" t-if="o.product_id.default_code" t-att-style="'width:22mm' if final_barcode else ''">[<t t-out="o.product_id.default_code"/>]</div>
<div class="o_label_4x12" t-field="o.product_id.name" t-att-style="'width:22mm' if final_barcode else ''"/>
<div class="o_label_4x12" name="lot_name" t-field="o.name" t-att-style="'width:22mm' if final_barcode else ''"/>
<t t-if="env.user.has_group('stock.group_stock_lot_print_gs1')">
<div t-if="final_barcode" t-att-style="'position:absolute; right:.5px; bottom:.5px'" t-out="final_barcode" t-options="{'widget': 'barcode', 'symbology': 'ECC200DataMatrix', 'img_style': 'width:17mm; height:17mm'}"/>