I would like add watermarking image in my custom report. Is it possible in odoo8 qweb template?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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:
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 :)
Thanks a lot Yenthe. :-)
No problem, best of luck!
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
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>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Oct 24
|
164 | ||
|
0
Aug 24
|
167 | ||
|
0
Jan 24
|
743 | ||
|
1
Nov 23
|
421 | ||
|
0
Jun 23
|
975 |