InvenTree: plantilla de ubicación de stock compatible con Brother-QL de 62x27 mm

Ver también la versión grande (140x62 mm) de esta etiqueta

Esta plantilla de etiqueta de ubicación de stock para InvenTree es totalmente compatible con las impresoras de etiquetas Brother QL de 62 mm. Uso BrotherQLLabelPrintService para imprimirlas en Linux.

Ubicación de stock InvenTree 62x27 mm

stock_location_62x27.html
{% extends "label/label_base.html" %}
{% load l10n i18n barcode %}

{% block style %}
{% localize off %}
@page {
    size: {{ width }}mm {{ height }}mm;
    margin: 2mm; /* Margen de seguridad uniforme de 2 mm en todos los lados */
}

body {
    margin: 0;
    padding: 0;
}

/* El diseño con tabla garantiza un posicionamiento exacto y corrige los bugs multipágina de WeasyPrint */
.label-table {
    display: table;
    width: calc({{ width }}mm - 4mm);  /* Ancho total menos 2 mm de margen izquierdo y 2 mm derecho */
    height: calc({{ height }}mm - 4mm); /* Alto total menos 2 mm de margen superior y 2 mm inferior */
    table-layout: fixed;
    page-break-inside: avoid;
    break-inside: avoid;
}

.label-row {
    display: table-row;
}

.qr-cell {
    display: table-cell;
    width: calc({{ height }}mm - 4mm); /* Mantiene la celda QR como un cuadrado perfecto */
    height: calc({{ height }}mm - 4mm);
    vertical-align: middle;            /* Centra verticalmente el código QR */
}

.qr {
    width: calc({{ height }}mm - 4mm);
    height: calc({{ height }}mm - 4mm);
    display: block;
}

.text-cell {
    display: table-cell;
    width: calc({{ width }}mm - {{ height }}mm); /* Rellena dinámicamente el espacio restante */
    height: calc({{ height }}mm - 4mm);
    vertical-align: middle;                      /* CENTRADO VERTICAL PERFECTO */
    padding-left: 3mm;                           /* Espacio nítido entre QR y texto */
    box-sizing: border-box;
    overflow: hidden;
}
{% endlocalize %}

.loc {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    line-height: 1.05;
    margin: 0;
    padding: 0;
    
    /* El procesamiento de layout nativo respeta los guiones suaves UTF-8 */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* PASOS DE AJUSTE AUTOMÁTICO DE FUENTE (reducidos respecto al original de 21 pt) */
.loc.large { font-size: 21pt; }
.loc.medium { font-size: 15pt; }
.loc.small { font-size: 11pt; }
{% endblock style %}

{% block content %}
<div class="label-table">
    <div class="label-row">
        
        <div class="qr-cell">
            <img class='qr' alt="{% trans 'QR code' %}" src='{% qrcode qr_data %}'>
        </div>
        
        <div class="text-cell">
            <div class="loc {% if location.name|length > 20 %}small{% elif location.name|length > 10 %}medium{% else %}large{% endif %}">
                {{ location.name }}
            </div>
        </div>
        
    </div>
</div>
{% endblock content %}

Echa un vistazo a artículos similares por categoría: InvenTree