fix(#10): Corregir problemas de diseño en etiquetas de muestras

- Corregir codificación UTF-8 usando referencias numéricas de caracteres
- Ajustar espaciado entre etiquetas para evitar solapamiento
- Reducir tamaño de código de barras para mejor ajuste
- Agregar contenedores con overflow para controlar el contenido
- Cambiar de web.html_container a web.basic_layout para mejor renderizado PDF
This commit is contained in:
Luis Ernesto Portillo Zaldivar 2025-07-15 22:03:51 -06:00
parent 3e296d3c2c
commit 90ac5b2275
3 changed files with 20 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -28,21 +28,23 @@
<field name="print_report_name">'Etiquetas - ' + object.name</field>
<field name="binding_type">report</field>
<field name="paperformat_id" ref="lims_management.paperformat_sample_label"/>
<field name="attachment_use" eval="False"/>
</record>
<!-- Template del reporte -->
<template id="report_sample_label">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<div class="page" style="page-break-after: always;">
<div style="width: 96mm; height: 46mm; border: 1px solid #ccc; padding: 2mm; font-family: Arial, sans-serif;">
<t t-call="web.basic_layout">
<t t-set="body_classname">o_report_qweb_pdf</t>
<div class="page">
<t t-foreach="docs" t-as="o">
<div style="width: 96mm; height: 46mm; border: 1px solid #ccc; padding: 2mm; margin: 2mm; font-family: 'DejaVu Sans', Arial, sans-serif; display: inline-block; vertical-align: top; page-break-inside: avoid; overflow: hidden;">
<!-- Encabezado -->
<div style="text-align: center; margin-bottom: 2mm;">
<h4 style="margin: 0; font-size: 14px;">LABORATORIO CLÍNICO</h4>
<h4 style="margin: 0; font-size: 14px; font-family: 'DejaVu Sans', Arial, sans-serif;">LABORATORIO CL&#205;NICO</h4>
</div>
<!-- Información del paciente -->
<div style="font-size: 11px; margin-bottom: 2mm;">
<div style="font-size: 11px; margin-bottom: 2mm; font-family: 'DejaVu Sans', Arial, sans-serif;">
<div><strong>Paciente:</strong> <span t-field="o.patient_id.name"/></div>
<div><strong>ID:</strong> <span t-field="o.patient_id.vat" t-if="o.patient_id.vat"/>
<span t-else="">Sin ID</span>
@ -50,35 +52,37 @@
</div>
<!-- Información de la muestra -->
<div style="font-size: 10px; margin-bottom: 3mm;">
<div style="font-size: 10px; margin-bottom: 3mm; font-family: 'DejaVu Sans', Arial, sans-serif;">
<div><strong>Orden:</strong> <span t-field="o.origin"/></div>
<div><strong>Tipo:</strong> <span t-esc="o.get_container_name()"/></div>
<div><strong>Fecha:</strong> <span t-field="o.collection_date" t-options='{"widget": "date"}'/></div>
</div>
<!-- Código de barras -->
<div style="text-align: center; margin-top: 3mm;">
<div style="text-align: center; margin-top: 2mm;">
<t t-set="barcode_value" t-value="o.barcode if o.barcode else o.name"/>
<t t-if="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;"/>
<div style="overflow: hidden; height: 55px;">
<span t-field="o.barcode"
t-options="{'widget': 'barcode', 'type': 'Code128', 'width': 220, 'height': 45, 'humanreadable': 1}"
style="display: block;"/>
</div>
</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;">
<div style="border: 1px solid #ccc; width: 220px; height: 45px; margin: 0 auto; display: flex; align-items: center; justify-content: center;">
<span style="color: #666;">Sin código de barras</span>
</div>
</t>
</div>
<!-- Análisis a realizar (si caben) -->
<div style="font-size: 9px; margin-top: 2mm;" t-if="o.analysis_names">
<div><strong>Análisis:</strong> <span t-field="o.analysis_names"/></div>
<div style="font-size: 9px; margin-top: 1mm; font-family: 'DejaVu Sans', Arial, sans-serif;" t-if="o.analysis_names">
<div><strong>An&#225;lisis:</strong> <span t-field="o.analysis_names"/></div>
</div>
</div>
</div>
</t>
</t>
</div>
</t>
</template>
</data>