Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
7 Replies
10790 Tampilan

I would like add watermarking image in my custom report. Is it possible in odoo8 qweb template?

Avatar
Buang
Jawaban Terbai

Hi Ayyappan

The simple answer is yes. You can add css to elements in QWeb reports so you can also add images in it for example.
You can do anything you'd like with CSS so just host an image somewhere and add an element to your report which you style as you'd like.

Update: Here is a sample.Place this under /addons/sale/views/report_saleorder.xml wherever you want the watermark to be printed.

<t t-if="o.client_order_ref">
    <div class="watermark" style="position:absolute;opacity:0.25;font-size:3em;width:100%;text-align:center;z-index:1000;">
        <p t-field="o.client_order_ref"/>
    </div>
 </t>

Example in the layout: 

Avatar
Buang
Penulis

Thanks for reply Yenthe. For an example, i have to print my sale order report with watermarking image. The watermarking text must be the sale order reference number. Is it possible? If it is, can you help me to get this? Give me some example codes...

Updated with a sample. yourRef is the reference that you fill in. You can make it less opacity, bigger, smaller, ... its just an example :)

Penulis

Thanks a lot Yenthe. :-)

Hi Ayyappan,

Not directly.. You would need to create some sort of Qweb loop or something then :s
Couldn't think of a direct, working solution really!

Yenthe

2015-03-16 14:24 GMT+01:00 Ayyappan <s.ayyappan38-gmail.com@mail.odoo.com>:

Is it possible to repeat the watermark for all the pages in pdf report? Above example is printing the watermark only in the first page of the report.

--
Ayyappan
Sent by Odoo Inc. using Odoo about Forum Post False

Jawaban Terbai

To include a watermark in every page of the generated PDF, you can modify either the CSS which is used in every page, or modify the general template to include the watermark. By default, I believe the CSS class is 'page', and the XML ID of the view creating the header for external PDFs is 'external_layout_header' 

If desired, you can add a field for each object , say, 'watermark_content', and then use a t-if as above to display the content. Eg:


<t t-if="o.watermark_content">

  <div style="opacity:25%;width:100%;color:#CCC;z-index:1000;text-align:center;"  t-field="o.watermark_content"/>

</t>

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
0
Okt 24
1856
0
Agu 24
1656
0
Jan 24
2167
1
Nov 23
1851
0
Jun 23
2235