How to add image in a report by using an existing professional template image - odoo

How can I add an image in a report by using an existing professional template image?
the image object is report.template.settings
the filed name is footer_logo
I try this code not work for me
<span t-field="report.template.settings.footer_logo" t-field-options='{"widget": "image"}'/>

You can use image like this:
<img t-att-src="report.template.settings.footer_logo"/>

Related

Odoo 12 qweb report not rendering image

I have below code in one of my V10 qweb report.
<img t-if="company.logo_footer" t-att-src="'data:image/png;base64,%s' % company.logo_footer" style="max-height: 30px;"/>
Its rendering image correctly in V10, but in V12 it does not show image, I checked wkhtmltopdf and it installed correctly.
I solved it, in odoo 12 we need to pass binary field to a function.
<img t-if="company.logo_footer" t-att-src="image_data_uri(company.logo_footer)" style="max-height: 30px;"/>
This solved my issue !!!

How to include a checkbox image in a Qweb Report?

Is there way to change checkbox image in qweb report. For example i want to change standard "V" to image like this:
Is it possible?
Solution 0
Add the file to your module, for example store it in the path /module_name/static/src/img/image_name.png
Then now you can add the image to the Qweb Report:
<img t-att-src="'/module_name/static/src/img/image_name.png'" />
Note: respect the order and the type of the quotes
Solution 1
Maybe it is useful to create ul html list with all the elements you want to add:
<style>
.icon_list {
list-style-image: url('/module_name/static/src/img/image_name.png');
}
</style>
<!-- [...] -->
<ul class="icon_list" >
<li>Coffee</li>
<li>Tea</li>
<li>Coca Cola</li>
</ul>
(I didn´t try it but it should work as well)
you can simply replace it with the standard Unicode character ☑ by a field that is checking the status
Please use "input type as checkbox". It worked for me.
<input type="checkbox" checked="checked"/>I agree that glasses are selected based on my indications
in odoo11
you can choose this class for checkbox
i class="fa fa-check which opening and closing tags This gives better checkbox than default in odoo

Adding image to HTML/PDF report

I'm trying to add an image in an HTML report template. The image is stored in sys$FileDescriptor. I found some instructions for docx templates, but no luck so far with html templates.
I also tried using FileDescriptor.name as src field, but the file specified doesn't exist
In the end I managed to insert an image in an html template for pdf generation with this code:
<img src="../work/app-core/filestorage/${headerRow.fields.logoYear}/${headerRow.fields.logoMonth}/${headerRow.fields.logoDay}/${headerRow.fields.logoId}.${headerRow.fields.logoExt}" width="220" height="220"/>
The needed fields are obtained in sql from sys_file.update_ts with "to_char" Postgres function to allow for the correct format of the fields (YYYY, MM, DD)
At the moment YARG and CUBA Reporting do not provide means to insert images into HTML-reports similarly to DOCX/XLSX.
But pictures could be inserted/embedded with the img-tag.
src could be a link to picture:
<img src="http://localhost:8080/images/SomePicture.jpg" height="68" width="199" border="0" align="right"/>
Or you can embed a bitmap (your appproach with variables is also useable):
<img alt='SomePicture.png' src='data:image/png;base64,iVBORw0K ..... AcEP9PwxD0hNKK1FCAAAAAElFTkSuQmCC' style='max-width: 100%;'/>
Thank you for your question. The platform documentation is going to be updated soon.

Vb.net How to get image from webbrowser to picturebox like this?

I'm trying to get a image from webbrowser to imagebox.
İmage link likes this
<div id="aazone.OutputDiv" name="aazone.OutputDiv" class="noScrollbar">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgPI0/FTlWfjZ5Dnk+dJ
eAElFTkSuQmCC" style="border:1px solid #999999;"></div>
You have the Base64 representation in the src= attribute of the element, so you can just split that out and get the image bytes. This is essentially answered in this post:
converting a base 64 string to an image and saving it
All you need to do is some string work before hand to get your encoded png string.

Image is not displaying in cfdocument pdf for coldfusion 10

I am using ColdFusion 10 Enterprise edition, and am unable to display images when using CFDOCUMENT to generate a PDF. Below is the piece of code I am using:
<cfsavecontent variable="report">
<table align='center'>
<cfoutput query="VARIABLES.result">
<tr>
<td>
<div class='addInfoDetails'>#SHOWINFO#</div>
</td>
</tr>
</cfoutput>
</table>
</cfsavecontent>
In the above code, the VARIABLES.result query is coming from database and SHOWINFO is a variable having the content of image and text. For example:
SHOWINFO =
"<p> Hi This is the test information
<img alt="image" src="../TestBank/test/info/5KQ.jpg"/>
</p>"
Here if dump the SHOWINFO variable inside the CFSAVECONTENT, the image displays correctly. But when I convert this into PDF, using CFDOCUMENT, the image is not displaying.
Below is the code block I am using to generate the pdf:
<cfdocument format="PDF" saveasname="TestPDF">
<cfoutput>#report#</cfoutput>
</cfdocument>
Thanks in advance.
I fixed it by adding the attribute "localUrl = yes" in CFDOCUMENT tag.
Now it is working fine for me.
I'm saving the created pdf and find localUrl="yes" (or =true) fails. Turns out CF generating pdfs for https urls is painfully finicky.
<img src="file:\\\#replace(getCurrentTemplatePath(),"my.cfm")#images\my.png">
Worked for me, in case anyone is scraping the bottom of the barrel for ideas. getCurrentTemplatePath() gets the filename as well as the path, so I had to remove it (hence the replace(...,"my.cfm"). I also tried expandPath(".") and that failed as well.
Didn't try Dave Anderson's intriguing suggestion to grab the image Coldfusion CFDOCUMENT creates a red X