From 44a980c468a7450e66bf1a2e68672f8482c64b1c Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Fri, 17 Apr 2026 01:59:54 -0400 Subject: [PATCH] refactor(coc): use web.external_layout for header/footer + 3-column bordered accreditations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per feedback, dropped the custom company-contact header and paperformat in favour of Odoo's standard web.external_layout. This gives the CoC: - Company-branded header (logo, name, address, phone, email, tax id) matching whichever layout variant the company picked in Settings → General → Document Layout (Standard / Boxed / Clean / Striped). Automatically themed with company.primary_color. - Consistent page X/Y footer + "Printed on" timestamp. - Correct header_spacing so the letterhead band lines up with the default paperformat. Our body now owns: - Centred "Certificate of Conformance" / "Certificat de Conformité" - 3-column bordered accreditation table — one logo per cell (Nadcap, AS9100D/ISO 9001, CGP) with equal 33.33% widths and #000 borders, 2.8cm cell height so logos centre vertically - Optional customer logo (res.partner.image_1920) right-aligned below the accreditation row - Customer info block (name, address, contact, email, phone) - Certification info table (date, generated-by, WO#) - Quantities table (part, process, PO, shipped, NC qty, job no) - Signature image + bordered cert statement - "Fusion Plating by Nexa Systems" brand note Template plumbing: - Explicit `` in the EN/FR wrappers because QWeb's t-call scoping doesn't expose variables set inside external_layout to the body we pass through. Without this, coc_body's `company.x_fc_owner_user_id` raises KeyError. - Removed paperformat_fp_coc from the report actions (now uses the default paperformat, which is designed for external_layout's reserved header_spacing). Verified: 332KB PDF, 1 page, all 5 images embedded, Amphenol logo on right side of accreditation row, signature renders, company header band at top, page footer at bottom. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../report/report_actions.xml | 4 +- .../report/report_coc.xml | 255 ++++++++---------- 2 files changed, 117 insertions(+), 142 deletions(-) diff --git a/fusion_plating/fusion_plating_reports/report/report_actions.xml b/fusion_plating/fusion_plating_reports/report/report_actions.xml index 6d5a46d0..87cb12ca 100644 --- a/fusion_plating/fusion_plating_reports/report/report_actions.xml +++ b/fusion_plating/fusion_plating_reports/report/report_actions.xml @@ -70,6 +70,8 @@ + + Certificate of Conformance (English) @@ -80,7 +82,6 @@ 'CoC EN - %s' % object.name report - @@ -95,7 +96,6 @@ 'CoC FR - %s' % object.name report - diff --git a/fusion_plating/fusion_plating_reports/report/report_coc.xml b/fusion_plating/fusion_plating_reports/report/report_coc.xml index b05f057a..cbcd58d4 100644 --- a/fusion_plating/fusion_plating_reports/report/report_coc.xml +++ b/fusion_plating/fusion_plating_reports/report/report_coc.xml @@ -4,21 +4,25 @@ License OPL-1 (Odoo Proprietary License v1.0) Fusion Plating — Certificate of Conformance - Four variants: - - report_coc_en English, portrait, ENTECH-style formal cert (primary) - - report_coc_fr French, portrait, mirror of EN - - report_coc_portrait Legacy portrait (kept for existing bindings) - - report_coc Legacy landscape (kept for existing bindings) + Design note: + The EN + FR CoCs wrap their body in web.external_layout. That gives + us Odoo's standard company-branded header (logo, name, address, + phone, email, tax id) and footer (page X/Y, printed-on) for free, + using whichever layout variant the company has chosen in + Settings → General → Document Layout. Our body just renders the + CoC-specific content: title, accreditation badges, customer block, + details table, signature, and certification statement. - Settings sourced from res.company (Settings → Fusion Plating): - - x_fc_owner_user_id.employee_ids[:1].signature Default signer image - - x_fc_coc_signature_override Optional override image - - x_fc_{nadcap,as9100,cgp}_logo + _active Accreditation badges + Variants: + - report_coc_en English formal cert (primary) + - report_coc_fr French mirror + - report_coc, report_coc_portrait + Legacy portal-job-bound variants (unchanged) --> - + - - - + @@ -351,9 +322,13 @@