Odoo Help

Welcome!

This community 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.

0

PDF report not using CSS styles

By
Magen
on 5/24/16, 9:24 PM 915 views

Odoo v9 on Windows 7 64bit and I cannot make PDF reports use CSS styles.

So far i've tried:

  • Different versions of wkhtmltopdf (32bit/64bit)

  • Setting System Parameters
    'web.base.url' to 'http://localhost:8069'

    'web.base.url.freeze' to 'True'

    'report.url' to 'http://localhost:8069'

  • Using absolute/relative path css:

    <link href="http://localhost:8069/cds/static/src/css/cds_report.css" rel="stylesheet"/>
  •  Using internal CSS:

    <style> body { font-family: calibri; } </style>

The only thing that worked is setting the style inline:

<div style="...">


I am kinda lost by now. This is report template example:

<template id="cds2_invoice">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="cds2.cds2_invoice_document" t-lang="o.partner_id.lang" />
</t>
</t>
</template>

<template id="cds2_invoice_document">
<style>
.colored {
background-color: #4D4D73;
color:#FFF;
padding:0;
min-height:10px;
}
</style>
<div class="page">
<div class="row">
<div class="colored">
<span>ASD</span>
</div>
</div>
</div>
</template>


0
Juan Vicente Pascual
On 5/25/16, 5:37 AM

Before

<template id="cds2_invoice">

put the next code,

<template id="my_layout" inherit_id="report.minimal_layout">

<xpath expr="//style" position="after">

<link href="MODULE_NAME/static/src/css/style.css" rel="stylesheet"/>

</xpath>

</template>


Kind Regards,

Juanvi


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/24/16, 9:24 PM
Seen: 915 times
Last updated: 5/25/16, 5:37 AM