Odoo Help


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.


qweb report background color not printing in pdf

on 10/11/16, 7:21 PM 104 views

I have a qweb report which requires a color box to be printed. The color needs to be dynamic or saved in database per record or sales order.

Below is my part of code:

<style type="text/css">

* {-webkit-print-color-adjust:exact;}
.order_color {
        background-color: <t t-esc="o.color_code"/> !important;
        -webkit-print-color-adjust: exact;

@media print {
    .order_color {
        background-color: <t t-esc="o.color_code"/>;
        -webkit-print-color-adjust: exact;


<div class="col-xs-12 order_color" style='height:40px;width:200px;'></div>

When I preview in "qweb-html" it does show the colored background. But when I print with "qweb-pdf" no background pdf.

I tried alternative as below, but still not printing background:

<div class="col-xs-12 order_color" style='height:40px;width:200px;&lt; t-esc="o.color_code"/&gt;'></div>

When I manually put background color as below then the PDF and HTML are fine.

<div class="col-xs-12 order_color" style='height:40px;width:200px;background-color:#00FFF;'></div>

But I wanted the background color to be dynamic per order, for example, I have at least 12 different color varieties I wanted to display on iteration in orders.

My OS is 8.6 debian. with wkhtmltopdf (with patched qt), and odoo 8.

I suspect the problem is within wkhtmltopdf. 

Any help much appreciated. Thanks.

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)


Asked: 10/11/16, 7:21 PM
Seen: 104 times
Last updated: 10/12/16, 1:49 AM