Skip to main content

Report CSS Injection

Beta License: AGPL-3 sygel-technology/sy-reporting-engine

This module allows users to adjust the font size of company PDF reports (invoices, sales orders, delivery slips, etc.) directly from the document layout settings.

For advanced visual customization (colors, margins, spacing, etc.), custom CSS can be defined in developer mode. Changes apply globally per company.

Table of contents

Configuration

Basic configuration (functional users)

To configure the font size, you need to:

  • Go to Settings / General Settings / Companies, and click on the ‘Configure Document Layout’ button

  • Edit text size, text size unit, header size, and header size unit

Advanced configuration (technical users)

To directly customize the report css, you need to

  • Go to Settings / General Settings / Companies, and click on the ‘Configure Document Layout’ button

  • Activate the developer mode

  • Go to custom CSS, and write your css there.

Custom CSS affects all company PDF reports and should only be modified by a technical user.

Here you have a list of css code examples you can insert into the custom css.

  • Usefull css properties:

    line-height: 1.5;
    font-weight: 300;
    margin: 0 100px;
    color: blue;
  • Special css selectors. Some text blocks of the reports are not edited by normal css because they use special classes that overwrite the main css, you should use this special css selectors to edit those blocks:

    h2 {
        color: blue;
    }
    #informations strong {
        color: blue;
    }
    table * {
        color: blue !important;
    }
  • Font size css. It can be usefull knowing that the font size fields of the form view injects a css similar to the following one, with the same attributes and selectors:

    font-size: 16.0px;
    h2 {
        font-size: 32.0px;
    }

Usage

To use this module, print a report after changing the configuration. The font size will be your configured one.

This module replaces the old “reports_font_size” module

Known issues / Roadmap

  • More css units can be added.

  • The names of the added variables (text_size, text_size_unit…) are too generic, and could be added by Odoo in the next versions. Check if this happened in the future migrations

  • The _get_asset_style_b64() call when updating the web.asset_styles_company_report attachment has been overwritten, replacing it for _custom_get_asset_style_b64(). The reason is that, without this change, a update of the base module deletes the css injection. Modules that inherits the _get_asset_style_b64 function might be incompatible. This was the only way found to fix this issue.

  • If a report uses special custom classes, the font size could not be changed. It is not common, but it has been detected that it happens with the boxed reports in v16. It can also happen if a report uses headers other than h2. If this happens to you, tell the technician who creates CSS for you. Example to solve the size of headers 1, and the direction of the boxed:

    font-size: 20px;
    h1 {
        font-size: 40px;
    }
    .o_boxed_header {
        font-size: 20px;
    }

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Sygel

Contributors

Maintainers

This module is part of the sygel-technology/sy-reporting-engine project on GitHub.

You are welcome to contribute.

Metadata

Release files for odoo-addon-report-css-injection 18.0.1.0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-report-css-injection 18.0.1.0.0.1
File Interpreter ABI Platform
odoo_addon_report_css_injection-18.0.1.0.0.1-py3-none-any.whl Python 3 none any Details

Release files / odoo_addon_report_css_injection-18.0.1.0.0.1-py3-none-any.whl

Download URL odoo_addon_report_css_injection-18.0.1.0.0.1-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e171ff13d949addfc9a9e3e0e96038775c3fbb3144428352c6a65e4d912e80d3
BLAKE2b-256 checksum
How to use checksums
685d414125a5624e26fa37f5a277a148e51c09ba9d4907db7cdbbf3984c12e59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

18.0.1.0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page