Help

1

[9.0]How to define custom fonts to CSS in report.assets_common

Avatar
Ermin Trevisan

Step 1: I did add a Google Webfont to the common assets in a module with the following xml:

<openerp>
 <data>
     <!-- Adds all assets in Odoo -->
     <template id="assets_common" name="tw_custom_static_resources assets" inherit_id="web.assets_common">
         <xpath expr="." position="inside">
             <!--These links will be called when loading your Odoo -->
             <link rel="stylesheet" href="/tw_custom_static_resources/static/src/css/custom.css"/>
         </xpath>
     </template>
 </data>
</openerp>

The content of the custom.css file is the following:

@import url(https://fonts.googleapis.com/css?family=Open+Sans);

Step 2: I did add the file custom_reports.css to the report.assets_common by this xml template:

<openerp>
 <data>
     <!-- Adds all assets in Odoo -->
     <template id="assets_common" name="tw_custom_reports assets" inherit_id="report.assets_common">
         <xpath expr="." position="inside">
             <!--These links will be called when loading your Odoo -->
             <link rel="stylesheet" href="/tw_custom_reports/static/src/css/custom_reports.css"/>
         </xpath>
     </template>
 </data>
</openerp>

The content of the custom_reports.css file is

body{   font-family: 'Open Sans', sans-serif !important;
}

Unfortunately this does not work. Reports do not change the font and external reports loose the footer.

Remark: When I add the style attribute style="font-family: 'Open Sans', sans-serif;" directly to the header or footer tag in external header/footer reports layout, the proper font is applied.

Any idea on how to solve this is much appreciated.

Avatar
Abbandona