feat(sticker): 3-cell header + right-side Notes column + new field list
Restores the original ENTECH sticker layout from the operator's screenshot reference: Header (3 horizontal cells, divided by vertical rules): [Logo] | WO #WO-30019 | [QR] Body (left side = field table, right side = Notes column): PO #: 587854 | Notes: SN #: - | <customer-facing description> Customer: ABC Manufact. | Part #: 9876... Rev A | Due Date: May 17, 2026 | Thickness: - | Qty: 1 | Changes from previous (stacked-left) layout: - Header: 1-row 3-cell (Logo 28% | WO# 44% | QR 28%) replaces the 2-cell w/ logo+WO# stacked on left. - Body: 2-region (66% / 34%) replaces single 7-row table. Notes column now spans full body height on the right. - Fields: SN # and Thickness added; Process row removed. - Labels: "PO (RO)" -> "PO #", "Part Number" -> "Part #". - Notes content: switched from SO.x_fc_internal_note to the SO line's `name` (= customer-facing description per Sub 2 Q6). - SN # reads _line.x_fc_serial_number (Sub 5 field). - Thickness reads _line.x_fc_thickness with coating.thickness fallback (Sub 5 field, defensive 'in _fields' check). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
{
|
||||
'name': 'Fusion Plating — Reports',
|
||||
'version': '19.0.10.4.0',
|
||||
'version': '19.0.10.5.0',
|
||||
'category': 'Manufacturing/Plating',
|
||||
'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.',
|
||||
'depends': [
|
||||
|
||||
@@ -69,6 +69,19 @@
|
||||
or (_so and _so.x_fc_internal_note
|
||||
and _so.x_fc_internal_note.striptags()[:100])
|
||||
or '-'"/>
|
||||
<!-- Serial number — Sub 5 added x_fc_serial_number on the SO line. -->
|
||||
<t t-set="_serial_number" t-value="(_line and 'x_fc_serial_number' in _line._fields and _line.x_fc_serial_number) or '-'"/>
|
||||
<!-- Thickness — Sub 5 added x_fc_thickness on the SO line; fall back
|
||||
to the coating config's thickness spec if the line is bare. -->
|
||||
<t t-set="_thickness" t-value="(_line and 'x_fc_thickness' in _line._fields and _line.x_fc_thickness)
|
||||
or (_coating and 'thickness' in _coating._fields and _coating.thickness)
|
||||
or '-'"/>
|
||||
<!-- Notes content = customer-facing description. Per Sub 2 decision
|
||||
Q6: SO line `name` is the customer-facing description (Odoo
|
||||
standard). Falls back to product name when the line is bare. -->
|
||||
<t t-set="_notes_content" t-value="(_line and _line.name)
|
||||
or (_part and _part.name)
|
||||
or '-'"/>
|
||||
<!-- Inline the QR as base64 data URI so wkhtmltopdf doesn't need
|
||||
to fetch /report/barcode/ over the network during rendering. -->
|
||||
<t t-set="_qr_src" t-value="env['ir.actions.report'].barcode_data_uri(
|
||||
@@ -82,10 +95,9 @@
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
/* Boxy professional layout: thick outer border, horizontal row
|
||||
borders, vertical label/value divider. Absolute positioning +
|
||||
% row heights force the content to fill the full page in
|
||||
wkhtmltopdf (which ignores vh/vw/flex). ------------------- */
|
||||
/* 3-cell header (Logo | WO# | QR) + 2-region body (fields left,
|
||||
Notes column right). Absolute positioning + % heights/widths
|
||||
are mandatory — wkhtmltopdf ignores vh/vw/flex. ----------- */
|
||||
.fp-sticker {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
color: #000;
|
||||
@@ -97,14 +109,14 @@
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
/* ---- HEADER band — grew to 40% to fit 2x WO# + logo + bigger QR. */
|
||||
/* ---- HEADER band: 3 horizontal cells, divided by vertical
|
||||
rules. Logo / WO# / QR. ---- */
|
||||
.fp-sticker-head-wrap {
|
||||
position: absolute;
|
||||
left: 0; right: 0; top: 0;
|
||||
height: 40%;
|
||||
height: 30%;
|
||||
border-bottom: 2px solid #000;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
table.fp-sticker-head {
|
||||
width: 100%;
|
||||
@@ -112,82 +124,70 @@
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.fp-sticker-head td { padding: 0; vertical-align: middle; }
|
||||
col.fp-col-head-left { width: 66%; }
|
||||
col.fp-col-head-right { width: 34%; }
|
||||
td.fp-sticker-head-left {
|
||||
overflow: hidden;
|
||||
border-right: 2px solid #000;
|
||||
}
|
||||
td.fp-sticker-head-right {
|
||||
col.fp-col-head-logo { width: 28%; }
|
||||
col.fp-col-head-wo { width: 44%; }
|
||||
col.fp-col-head-qr { width: 28%; }
|
||||
table.fp-sticker-head td {
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* Left column nested 2-row table: logo on top, WO# below.
|
||||
Horizontal divider between rows mirrors body row borders. */
|
||||
table.fp-sticker-head-left-stack {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.fp-sticker-head-left-stack tr.fp-row-logo { height: 50%; }
|
||||
table.fp-sticker-head-left-stack tr.fp-row-wo { height: 50%; }
|
||||
table.fp-sticker-head-left-stack td {
|
||||
padding: 0 14px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/* Logo cell + WO# cell each get explicit vertical-align so the
|
||||
content sits in the middle of its half of the header band. */
|
||||
table.fp-sticker-head-left-stack tr.fp-row-logo td,
|
||||
table.fp-sticker-head-left-stack tr.fp-row-wo td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
table.fp-sticker-head-left-stack tr + tr td {
|
||||
border-top: 1px solid #000;
|
||||
}
|
||||
td.fp-sticker-head-logo { border-right: 2px solid #000; padding: 0 6px; }
|
||||
td.fp-sticker-head-wo { border-right: 2px solid #000; }
|
||||
.fp-sticker-logo {
|
||||
/* Logo bumped 40% (116 → 162px height, 520 → 728px width). */
|
||||
max-height: 162px;
|
||||
max-width: 728px;
|
||||
display: block;
|
||||
max-height: 120px;
|
||||
max-width: 95%;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.fp-sticker-wo {
|
||||
font-size: 72pt;
|
||||
font-size: 44pt;
|
||||
font-weight: 900;
|
||||
letter-spacing: 0.2mm;
|
||||
letter-spacing: 0.1mm;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
}
|
||||
/* QR wrapper crops the white quiet-zone around the QR pattern
|
||||
so it doesn't visually float on a white square inside the
|
||||
cell. The PNG from Odoo's barcode generator carries a
|
||||
~12% border (4 modules of quiet-zone) on each side; we
|
||||
render the image larger than the wrapper and offset it so
|
||||
the wrapper clips that border out. ---------------------- */
|
||||
/* QR wrapper crops the white quiet-zone around the QR pattern.
|
||||
Odoo's barcode generator pads ~12% of quiet-zone on each side;
|
||||
we render the image larger and offset it so the wrapper clips
|
||||
the border out. ---- */
|
||||
.fp-sticker-qr-wrap {
|
||||
width: 460px;
|
||||
height: 460px;
|
||||
width: 290px;
|
||||
height: 290px;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fp-sticker-qr {
|
||||
width: 620px;
|
||||
height: 620px;
|
||||
width: 390px;
|
||||
height: 390px;
|
||||
position: absolute;
|
||||
top: -80px;
|
||||
left: -80px;
|
||||
top: -50px;
|
||||
left: -50px;
|
||||
margin: 0;
|
||||
display: block;
|
||||
}
|
||||
/* ---- BODY band (7 rows, each 14.28% of the band) ---- */
|
||||
/* ---- BODY band: left fields region + right Notes region ---- */
|
||||
.fp-sticker-body-wrap {
|
||||
position: absolute;
|
||||
left: 0; right: 0;
|
||||
top: 40%; bottom: 0;
|
||||
top: 30%; bottom: 0;
|
||||
}
|
||||
.fp-body-left {
|
||||
position: absolute;
|
||||
left: 0; top: 0; bottom: 0;
|
||||
width: 64%;
|
||||
border-right: 2px solid #000;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.fp-body-right {
|
||||
position: absolute;
|
||||
left: 64%; right: 0; top: 0; bottom: 0;
|
||||
box-sizing: border-box;
|
||||
padding: 8px 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
table.fp-sticker-body {
|
||||
width: 100%;
|
||||
@@ -195,27 +195,20 @@
|
||||
table-layout: fixed;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
/* Body rows: 6 single-line rows at 12.67% each, Notes gets 24% (~2x) so the operator has real room to write. */
|
||||
table.fp-sticker-body tr { height: 12.67%; }
|
||||
table.fp-sticker-body tr.fp-row-notes { height: 24%; }
|
||||
table.fp-sticker-body tr.fp-row-notes td.fp-sticker-value {
|
||||
white-space: normal;
|
||||
vertical-align: top;
|
||||
padding-top: 10px;
|
||||
}
|
||||
table.fp-sticker-body tr { height: 14.28%; }
|
||||
table.fp-sticker-body tr + tr td { border-top: 1px solid #000; }
|
||||
col.fp-col-label { width: 32%; }
|
||||
col.fp-col-value { width: 68%; }
|
||||
col.fp-col-label { width: 38%; }
|
||||
col.fp-col-value { width: 62%; }
|
||||
table.fp-sticker-body td {
|
||||
vertical-align: middle;
|
||||
padding: 0 14px;
|
||||
font-size: 38pt;
|
||||
padding: 0 12px;
|
||||
font-size: 22pt;
|
||||
line-height: 1.1;
|
||||
}
|
||||
td.fp-sticker-label {
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
border-right: 2px solid #000;
|
||||
border-right: 1px solid #000;
|
||||
background-color: #f1f2f4;
|
||||
}
|
||||
td.fp-sticker-value {
|
||||
@@ -224,43 +217,50 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
.fp-sticker-strong { font-weight: 700; }
|
||||
.fp-sticker-muted { color: #555; font-size: 28pt; }
|
||||
.fp-sticker-muted { color: #555; font-size: 16pt; }
|
||||
/* Notes column on the right side of the body. */
|
||||
.fp-notes-label {
|
||||
font-weight: 700;
|
||||
font-size: 22pt;
|
||||
margin: 0 0 6px 0;
|
||||
}
|
||||
.fp-notes-content {
|
||||
font-size: 16pt;
|
||||
line-height: 1.3;
|
||||
white-space: pre-line;
|
||||
word-wrap: break-word;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="fp-sticker">
|
||||
<!-- 3-cell header: Logo | WO# | QR -->
|
||||
<div class="fp-sticker-head-wrap">
|
||||
<table class="fp-sticker-head">
|
||||
<colgroup>
|
||||
<col class="fp-col-head-left"/>
|
||||
<col class="fp-col-head-right"/>
|
||||
<col class="fp-col-head-logo"/>
|
||||
<col class="fp-col-head-wo"/>
|
||||
<col class="fp-col-head-qr"/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="fp-sticker-head-left">
|
||||
<td class="fp-sticker-head-logo">
|
||||
<!-- env.company.logo is often blank while logo_web
|
||||
is populated from the company partner's image.
|
||||
Fall back across both + partner.image_1920. -->
|
||||
is populated from the partner's image. Fall
|
||||
back across both + partner.image_1920. -->
|
||||
<t t-set="_logo" t-value="env.company.logo
|
||||
or env.company.logo_web
|
||||
or env.company.partner_id.image_1920
|
||||
or False"/>
|
||||
<table class="fp-sticker-head-left-stack">
|
||||
<tr class="fp-row-logo">
|
||||
<td>
|
||||
<img t-if="_logo"
|
||||
class="fp-sticker-logo"
|
||||
t-att-src="image_data_uri(_logo)"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="fp-row-wo">
|
||||
<td>
|
||||
<div class="fp-sticker-wo">
|
||||
WO #<span t-esc="_order_id"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<img t-if="_logo"
|
||||
class="fp-sticker-logo"
|
||||
t-att-src="image_data_uri(_logo)"/>
|
||||
</td>
|
||||
<td class="fp-sticker-head-right">
|
||||
<td class="fp-sticker-head-wo">
|
||||
<div class="fp-sticker-wo">
|
||||
WO #<span t-esc="_order_id"/>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="fp-sticker-qr-wrap" t-if="_qr_src">
|
||||
<img class="fp-sticker-qr"
|
||||
t-att-src="_qr_src"/>
|
||||
@@ -270,90 +270,87 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Body: 7-row field table on the left, full-height Notes
|
||||
column on the right showing the customer-facing description. -->
|
||||
<div class="fp-sticker-body-wrap">
|
||||
<table class="fp-sticker-body">
|
||||
<colgroup>
|
||||
<col class="fp-col-label"/>
|
||||
<col class="fp-col-value"/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">PO (RO):</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span class="fp-sticker-strong"
|
||||
t-esc="_po_number"/>
|
||||
<t t-if="_mo_ref">
|
||||
<span class="fp-sticker-muted">
|
||||
(<span t-esc="_mo_ref"/>)
|
||||
</span>
|
||||
</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Customer:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span t-esc="_partner_name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Process:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-if="_process">
|
||||
<span t-esc="_process.name"/>
|
||||
</t>
|
||||
<t t-elif="_coating">
|
||||
<span t-esc="_coating.name"/>
|
||||
</t>
|
||||
<t t-else="">-</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Part Number:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-if="_part">
|
||||
<span class="fp-sticker-strong"
|
||||
t-esc="_part.part_number"/>
|
||||
<t t-if="_part.revision">
|
||||
<!-- Some parts store the revision with a
|
||||
"Rev " prefix already (e.g. "Rev 1"),
|
||||
others store just the value ("1", "A").
|
||||
Strip a leading "Rev " (case insensitive)
|
||||
so we don't print "Rev Rev 1". -->
|
||||
<t t-set="_rev_clean" t-value="_part.revision.strip()"/>
|
||||
<t t-if="_rev_clean.lower().startswith('rev ')">
|
||||
<t t-set="_rev_clean" t-value="_rev_clean[4:].strip()"/>
|
||||
<div class="fp-body-left">
|
||||
<table class="fp-sticker-body">
|
||||
<colgroup>
|
||||
<col class="fp-col-label"/>
|
||||
<col class="fp-col-value"/>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">PO #:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span class="fp-sticker-strong"
|
||||
t-esc="_po_number"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">SN #:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span t-esc="_serial_number"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Customer:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span t-esc="_partner_name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Part #:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-if="_part">
|
||||
<span class="fp-sticker-strong"
|
||||
t-esc="_part.part_number"/>
|
||||
<t t-if="_part.revision">
|
||||
<!-- Strip "Rev " prefix if the field
|
||||
value already includes it, so we
|
||||
don't print "Rev Rev 1". -->
|
||||
<t t-set="_rev_clean" t-value="_part.revision.strip()"/>
|
||||
<t t-if="_rev_clean.lower().startswith('rev ')">
|
||||
<t t-set="_rev_clean" t-value="_rev_clean[4:].strip()"/>
|
||||
</t>
|
||||
<span class="fp-sticker-muted">
|
||||
Rev <span t-esc="_rev_clean"/>
|
||||
</span>
|
||||
</t>
|
||||
</t>
|
||||
<span class="fp-sticker-muted">
|
||||
Rev <span t-esc="_rev_clean"/>
|
||||
<t t-else="">-</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Due Date:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-if="_due">
|
||||
<span t-esc="_due.strftime('%b %d, %Y')"/>
|
||||
</t>
|
||||
<t t-else="">-</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Thickness:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span t-esc="_thickness"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Qty:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span class="fp-sticker-strong">
|
||||
<span t-esc="int(_qty) if _qty == int(_qty) else _qty"/>
|
||||
</span>
|
||||
</t>
|
||||
</t>
|
||||
<t t-else="">-</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Due Date:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-if="_due">
|
||||
<span t-esc="_due.strftime('%b %d, %Y')"/>
|
||||
</t>
|
||||
<t t-else="">-</t>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fp-sticker-label">Qty:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<span class="fp-sticker-strong">
|
||||
<span t-esc="int(_qty) if _qty == int(_qty) else _qty"/>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="fp-row-notes">
|
||||
<td class="fp-sticker-label">Notes:</td>
|
||||
<td class="fp-sticker-value">
|
||||
<t t-esc="_internal_note"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="fp-body-right">
|
||||
<div class="fp-notes-label">Notes:</div>
|
||||
<div class="fp-notes-content">
|
||||
<t t-esc="_notes_content"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user