Skip to Content
Menu
This question has been flagged
1 Odpoveď
10606 Zobrazenia

Hi,

I want a custom image to be displayed in the invoice so I have created a custom field (Binary) and asked the user to upload an image. The field shows up in ir_attachment table which is fine but the column db_datas is null and yet the image is being displayed in the UI. I want to know where is the image getting stored when uploaded and how can i put/refer to them in the qweb report?

Thanks

Avatar
Zrušiť
Best Answer

Database can only store text in the columns. So inorder to convert binary data into text like data to storein DB binary data is converted by using Base64 encoding. you can see the binary field in the Table as some random strings.

You can use the widget='image' to see the binary field as an image.

Avatar
Zrušiť
Autor

Hi Pablo,

As mentioned in the question, the column db_datas is binary and I'm assuming when i upload a image binary data gets stored in this column but it's not happening and column stays as null even after uploading the image and yet in the UI i could view the image as i mentioned in the question. I want to know what's happening and why is that happening

you can see the image base64 data in the custom binary field you created in the account.invoice model.

Although the field is named as db_datas in the database, in odoo you can access it using the field 'datas', instead of 'db_datas'.

Autor

how can i access that image in qweb report? Any idea??

<span t-field="your_binary_field" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>

just add the field in the report qweb view with widget=image.

Related Posts Replies Zobrazenia Aktivita
5
aug 19
9511
3
apr 19
6739
3
feb 24
14433
3
apr 19
6025
4
mar 19
7738