This commit is contained in:
gsinghpal
2026-05-21 05:18:32 -04:00
parent d6d6249857
commit b395600a1c
9 changed files with 103 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
# License OPL-1 (Odoo Proprietary License v1.0)
{
'name': 'Fusion Plating — Reports',
'version': '19.0.11.26.7',
'version': '19.0.11.26.14',
'category': 'Manufacturing/Plating',
'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.',
'depends': [

View File

@@ -56,16 +56,20 @@
<field name="default" eval="False"/>
<field name="format">A4</field>
<field name="orientation">Portrait</field>
<!-- margin_top sized for the standard FP header (ENTECH logo +
2-line company address). Earlier 22mm clipped it — the logo
+ name + address actually need ~28mm. 32mm leaves a small
clean gap before the title. Tighter than Odoo's 40mm default. -->
<field name="margin_top">32</field>
<!-- Mirrors paperformat_fp_coc exactly. Tiny margin_top (8mm)
puts the rendered header band flush at the top of the page;
the body clears the header via padding-top on the .fp-sale
wrapper (same way .fp-coc { padding-top: 20mm } clears it
on the CoC). DO NOT set margin_top to "the header height"
— that forces the header to live entirely inside the
reserved zone and any header growth = body overlap.
margin_top=8 + padding-on-wrapper is the proven shape. -->
<field name="margin_top">8</field>
<field name="margin_bottom">15</field>
<field name="margin_left">10</field>
<field name="margin_right">10</field>
<field name="header_line" eval="False"/>
<field name="header_spacing">3</field>
<field name="header_spacing">0</field>
<field name="dpi">90</field>
</record>
@@ -294,14 +298,7 @@
<field name="print_report_name">(object.state in ('draft', 'sent') and 'Quotation - %s' % object.name) or 'Order - %s' % object.name</field>
<field name="binding_model_id" ref="sale.model_sale_order"/>
<field name="binding_type">report</field>
<!-- Uses Odoo's default paperformat so web.external_layout's
header/footer band gets its reserved space correctly (same
approach as report_coc_en / report_coc_fr). Title spacing
below the header is controlled by `padding-top` on the body
wrapper in report_fp_sale.xml — NOT by a custom paperformat,
since trimming the paperformat margin makes the header HTML
bleed into the body. See CLAUDE.md "wkhtmltopdf header
overlap" for the underlying mechanic. -->
<field name="paperformat_id" ref="paperformat_fp_a4_portrait"/>
</record>
<record id="action_report_fp_sale_landscape" model="ir.actions.report">

View File

@@ -32,12 +32,28 @@
</style>
</template>
<!-- Address box content (shared by portrait + landscape) -->
<!-- Address box content (shared by portrait + landscape).
NOTE: `t-field` in Odoo 19 requires a dotted path
("record.field_name") — passing a bare `partner` variable
via t-set and then `t-field="partner"` raises
`AssertionError: t-field must have at least a dot`.
The contact-widget pattern (`t-field="x.partner_id"
t-options="{'widget': 'contact', ...}"`) only works when
x.partner_id is a real field traversal on the document.
So we render the address parts manually with `t-esc` and
per-field guards. -->
<template id="fp_packing_slip_addr_block">
<div class="fp-ps-addr-label" t-esc="label"/>
<strong><span t-esc="partner.name or ''"/></strong>
<div t-field="partner"
t-options="{'widget': 'contact', 'fields': ['address', 'phone', 'email'], 'no_marker': True}"/>
<div t-if="partner.street"><span t-esc="partner.street"/></div>
<div t-if="partner.street2"><span t-esc="partner.street2"/></div>
<div t-if="partner.city or partner.state_id or partner.zip">
<t t-if="partner.city"><span t-esc="partner.city"/></t><t t-if="partner.state_id">, <span t-esc="partner.state_id.code or partner.state_id.name"/></t><t t-if="partner.zip"> <span t-esc="partner.zip"/></t>
</div>
<div t-if="partner.country_id"><span t-esc="partner.country_id.name"/></div>
<div t-if="partner.phone"><span t-esc="partner.phone"/></div>
<div t-if="partner.email"><span t-esc="partner.email"/></div>
</template>
<!-- Items table (shared markup; only widths change between layouts) -->
@@ -72,7 +88,7 @@
</tr>
</thead>
<tbody>
<t t-foreach="doc.move_ids_without_package" t-as="move">
<t t-foreach="doc.move_ids" t-as="move">
<t t-set="line" t-value="move.sale_line_id or move"/>
<t t-set="ordered_qty" t-value="move.product_uom_qty or 0.0"/>
<t t-set="done_qty" t-value="move.quantity or 0.0"/>

View File

@@ -38,22 +38,34 @@
below in italic-grey. */
.fp-bl-en-stk { display: block; font-weight: bold; }
.fp-bl-fr-stk { display: block; font-weight: normal; font-style: italic; color: #555; font-size: 80%; margin-top: 1px; }
/* Kill the extra top padding Odoo's `.page` class adds
(1cm by default). The paperformat already reserves
header room — `.page` padding compounds on top of it
and was the source of the giant gap. Keep left/right/
bottom at 1cm so the content isn't flush to the edges. */
.fp-report.fp-sale .page { padding-top: 0 !important; }
/* Match the CoC pattern exactly: tiny paperformat margin_top
(8mm) lets the header HTML overflow into the body area,
and this 20mm padding-top on the wrapper clears it. See
CLAUDE.md "wkhtmltopdf header overlap" — the alternative
"size margin_top to the header height" approach has zero
slack and breaks any time the header HTML grows. */
.fp-report.fp-sale { padding-top: 20mm; }
/* Title bar uses float-based div layout, NOT an HTML table —
the global ".fp-report table" rule was applying borders
to every nested table even with "border: 0 !important",
so the only reliable fix is to avoid the table element. */
.fp-sale-titlebar { margin: 0 0 8px 0; padding: 0; overflow: hidden; }
.fp-sale-title { font-size: 14pt; line-height: 1.2; color: #2e2e2e; font-weight: bold; }
.fp-sale-title .fp-bl-fr { font-size: 10pt; }
.fp-sale-barcode { float: right; text-align: right; margin-left: 12px; }
.fp-sale-barcode img { height: 34px; max-width: 220px; }
.fp-sale-barcode .fp-bc-label { font-size: 8pt; color: #555; margin-top: 2px; }
.fp-sale-titlebar { margin: 0 0 10px 0; padding: 0; overflow: hidden; }
/* Stacked title: English bold/large on top, French italic/
grey below. Sizes picked so the French line is roughly
the same horizontal width as the English line (English
is shorter character-wise but rendered larger). */
.fp-sale-title-en { font-size: 18pt; font-weight: bold; color: #2e2e2e; line-height: 1.1; display: block; }
.fp-sale-title-fr { font-size: 13pt; font-style: italic; color: #555; line-height: 1.1; display: block; margin-top: 2px; }
.fp-sale-title-num { font-weight: bold; margin-left: 6px; }
/* Barcode: bigger so it scans reliably. Wrap the img + label
in an inline-block so the label centers under the barcode
(not under the full floated column). Explicit no-border on
the img (wkhtmltopdf adds a 1px frame to inline-data img
elements by default on entech). */
.fp-sale-barcode { float: right; margin-left: 12px; }
.fp-bc-wrap { display: inline-block; text-align: center; }
.fp-bc-wrap img { height: 48px; max-width: 240px; border: 0 !important; padding: 0; display: block; }
.fp-bc-wrap .fp-bc-label { font-size: 10pt; color: #333; margin-top: 6px; letter-spacing: 0.5px; }
</style>
</template>
@@ -76,22 +88,24 @@
<div class="fp-report fp-sale">
<div class="page">
<!-- Title bar: bilingual title on the left,
Code128 barcode floated right. NO <table>
— see CLAUDE.md "wkhtmltopdf header
overlap" §2 for why a table here leaks
borders even with `border:0 !important`. -->
<!-- Title bar: stacked English/French title
on the left, Code128 barcode floated
right. NO HTML table — see CLAUDE.md
"wkhtmltopdf header overlap" §2 for why
a table here leaks borders. -->
<div class="fp-sale-titlebar">
<t t-if="barcode_uri">
<div class="fp-sale-barcode">
<img t-att-src="barcode_uri" alt="Order Barcode"/>
<div class="fp-bc-label"><span t-field="doc.name"/></div>
<div class="fp-bc-wrap">
<img t-att-src="barcode_uri" alt="Order Barcode"/>
<div class="fp-bc-label"><span t-field="doc.name"/></div>
</div>
</div>
</t>
<div class="fp-sale-title">
<span class="fp-bl-en"><t t-esc="title_en"/></span><span class="fp-bl-sep">/</span><span class="fp-bl-fr"><t t-esc="title_fr"/></span>
<span> # </span><span t-field="doc.name"/>
</div>
<span class="fp-sale-title-en">
<t t-esc="title_en"/><span class="fp-sale-title-num"># <span t-field="doc.name"/></span>
</span>
<span class="fp-sale-title-fr"><t t-esc="title_fr"/></span>
</div>
<!-- Billing / Shipping (wide cells — inline) -->