|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<odoo> |
| 3 | + <data noupdate="0"> |
| 4 | + <!-- Staging Location Barcode Report Action --> |
| 5 | + <record id="action_report_staging_location_barcode" model="ir.actions.report"> |
| 6 | + <field name="name">Staging Location Barcode Labels</field> |
| 7 | + <field name="model">customer.staging.location</field> |
| 8 | + <field name="report_type">qweb-pdf</field> |
| 9 | + <field name="report_name">records_management.report_staging_location_barcode</field> |
| 10 | + <field name="report_file">records_management.report_staging_location_barcode</field> |
| 11 | + <field name="print_report_name">'Location_Barcode_%s' % (object.barcode or object.id)</field> |
| 12 | + <field name="binding_model_id" ref="records_management.model_customer_staging_location"/> |
| 13 | + <field name="binding_type">report</field> |
| 14 | + <field name="paperformat_id" ref="container_barcode_reports.paperformat_label_sheet"/> |
| 15 | + <field name="attachment_use" eval="False"/> |
| 16 | + <field name="attachment" eval="False"/> |
| 17 | + </record> |
| 18 | + </data> |
| 19 | + |
| 20 | + <data> |
| 21 | + <!-- Staging Location Barcode Labels Template --> |
| 22 | + <template id="report_staging_location_barcode"> |
| 23 | + <t t-call="web.basic_layout"> |
| 24 | + <t t-call="web.html_container"> |
| 25 | + <!-- 2 columns x 5 rows = 10 labels per page (4" x 2" each for larger location labels) --> |
| 26 | + <t t-set="nRows" t-value="5"/> |
| 27 | + <t t-set="nCols" t-value="2"/> |
| 28 | + <t t-set="labelsPerPage" t-value="nRows * nCols"/> |
| 29 | + |
| 30 | + <!-- Loop through pages --> |
| 31 | + <t t-foreach="[docs[x:x + labelsPerPage] for x in range(0, len(docs), labelsPerPage)]" t-as="page_docs"> |
| 32 | + <div class="page" style="padding: 5mm; font-family: Arial, sans-serif;"> |
| 33 | + <table class="table table-borderless" style="width:100%; table-layout:fixed;"> |
| 34 | + <t t-foreach="range(nRows)" t-as="row"> |
| 35 | + <tr> |
| 36 | + <t t-foreach="range(nCols)" t-as="col"> |
| 37 | + <t t-set="idx" t-value="row * nCols + col"/> |
| 38 | + <td style="width:50%; height:50mm; vertical-align:middle; padding:2mm;"> |
| 39 | + <t t-if="idx < len(page_docs)"> |
| 40 | + <t t-set="loc" t-value="page_docs[idx]"/> |
| 41 | + <div style="border:2px solid #333; padding:3mm; height:46mm; text-align:center; border-radius:3mm;"> |
| 42 | + <!-- Location Type Badge --> |
| 43 | + <div style="margin-bottom:1mm;"> |
| 44 | + <span style="background:#0066cc; color:white; padding:1mm 3mm; border-radius:2mm; font-size:8pt; text-transform:uppercase;"> |
| 45 | + <t t-esc="dict(loc._fields['location_type'].selection).get(loc.location_type, 'LOCATION')"/> |
| 46 | + </span> |
| 47 | + </div> |
| 48 | + |
| 49 | + <!-- Location Name - LARGE --> |
| 50 | + <div style="font-weight:bold; font-size:14pt; margin-bottom:2mm; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;"> |
| 51 | + <t t-esc="loc.name"/> |
| 52 | + </div> |
| 53 | + |
| 54 | + <!-- Full Path - Smaller --> |
| 55 | + <div style="font-size:8pt; color:#555; margin-bottom:2mm; max-height:8mm; overflow:hidden;"> |
| 56 | + <t t-esc="loc.complete_name"/> |
| 57 | + </div> |
| 58 | + |
| 59 | + <!-- Barcode --> |
| 60 | + <t t-if="loc.barcode"> |
| 61 | + <img t-att-src="'/report/barcode/Code128/%s?width=350&height=50' % loc.barcode" |
| 62 | + style="width:95%; height:14mm;"/> |
| 63 | + <div style="font-size:12pt; font-weight:bold; margin-top:1mm; letter-spacing:1px;"> |
| 64 | + <t t-esc="loc.barcode"/> |
| 65 | + </div> |
| 66 | + </t> |
| 67 | + <t t-else=""> |
| 68 | + <div style="font-size:10pt; color:#999; margin-top:5mm;"> |
| 69 | + <em>No barcode assigned</em> |
| 70 | + </div> |
| 71 | + </t> |
| 72 | + |
| 73 | + <!-- Customer Name - Small Footer --> |
| 74 | + <t t-if="loc.partner_id"> |
| 75 | + <div style="font-size:7pt; color:#666; margin-top:1mm; border-top:1px dotted #ccc; padding-top:1mm;"> |
| 76 | + <t t-esc="loc.partner_id.name"/> |
| 77 | + </div> |
| 78 | + </t> |
| 79 | + </div> |
| 80 | + </t> |
| 81 | + </td> |
| 82 | + </t> |
| 83 | + </tr> |
| 84 | + </t> |
| 85 | + </table> |
| 86 | + </div> |
| 87 | + </t> |
| 88 | + </t> |
| 89 | + </t> |
| 90 | + </template> |
| 91 | + |
| 92 | + <!-- Fallback HTML Template for Portal (when report not available) --> |
| 93 | + <template id="portal_staging_location_barcode" name="Staging Location Barcode Print Page"> |
| 94 | + <t t-call="portal.portal_layout"> |
| 95 | + <div class="container mt-4"> |
| 96 | + <div class="row justify-content-center"> |
| 97 | + <div class="col-md-8"> |
| 98 | + <div class="card"> |
| 99 | + <div class="card-header bg-primary text-white d-flex justify-content-between align-items-center"> |
| 100 | + <h4 class="mb-0"><i class="fa fa-barcode"></i> Location Barcode Label</h4> |
| 101 | + <button class="btn btn-light btn-sm" onclick="window.print();"> |
| 102 | + <i class="fa fa-print"></i> Print |
| 103 | + </button> |
| 104 | + </div> |
| 105 | + <div class="card-body text-center" style="padding: 30px;"> |
| 106 | + <!-- Printable Label Area --> |
| 107 | + <div class="barcode-label" style="border: 2px solid #333; padding: 20px; display: inline-block; min-width: 300px; border-radius: 8px;"> |
| 108 | + <!-- Location Type --> |
| 109 | + <div style="margin-bottom: 10px;"> |
| 110 | + <span class="badge badge-primary" style="font-size: 10pt;"> |
| 111 | + <t t-esc="dict(location._fields['location_type'].selection).get(location.location_type, 'LOCATION')"/> |
| 112 | + </span> |
| 113 | + </div> |
| 114 | + |
| 115 | + <!-- Location Name --> |
| 116 | + <h3 style="font-weight: bold; margin-bottom: 5px;"> |
| 117 | + <t t-esc="location.name"/> |
| 118 | + </h3> |
| 119 | + |
| 120 | + <!-- Full Path --> |
| 121 | + <p class="text-muted" style="font-size: 10pt; margin-bottom: 15px;"> |
| 122 | + <t t-esc="location.complete_name"/> |
| 123 | + </p> |
| 124 | + |
| 125 | + <!-- Barcode Image --> |
| 126 | + <t t-if="location.barcode"> |
| 127 | + <div style="margin: 15px 0;"> |
| 128 | + <img t-att-src="'/report/barcode/Code128/%s?width=400&height=60' % location.barcode" |
| 129 | + style="max-width: 100%;"/> |
| 130 | + </div> |
| 131 | + <div style="font-size: 14pt; font-weight: bold; letter-spacing: 2px;"> |
| 132 | + <t t-esc="location.barcode"/> |
| 133 | + </div> |
| 134 | + </t> |
| 135 | + <t t-else=""> |
| 136 | + <div class="alert alert-warning"> |
| 137 | + <i class="fa fa-exclamation-triangle"></i> |
| 138 | + No barcode assigned to this location. |
| 139 | + <a t-attf-href="/my/inventory/location/#{location.id}/generate-barcode" |
| 140 | + class="btn btn-sm btn-primary ml-2">Generate Barcode</a> |
| 141 | + </div> |
| 142 | + </t> |
| 143 | + |
| 144 | + <!-- Customer Name --> |
| 145 | + <t t-if="location.partner_id"> |
| 146 | + <div style="margin-top: 15px; padding-top: 10px; border-top: 1px dotted #ccc; font-size: 9pt; color: #666;"> |
| 147 | + <t t-esc="location.partner_id.name"/> |
| 148 | + </div> |
| 149 | + </t> |
| 150 | + </div> |
| 151 | + </div> |
| 152 | + <div class="card-footer text-center"> |
| 153 | + <a href="/my/inventory/locations" class="btn btn-secondary"> |
| 154 | + <i class="fa fa-arrow-left"></i> Back to Locations |
| 155 | + </a> |
| 156 | + </div> |
| 157 | + </div> |
| 158 | + </div> |
| 159 | + </div> |
| 160 | + </div> |
| 161 | + |
| 162 | + <!-- Print Styles --> |
| 163 | + <style type="text/css" media="print"> |
| 164 | + @page { margin: 0; } |
| 165 | + body { margin: 0; } |
| 166 | + .container, .card, .card-body { |
| 167 | + margin: 0 !important; |
| 168 | + padding: 0 !important; |
| 169 | + border: none !important; |
| 170 | + box-shadow: none !important; |
| 171 | + } |
| 172 | + .card-header, .card-footer, .btn, nav, header, footer { |
| 173 | + display: none !important; |
| 174 | + } |
| 175 | + .barcode-label { |
| 176 | + margin: 20mm auto !important; |
| 177 | + page-break-inside: avoid; |
| 178 | + } |
| 179 | + </style> |
| 180 | + </t> |
| 181 | + </template> |
| 182 | + </data> |
| 183 | +</odoo> |
0 commit comments