Skip to main content

Change reports font size and other css from the document layout configurator

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file odoo_addon_report_css_injection-18.0.1.0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for odoo_addon_report_css_injection-18.0.1.0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e171ff13d949addfc9a9e3e0e96038775c3fbb3144428352c6a65e4d912e80d3
MD5 c3b1f595c3a59ce0a6c2aa7f1648c33d
BLAKE2b-256 685d414125a5624e26fa37f5a277a148e51c09ba9d4907db7cdbbf3984c12e59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page