fix(#10): Corregir visualización de código de barras en etiquetas

- Cambiar sintaxis de generación de código de barras a widget de Odoo 18
- Usar t-field con t-options para renderizar correctamente
- El código de barras ahora se muestra correctamente en el PDF
This commit is contained in:
Luis Ernesto Portillo Zaldivar 2025-07-15 21:15:12 -06:00
parent 2ebd8cc50d
commit 3e296d3c2c
2 changed files with 9 additions and 5 deletions

Binary file not shown.

View File

@ -58,12 +58,16 @@
<!-- Código de barras -->
<div style="text-align: center; margin-top: 3mm;">
<t t-set="barcode_value" t-value="o.barcode or o.name"/>
<t t-set="barcode_value" t-value="o.barcode if o.barcode else o.name"/>
<t t-if="barcode_value">
<img t-attf-src="/report/barcode/?barcode_type=Code128&amp;value={{barcode_value}}&amp;width=250&amp;height=60&amp;humanreadable=1"
style="width: 250px; height: 60px;"/>
<div style="text-align: center; font-size: 10px; margin-top: 2px;">
<span t-esc="barcode_value"/>
<!-- Usar sintaxis específica de Odoo para código de barras -->
<span t-field="o.barcode"
t-options="{'widget': 'barcode', 'type': 'Code128', 'width': 250, 'height': 60, 'humanreadable': 1}"
style="display: block;"/>
</t>
<t t-else="">
<div style="border: 1px solid #ccc; width: 250px; height: 60px; margin: 0 auto; display: flex; align-items: center; justify-content: center;">
<span style="color: #666;">Sin código de barras</span>
</div>
</t>
</div>