Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
15763 Widoki

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;
        }
    }

 </style>


<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 0.12.2.1 (with patched qt), and odoo 8.


I suspect the problem is within wkhtmltopdf. 



Any help much appreciated. Thanks.



Awatar
Odrzuć

How did You solve this ?

Najlepsza odpowiedź

@ V10 Odoo Community : Dynamic set background color in  qweb report 

  • Exmaple

                        primary_color : Char Field 

  • view Xml :

                      <field name="primary_color"   widget="color"/> 

  •  For Widget="Color"   You Should install web_widget_color module 

  • site: https://apps.odoo.com/apps/modules/8.0/web_widget_color/

  • Report Template View

                  <td t-attf-style="background-color:{{data['primary_color']}}!important; ">

  • Also Refer: https://www.odoo.com/apps/modules/10.0/professional_reports_itmcs/


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lip 15
3718
0
cze 21
3079
0
lis 19
3160
0
kwi 24
1835
0
sty 24
1558