Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Adding Custom CSS to PDF Reports

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
css-styleCSS
1 Atsakyti
1946 Rodiniai
Portretas
Simon Landaverde

Hello,

I am trying to add custom CSS to a PDF Report that I have created. I just wanted to know the proper way of doing this. I have been able to successfully apply my CSS to the PDF report but when testing the installation of the module on a new build I get many errors during testing.

How I included my CSS in the Manifest:

'assets' : {

        'web.report_assets_common' : [

            'my_module/static/src/css/style.css' ,

        ],

    }

Errors I get:

FAIL: TestReportsRendering.test_layout Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_reports.py", line 367, in test_layout self.assertEqual( AssertionError: Lists differ: [['LT[82 chars]Page:', '/ 1', '1'], ['LTFigure', 'Some header[76 chars]'1']] != [['LT[82 chars]Page: 1 / 1'], ['LTFigure', 'Some header Text'[64 chars] 1']]

FAIL: TestReportsRendering.test_pdf_render_page_overflow Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_reports.py", line 458, in test_pdf_render_page_overflow self.assertEqual(len(pages), 6, AssertionError: 4 != 6 : 6 pages are expected, 3 per record (you may ensure `nb_lines` has a correct value to generate an oveflow)

FAIL: TestReportsRendering.test_report_pdf_page_break Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_reports.py", line 442, in test_report_pdf_page_break self.assertEqual(pages_contents, expected_pages_contents) AssertionError: Lists differ: [['LT[82 chars]Page:', '/ 2', '1'], ['LTFigure', 'Some header[306 chars]'2']] != [['LT[82 chars]Page: 1 / 2'], ['LTFigure', 'Some header Text'[282 chars] 2']] 

FAIL: TestReportsRendering.test_thead_tbody_repeat Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/addons/base/tests/test_reports.py", line 521, in test_thead_tbody_repeat self.assertEqual(len(pages), 6, '6 pages are expected, 3 per record (you may ensure `nb_lines` has a correct value to generate an oveflow)') AssertionError: 4 != 6 : 6 pages are expected, 3 per record (you may ensure `nb_lines` has a correct value to generate an oveflow) 

These errors are only present when I have my CSS loaded in my manifest. Any guidance would be much appreciated.

Thanks,
Simon

0
Portretas
Atmesti
Portretas
Odiware Technologies
Best Answer

You're really close! The issue you're hitting is common when adding custom CSS to Odoo PDF reports via web.report_assets_common. While it works visually, it can break PDF rendering tests if the CSS introduces layout shifts, changes margins, or affects pagination.

✅ Best Practice for Custom PDF CSS in Odoo:

Instead of injecting your styles in web.report_assets_common, which affects all reports and test cases globally, you should isolate your CSS to only your specific report.

✅ Solution (Recommended Approach):

Use the report_layout asset bundle only within your report QWeb template, like this:

1. Keep CSS in your module:

plaintext

CopyEdit

my_module/static/src/css/my_report.css

2. Do NOT add it to web.report_assets_common in the manifest.

3. Instead, load it in your QWeb template like this:

xml

CopyEdit

<t t-name="my_module.my_report_template"> <t t-call="web.html_container"> <t t-call-assets="web.report_assets_common" t-js="false"/> <t t-call-assets="my_module.assets_report" t-js="false"/> <!-- Your report content --> </t> </t>

4. Define the custom asset bundle in __manifest__.py:

python

CopyEdit

'assets': { 'my_module.assets_report': [ 'my_module/static/src/css/my_report.css', ], }

✅ Why This Works:

  • Keeps the CSS scoped only to your report.
  • Prevents global test failures like test_layout and test_page_break, which are sensitive to CSS overflow or layout changes.
  • Ensures future compatibility across Odoo versions and PDF engines like wkhtmltopdf or weasyprint.

0
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

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

Registracija
Related Posts Replies Rodiniai Veikla
CSS Flexbox Layout Issue: Seeking Guidance for Troubleshooting
CSS
Portretas
0
saus. 24
1822
Getting CSS Style error while Accessing the site
css-style Error
Portretas
0
rugp. 24
1956
How to modify dropdown "more" arrow on smart button list in odoo 14 Solved
v14 CSS
Portretas
Portretas
1
vas. 23
2649
Customized CSS and JS
css-style Js
Portretas
Portretas
1
spal. 20
1555
local odoo 9 site broken. css? error Solved
odoo9 css-style
Portretas
1
rugp. 15
4992
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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