Odoo Help

0

How to use Customized fonts for Qweb Report in Odoo 8

By
aneesh ATEES Infomedia Pvt Ltd
on 6/19/17, 8:55 AM 171 views

Hi, i want to use New font for the Qweb report,am tried many ways but nothing working out..How to use new fonts  ?is it possible ?

1
Emanuel Cino
On 6/19/17, 9:58 AM

It's possible. If you want to use some special fonts you should have the font file included in a odoo module directory. On the desired report you should add css style inside the <div class="page"> element.

<style type="text/css">
            /* Declare fonts */
            @font-face {
                font-family: tetria;
                src: url(/odoo_module_name/static/font/TetriaLTComBlack.ttf);
            }
</style>
...
<p style="font-family: tetria;">Hello, World!</p>

In the CSS, you have to replace odoo_module_name/static/font/TetriaLTComBlack.ttf

by the actual folder in which you place your font file and give the name of your font file instead of TetriaLTComBlack.ttf. It's a relative path that must match an existing file otherwise it won't work.

Emanuel Cino
on 6/20/17, 4:28 AM

Are you viewing the report in PDF or HTML? Still not working?

Emanuel Cino
on 6/20/17, 4:53 AM

css

/* Declare fonts */

@font-face {

font-family: corsiva;

src: url(/hotel_reservation/static/src/font/monotype-corsiva-5947e2c660f1f.TTF);

}

report.xml

<p style="font-family: corsiva;">Hello, World!</p>

any other place need to declared ?

aneesh ATEES Infomedia Pvt Ltd
on 6/20/17, 4:54 AM

Try to put the style in a separate template inheriting from report.layout :

<!-- Override general report layout to add custom css -->

<template id="layout" inherit_id="report.layout">

<!-- Add report style -->

<xpath expr="//head" position="inside">

<style type="text/css">

/* Declare fonts */

@font-face {

font-family: tetria;

src: url(/hotel_reservation/static/src/font/monotype-corsiva-5947e2c660f1f.TTF);

}

</style>

</xpath>

</template>

Emanuel Cino
on 6/20/17, 5:01 AM

error while upgrading module

File "src/lxml/lxml.etree.pyx", line 3501, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:194922)

AssertionError: Document does not comply with schema

aneesh ATEES Infomedia Pvt Ltd
on 6/20/17, 6:49 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/19/17, 8:55 AM
Seen: 171 times
Last updated: 6/20/17, 4:22 AM