| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 361 |
| Technical Name |
cons_custom_reports |
| License | LGPL-3 |
| Website | https://odoomacedonia.mk |
| Versions | 18.0 19.0 |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Lines of code | 361 |
| Technical Name |
cons_custom_reports |
| License | LGPL-3 |
| Website | https://odoomacedonia.mk |
| Versions | 18.0 19.0 |
Fast WeasyPrint Reports
Replace Odoo's sluggish wkhtmltopdf engine with WeasyPrint — pure Python, runs in-process, 4-8× faster on every PDF report. One toggle in Settings. No layout changes. No broken reports.
😤 The Problem with wkhtmltopdf
Odoo ships with wkhtmltopdf as its default PDF engine. It works, but it has serious problems that get worse the busier your Odoo instance is:
|
🐌 2-3 seconds per PDF Invoices, quotations, delivery slips — every click on "Print" blocks your user for 2-3 seconds while a headless browser warms up. |
💀 Abandoned upstream wkhtmltopdf's last release was 2020. No security patches, no CSS improvements, no new features. Odoo keeps shipping it because replacing it was hard. |
|
⚙️ External binary dependency Requires a system binary installed separately on every server, Docker container, and CI environment. Packaging nightmare on arm64 / Apple Silicon. |
🎲 Flaky under load Spawning a subprocess per print is expensive. Under concurrent load, wkhtmltopdf can timeout, crash, or produce silently corrupted PDFs. |
📊 Speed Comparison
Benchmarked on an Odoo 18 customer invoice. Each measurement is an end-to-end render from the ir.actions.report override to the final PDF bytes written to the response stream.
@font-face file the report declares (Lato in 8 weights plus icon and Google fonts). This module ships those fonts locally and blocks the remote downloads, so the fonts load straight from disk with zero network round-trips. Layout and fonts are identical to wkhtmltopdf — real Lato, not a fallback — only print performance changes.
⚙️ How It Works
Enable the toggle
Go to Settings → Fast Reports → Use WeasyPrint for All Reports and enable it. Save. Done.
Every PDF report becomes fast
All ir.actions.report PDF actions — invoices, quotations, delivery slips, purchase orders, inventory, payroll, custom modules — now render through WeasyPrint. Same templates, same data, faster output.
Automatic fallback safety net
If WeasyPrint fails on a specific report for any reason, the system automatically falls back to wkhtmltopdf for that one render — silently, with a warning in the log. No broken print buttons, ever.
Per-report escape hatch
If a complex third-party report renders incorrectly under WeasyPrint, go to Settings → Technical → Actions → Reports, find it, and tick Use Legacy Engine (wkhtmltopdf). That one report stays on the old engine while everything else benefits from WeasyPrint.
✨ Key Features
|
🐍
Pure Python — No BinaryWeasyPrint is a Python package. It installs with |
🏎️
In-Process RenderingNo subprocess, no headless browser, no IPC. WeasyPrint runs inside the Odoo worker, so there's no 2-3 s process spawn on every print. The Bootstrap grid your templates depend on is preserved untouched — only screen-only backend CSS bundles are stripped. |
|
🔤
Bundled Fonts (No Downloads)Standard Odoo reports declare ~30 |
🛡️
Crash-Safe FallbackThe render override wraps WeasyPrint in a try/except. If anything goes wrong, wkhtmltopdf runs instead and a warning is logged. Users never see an error — they just get their PDF, slightly slower. |
|
🎛️
Per-Report Legacy PinA single boolean field on |
🔇
Silent OperationWeasyPrint normally floods the Odoo log with hundreds of CSS parse warnings from Bootstrap. This module silences WeasyPrint's loggers to ERROR level — only real failures appear. Clean logs. |
📦 Installation
WeasyPrint is a pure-Python PDF engine but it depends on a few system graphics libraries (pango, cairo, gdk-pixbuf) that must be installed at the OS level — pip cannot install them. Follow the guide for your platform below.
macOS (Homebrew)
Works on both Intel and Apple Silicon (M1/M2/M3). Homebrew installs everything to /opt/homebrew/lib on Apple Silicon and /usr/local/lib on Intel — the module auto-detects the correct path at runtime.
1. Install system libraries:
2. Install the Python package:
~/.zshrc) and restart the terminal:export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_FALLBACK_LIBRARY_PATH
The module also preloads the libs automatically on startup as a belt-and-braces fallback.
3. Drop the module in:
4. Restart Odoo, update app list, install:
🐧 Linux
Debian / Ubuntu / Mint
RHEL / Fedora / Rocky / AlmaLinux
Alpine / Docker
weasyprint into that user's Python environment:sudo -H -u odoo pip install weasyprint
🪟 Windows
WeasyPrint on Windows requires the GTK3 runtime for the underlying graphics libraries. Three steps:
Download and run the latest installer from the GTK for Windows project. During install, tick "Set up PATH environment variable to include GTK+".
Verify with:
where libgtk-3-0.dll — you should see a path like C:\Program Files\GTK3-Runtime Win64\bin\
C:\Program Files\Odoo 18\python\. Install into that interpreter:"C:\Program Files\Odoo 18\python\python.exe" -m pip install weasyprint
☁️ odoo.sh (Managed PaaS)
On odoo.sh you can't SSH in to run pip install or apt install. Instead, commit two files to the root of your repo (not inside the module folder) and the build container picks them up automatically on every deploy.
requirements.txt (at repo root)
apt-packages (at repo root)
my-repo/requirements.txt, my-repo/apt-packages, my-repo/cons_custom_reports/. Push to your odoo.sh branch and the build handles the rest.
🎛️ Settings Reference
| Use WeasyPrint for All Reports | Global toggle. When enabled, every ir.actions.report PDF action routes through WeasyPrint. Stored on res.company — each company can have a different setting in multi-company setups. |
| Use Legacy Engine (wkhtmltopdf) | Per-report override. Ticking this on a specific report pins it to wkhtmltopdf regardless of the global setting. Use as an escape hatch for reports that render incorrectly under WeasyPrint. |
ir.config_parameter)| cons_custom_reports.weasy_load_fonts | Default (unset) = fast path: the locally bundled fonts are used and remote font downloads are blocked. The bundle already covers Odoo's standard report fonts, so output is faithful. Set to 1 only if a custom template references a web font that isn't bundled and you want WeasyPrint to fetch it — at the cost of a network round-trip per render. |
| cons_custom_reports.debug_dump_html | Set to any truthy value to dump the rendered HTML to a temp file before WeasyPrint processes it. Useful for diagnosing layout issues. Check the Odoo log for the file path. |
🛠️ Technical Notes
Single Override PointThe module overrides exactly one method: |
macOS Auto-BootstrapOn macOS, dyld's library path doesn't include Homebrew's lib directory. The module patches |
CSS Handling DetailThe print CSS ( |
No New ModelsThe module adds one boolean field to |
❓ Frequently Asked Questions
Will my existing report layouts look different?
In almost all cases: no. WeasyPrint implements the same CSS specs as a modern browser, and this module ships real Lato (Odoo's default report font) plus seven other common families locally — so text renders in the correct typeface, not a system fallback. Layout — margins, tables, page breaks, headers/footers — is identical. If a custom report uses a font that isn't bundled and you want WeasyPrint to download it, set cons_custom_reports.weasy_load_fonts = 1; or pin that report to the legacy engine.
Do I still need wkhtmltopdf installed?
Yes, keep it installed. The auto-fallback mechanism uses wkhtmltopdf when WeasyPrint fails on a specific report. If you're certain WeasyPrint handles all your reports correctly, you can remove wkhtmltopdf — but there's no advantage to doing so, and keeping it costs nothing.
Does this affect Odoo's email attachments (auto-generated PDFs)?
Yes — all PDF generation goes through ir.actions.report, including auto-attached PDFs sent by email (e.g. invoice PDFs sent to customers). They'll be generated faster too.
Is this compatible with Odoo Enterprise?
Yes. The override point is in Odoo Community (base). Enterprise adds fields and templates but doesn't change how _render_qweb_pdf_prepare_streams works, so this module is fully compatible with Enterprise report types (payslips, expense reports, etc.).
What happens if WeasyPrint is not installed and I enable the toggle?
WeasyPrint raises an ImportError on the first render attempt. The fallback catches it, logs a warning with installation instructions, and wkhtmltopdf renders the PDF instead. No data is lost and no user-visible error occurs — but every print will fall back until you install the package.
Make Every Print 6× Faster
Install Fast WeasyPrint Reports, enable one toggle, and your entire Odoo instance prints faster — invoices, quotations, delivery slips, payslips, everything.
Fast WeasyPrint Reports
Developed by Riste Kabranov
odoomacedonia.mk | ristecona@gmail.com
© 2026 Riste Kabranov. All Rights Reserved. · LGPL-3
Please log in to comment on this module