Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

[Odoo 17] Extra Space at Top and Bottom in Custom Report after Removing Default Header/Footer

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
2 Besvarelser
1262 Visninger
Avatar
MOHAMED

Hi everyone,

I'm working on a custom report in Odoo 17, and I've run into an issue with the layout.

I created a new report_paperformat and a custom report template. I removed the default Odoo header (web.external_layout) and footer, but I still have extra white space at the top and bottom of the generated PDF.

Here’s what I’ve already tried:

  • Replaced <t t-call="web.external_layout"> with my own layout using t-foreach="docs".
  • Removed any t-call="web.internal_layout" as well.
  • Defined a new paper format in report_paperformat.xml with margins set to 0.

Despite this, the PDF still includes a blank area at the top and bottom — it seems like the old margins are still applied.

🔧 My paperformat XML:

xml

CopyEdit

<record id="custom_report_paperformat" model="report.paperformat"> <field name="name">Custom Format</field> <field name="default" eval="True"/> <field name="format">A4</field> <field name="margin_top">0</field> <field name="margin_bottom">0</field> <field name="margin_left">0</field> <field name="margin_right">0</field> <field name="header_line" eval="False"/> <field name="orientation">Portrait</field> <field name="page_height">0</field> <field name="page_width">0</field> <field name="dpi">90</field> </record>

❓Question:

How can I completely remove the top and bottom spacing in the report PDF?

Is there a way to force zero margin rendering, or do I need to override something in the QWeb rendering engine or CSS?

Thank you in advance!

0
Avatar
Kassér
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Bedste svar

Hi,


This is a common issue when working with custom PDF reports in Odoo. Even after setting margins to 0 and removing the header/footer, white space may still appear. Here's how to solve it completely:


Corrected Paper Format XML:

The issue is likely caused by setting page_height and page_width to 0, which tells wkhtmltopdf to fall back to default A4 size with default margins.

You should explicitly define A4 dimensions in mm:


<record id="custom_report_paperformat" model="report.paperformat">

    <field name="name">Custom Format</field>

    <field name="default" eval="True"/>

    <field name="format">A4</field>

    <field name="margin_top">0</field>

    <field name="margin_bottom">0</field>

    <field name="margin_left">0</field>

    <field name="margin_right">0</field>

    <field name="header_line" eval="False"/>

    <field name="orientation">Portrait</field>

    <field name="page_height">297</field> <!-- A4 height in mm -->

    <field name="page_width">210</field>  <!-- A4 width in mm -->

    <field name="dpi">90</field>

</record>


Attach the Paper Format to the Report

Ensure your custom report uses this paper format:


<record id="your_custom_report_action" model="ir.actions.report">

    <field name="paperformat_id" ref="your_module.custom_report_paperformat"/>

</record>


Hope it helps.


1
Avatar
Kassér
Avatar
John
Bedste svar

Defining a custom report and paper format and removing the default web.external_layout is the correct way to remove default Odoo headers/footers and control layout. However, extra white space still appears in the PDF, which is a common issue due to how wkhtmltopdf handles margins, especially when there are conflicts between HTML/CSS and paper format.


✅ 1. Check Report Paper Format Linkage

Make sure your report is correctly linked to the custom paperformat. In your report.xml or report_action record, add:


<record id="action_report_my_custom" model="ir.actions.report">

    <field name="name">My Custom Report</field>

    <field name="report_name">my_module.report_template_id</field>

    <field name="report_type">qweb-pdf</field>

    <field name="paperformat_id" ref="my_module.custom_report_paperformat"/>

</record>

✅ 2. Set All Margins and Page Sizes Correctly

Your paper format XML looks mostly good. Here's a safer version:

<record id="custom_report_paperformat" model="report.paperformat">

    <field name="name">Custom Format</field>

    <field name="format">A4</field>

    <field name="page_width">0</field>

    <field name="page_height">0</field>

    <field name="margin_top">0</field>

    <field name="margin_bottom">0</field>

    <field name="margin_left">0</field>

    <field name="margin_right">0</field>

    <field name="orientation">Portrait</field>

    <field name="header_line" eval="False"/>

    <field name="dpi">90</field>

    <field name="default" eval="False"/>

</record>

👉 Setting both page_height and page_width to 0 tells Odoo to use the standard A4 dimensions as per the format field.

✅ 3. Force CSS Margin Reset in Template

Sometimes, QWeb adds padding/margins via the stylesheet (report.min.css). Add a style override to your template:



<t t-name="my_module.report_template_id">

    <t t-call="web.html_container">

        <t t-set="css">

            <![CDATA[

                @page {

                    margin: 0mm !important;

                }

                body {

                    margin: 0mm !important;

                    padding: 0mm !important;

                }

                .page {

                    margin: 0mm !important;

                    padding: 0mm !important;

                }

            ]]>

        </t>

        <div class="page">

            <!-- your content -->

        </div>

    </t>

</t>

✅ This helps override any default layout styling inside .page, body, or @page.

0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now