When printing Lot/SNs barcodes, it's sometimes desired that we print a GS1 compliant datamatrix with the following info (when applicable): Product barcode, Lot/SN barcode, Best By Date, Expiration Date For flexibility, a setting has been added for when the GS1 datamatrix should print instead of 1D barcode. Note that datamatrix will automatically exclude invalid product barcodes (i.e. non-EAN compliant) and datamatrix size can vary based on amount of data in datamatrix (so size has been set to accomodate expected largest gs1 compliant datamatrix possible). If it appears that datamatrix cannot be created, then default to standard 1D barcode. Note that zpl printer has built in datamatrix creation command, so we can always assume they will print correctly. Part of Task: 2494740 Part-of: odoo/odoo#82389
70 lines
2.8 KiB
XML
70 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<odoo>
|
|
<data>
|
|
<template id="label_product_product_view">
|
|
<t t-foreach="quantity.items()" t-as="barcode_and_qty_by_product">
|
|
<t t-set="product" t-value="barcode_and_qty_by_product[0]"/>
|
|
<t t-foreach="barcode_and_qty_by_product[1]" t-as="barcode_and_qty">
|
|
<t t-set="barcode" t-value="barcode_and_qty[0]"/>
|
|
<t t-foreach="range(barcode_and_qty[1])" t-as="qty">
|
|
<t t-translation="off">
|
|
^XA
|
|
^FT100,80^A0N,40,30^FD<t t-esc="product.display_name"/>^FS
|
|
<t t-if="product.default_code and len(product.default_code) > 15">
|
|
^FT100,115^A0N,30,24^FD<t t-esc="product.default_code[:15]"/>^FS
|
|
^FT100,150^A0N,30,24^FD<t t-esc="product.default_code[15:30]"/>^FS
|
|
</t>
|
|
<t t-else="">
|
|
^FT100,150^A0N,30,24^FD<t t-esc="product.default_code"/>^FS
|
|
</t>
|
|
<t t-if="price_included">
|
|
^FO600,100,1
|
|
^CI28
|
|
<t t-if="product.currency_id.position == 'after'">
|
|
^A0N,66,48^FH^FD<t t-esc="product.list_price" t-options='{"widget": "float", "precision": 2}'/><t t-esc="product.currency_id.symbol"/>^FS
|
|
</t>
|
|
<t t-if="product.currency_id.position == 'before'">
|
|
^A0N,66,48^FH^FD<t t-esc="product.currency_id.symbol"/><t t-esc="product.list_price" t-options='{"widget": "float", "precision": 2}'/>^FS
|
|
</t>
|
|
</t>
|
|
<t t-if="barcode">
|
|
^FO100,160^BY3
|
|
^BCN,100,Y,N,N
|
|
^FD<t t-esc="barcode"/>^FS
|
|
</t>
|
|
^XZ
|
|
</t>
|
|
</t>
|
|
</t>
|
|
</t>
|
|
</template>
|
|
|
|
<template id="label_lot_template_view">
|
|
<t t-foreach="docs" t-as="lot">
|
|
<t t-translation="off">
|
|
^XA
|
|
^FO100,50
|
|
^A0N,44,33^FD<t t-out="lot.product_id.display_name"/>^FS
|
|
^FO100,100
|
|
^A0N,44,33^FDLN/SN: <t t-out="lot.name"/>^FS
|
|
<t t-if="env.user.has_group('stock.group_stock_lot_print_gs1')">
|
|
<t t-if="lot.product_id.valid_ean" t-set="final_barcode" t-value="'01' + '0' * (14 - len(lot.product_id.barcode)) + lot.product_id.barcode"/>
|
|
<!-- TODO: must keep lot/sn as last value in barcode because we cannot pad '0's without changing lot/sn name until we can scan in FNC1. -->
|
|
<t t-if="lot.product_id.tracking == 'lot'" name="datamatrix_lot" t-set="final_barcode" t-value="(final_barcode or '') + '10' + lot.name"/>
|
|
<t t-elif="lot.product_id.tracking == 'serial'" t-set="final_barcode" t-value="(final_barcode or '') + '21' + lot.name"/>
|
|
^FO425,150^BY3
|
|
^BXN,8,200
|
|
^FD<t t-out="final_barcode"/>^FS
|
|
</t>
|
|
<t t-else="" name="code128_barcode">
|
|
^FO100,150^BY3
|
|
^BCN,100,Y,N,N
|
|
^FD<t t-out="lot.name"/>^FS
|
|
</t>
|
|
^XZ
|
|
</t>
|
|
</t>
|
|
</template>
|
|
</data>
|
|
</odoo>
|