Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
2 Respuestas
1246 Vistas
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
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

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
Descartar
Avatar
John
Mejor respuesta

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
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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